Saving intermediate population during GA

I need some help to find out a way to store the information related to every generation of the GA
(both the variable and the fitness values)
It could be both on an external file ( e.g. in a .txt file) or in a struct array.
Which one do you suggest? And how can I do it?
Thanks in advance

 Respuesta aceptada

Alan Weiss
Alan Weiss el 18 de Abr. de 2013

1 voto

You can save whatever you like using an output function. For examples of output functions (using a different syntax, be careful, GA uses its own), see a MATLAB example, and an Optimization Toolbox example.
Alan Weiss
MATLAB mathematical toolbox documentation

2 comentarios

andrea84
andrea84 el 18 de Abr. de 2013
Editada: andrea84 el 18 de Abr. de 2013
Reviewing the example gave me a clearer understanding of the problem.
Thank you!
yusra asad
yusra asad el 8 de Dic. de 2018
It seems that the example gives only the values of the variables, I need the corresponding fval for each indiviual, did you get it?

Iniciar sesión para comentar.

Más respuestas (1)

Daniel Frisch
Daniel Frisch el 7 de Oct. de 2020
You can use my function
outputFcn_global
to store all intermediate results in a global variable, and easily inspect them later on.

Preguntada:

el 17 de Abr. de 2013

Respondida:

el 7 de Oct. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by