【问题标题】:Mutation stage of genetic algorithm in MatlabMatlab中遗传算法的变异阶段
【发布时间】:2015-06-08 14:25:29
【问题描述】:

我正在使用 Matlab 中的遗传算法优化图像重建算法。我在没有使用 matlab 中的“ga”工具包的情况下对两个种群进行了交叉并生成了两个后代。所以目前我有两个 1*n 矩阵,整数值范围为 0-255(它们是按行主要顺序排列的两个图像)。例如

population_1 = [1 2 3 4 5 6 7 8 9 10]
population_2 = [10 20 30 40 50 60 70 80 90 100]

我做了单点排序交叉并得到了后代

Off_1 =  1     2     3     4     5    60    70    80    90   100
Off_2 =  10    20    30    40    50     6     7     8     9    10

接下来我需要进行概率为 0.02 的突变。我在这里使用了 'gaoptimset' 并编码如下。

 mutated_child = gaoptimset('MutationFcn', {@mutationuniform, .02})

我打印了结果。它给出了一个没有任何值的结构。

mutated_child = 

    PopulationType: []
      PopInitRange: []
    PopulationSize: []
        EliteCount: []
 CrossoverFraction: []
    ParetoFraction: []
MigrationDirection: []
 MigrationInterval: []
 MigrationFraction: []
       Generations: []
         TimeLimit: []
      FitnessLimit: []
     StallGenLimit: []
    StallTimeLimit: []
            TolFun: []
            TolCon: []
 InitialPopulation: []
     InitialScores: []
    InitialPenalty: []
     PenaltyFactor: []
      PlotInterval: []
       CreationFcn: []
 FitnessScalingFcn: []
      SelectionFcn: []
      CrossoverFcn: []
       MutationFcn: {[@mutationuniform]  [0.0200]}
DistanceMeasureFcn: []
         HybridFcn: []
           Display: []
          PlotFcns: []
        OutputFcns: []
        Vectorized: []
       UseParallel: []

谁能帮我对交叉的孩子(Off_1 和 Off_2)进行突变?提前谢谢。

【问题讨论】:

    标签: matlab image-processing genetic-algorithm mutation tomography-reconstruction


    【解决方案1】:

    我对 GA 工具箱一无所知。 但如果没有它,您可以执行以下操作:

    % for offspring 1:
    
    p_m = 0.02;
    for i = 1:length(Off_1)
        if rand(1) < p_m
            Off_1(i) = randi([0,255],1);
        end
    end
    

    你应该对后代做同样的事情。 2

    【讨论】:

      猜你喜欢
      • 2015-03-01
      • 2017-10-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-11
      • 2021-03-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多