How to change Crossover Function in GA midway through solving?

5 visualizaciones (últimos 30 días)
Harvey Rael
Harvey Rael el 2 de Ag. de 2018
Respondida: Alan Weiss el 6 de Ag. de 2018
Hi all,
I have a GA setup to search for a minimum of a problem. I think my problem is well defined, except it has many local optima. I read in the documentation that changing the Crossover and Mutation Functions midway through iterations can be very useful in aiding of finding global optima. I understand it needs to be modified by the 'OutputFcn' settings, but all the documentation I see include cases where multiple things are being changed. Say if I just want to change the Crossover from 0.2 at the beginning to 0.8 after a certain number of iterations, what would the script for OutputFcn look like?
All the best.

Respuestas (1)

Alan Weiss
Alan Weiss el 6 de Ag. de 2018
I think that this will work, but I have not tested it, so use at your own risk.
Suppose that you want to change the crossover probability at generation 27.
function [state,options,optchanged] = gaoutfun(options,state,flag)
optchanged = false;
if state.Generation == 27
options.CrossoverFraction = 0.8;
optchanged = true;
end
Pass @gaoutfun as the OutputFcn option (I assume that you use optimoptions to set your options).
Alan Weiss
MATLAB mathematical toolbox documentation

Categorías

Más información sobre Genetic Algorithm en Help Center y File Exchange.

Productos


Versión

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by