Start genetic algorithm more than once until solution is found

13 visualizaciones (últimos 30 días)
Paul Haase
Paul Haase el 14 de Abr. de 2021
Respondida: Alan Weiss el 16 de Abr. de 2021
I have generated a genetic algorithm-based optimization problem which is highly restricted by secondary conditions.
I have noticed after running it several times, that solutions can be found in less than 2 min, which completely meet the requirements. In other runs, it happens that the algorithm runs for over half an hour without finding solutions.
To my question: Is there a possibility to let the algorithm stop automatically after a defined time by setting the maxstallgeneration and maxgeneration (yes, I know that the stopping criteria is possible) and restart the genetic algorithm automatically until a solution is found?
I would appreciate every advice.

Respuestas (1)

Alan Weiss
Alan Weiss el 16 de Abr. de 2021
Of course, just write a loop.
runon = true
while runon
% Call ga with option set to stop early if necessary
% If you didn't stop early, set
runon = false;
end
Alan Weiss
MATLAB mathematical toolbox documentation

Categorías

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

Community Treasure Hunt

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

Start Hunting!

Translated by