How to apply a random Crossover (Arithmetic/Scattered/Two-point) in Genetic Algorithm using auto-generated file from Optimization Toolbox ?
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Ankur Shah
le 10 Août 2020
Réponse apportée : Walter Roberson
le 25 Jan 2021
I have prepared a code in MATLAB with optimization toolbox which seems to be giving fair results for different optimization functions but at present, accuracy is highly dependent on the type of crossover selected.
To take advantage of different crossover and to improve efficiency, i want to apply a random crossover after every iteration i.e. any of Arithmetic, Scattered or Two-point. How can I do that ?
7 commentaires
Walter Roberson
le 11 Août 2020
options = optimoptions(options,'CrossoverFcn', @MyCustomCrossover)
function varargout = MyCustomCrossover(varargin)
crossfcns = {@crossoverarithmetic, @crossoverheuristic, @crossoveritnermediate, @crossoverscattered, @crossoversinglepoint, @crossovertwopoint};
chosen = crossfcns{randi(length(crossfcns))} ;
[varargout{:}] = chosen(varargin{:}) ;
end
Réponse acceptée
Walter Roberson
le 25 Jan 2021
options = optimoptions(options,'CrossoverFcn', @MyCustomCrossover)
function varargout = MyCustomCrossover(varargin)
crossfcns = {@crossoverarithmetic, @crossoverheuristic, @crossoveritnermediate, @crossoverscattered, @crossoversinglepoint, @crossovertwopoint};
chosen = crossfcns{randi(length(crossfcns))} ;
[varargout{:}] = chosen(varargin{:}) ;
end
0 commentaires
Plus de réponses (1)
Sulaymon Eshkabilov
le 11 Août 2020
See the screen shot given in the attachement. You should select from the drop-down options whichever crossover function suits for your task.
3 commentaires
Walter Roberson
le 24 Jan 2021
I show using a literally random crossover in https://www.mathworks.com/matlabcentral/answers/577609-how-to-apply-a-random-crossover-arithmetic-scattered-two-point-in-genetic-algorithm-using-auto-gen#comment_968707
Voir également
Catégories
En savoir plus sur Solver Outputs and Iterative Display dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!