additional parameters for GA custom crossover/mutation function
이전 댓글 표시
Hi all,
I am using GA optimization on bitstrings with a custom mutation and crossover function. As GA optimization on bitstrings does not respect contraints I have a want to run a function within the two functions that applies my constraints to the new children. For this I need to pass an addtional parameter to the mutation and crossover function.
I am pretty sure on the GA options setup with this additional parameter. It looks like this:
options = gaoptimset('Display','iter','PopulationType','bitstring',...
'PopulationSize',nPopulationSize,...
'InitialPopulation',bPopulation,...
'CrossoverFcn', @PopulationCrossover(bConstraint),...
'MutationFcn', @PopulationMutation(bConstraint),...
'PlotFcns', @GAPlotRule,...
'Vectorized','on',...
'UseParallel',true);
and the GA call looks like this:
[bBitStringBest,rResult] = ga(obj,size(bPopulation,2),[],[],[],[],[],[],[],options);
BUT now the question is how the custom crossover/mutation function needs to look like?
This is basically the the structure described here with some renamings for better understanding: https://de.mathworks.com/help/gads/genetic-algorithm-options.html#f6633
function bCrossoverKids = PopulationCrossover(bParenetChosen,options,nPopulationWidth,FitnessFcn,unused,bParentPopulation)
end
I am struggling on how to pass the additional parameter to the crossover function. Does this have to be in the input arguments and just added behind 'bParentPopulation'?
Thank you for your help.
Christian
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Mathematics에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!