I'm optimizing an image reconstruction algorithm using genetic algorithm in Matlab.I did crossover on two population and generate two offsprings without using 'ga' toolkit in matlab. So presently I have two 1*n matrices with integer values ranging from 0-255(They are two images in row major order).for example
population_1 = [1 2 3 4 5 6 7 8 9 10]
population_2 = [10 20 30 40 50 60 70 80 90 100]
And I did single point ordered cross over and got offsprings as
Off_1 = 1 2 3 4 5 60 70 80 90 100
Off_2 = 10 20 30 40 50 6 7 8 9 10
Next I need to do mutation with probability rate of 0.02.I used 'gaoptimset' here and coded as follows.
mutated_child = gaoptimset('MutationFcn', {@mutationuniform, .02})
and I printed the result.It gives a structure like this without any values.
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: []
Can anyone please help me to perform mutation on crossovered childs(Off_1 and Off_2)?Thanks in advance.
I don't know anything about the GA toolbox. But without it you could do something like:
% 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
You should do the same thing with offspring no. 2