How can I save parameter values while using simulated annealing?

2 visualizaciones (últimos 30 días)
Joseph Abadi
Joseph Abadi el 18 de Oct. de 2016
Respondida: Alan Weiss el 19 de Oct. de 2016
I need to globally minimize a function of several parameters using simulated annealing in batch mode. I think this means I won't be able to view any output until after the code is finished running, which could take several hours, but I want to be able to somehow check whether the parameters are converging.
Is it possible to save the algorithm's latest guess to a file while it's running? In particular, it would be great if I could save a guess once every 1000 iterations.

Respuestas (2)

Chaya N
Chaya N el 18 de Oct. de 2016
Writing values into an external file is possible but you might not be able to open the file or view progress if the file is concurrently in use by your program (this is specially true if your program is computationally intensive). An alternate way to do this is to manually print your guess values into your command window, which you could achieve by inserting a fprintf or disp command into your program at the required spot.
  1 comentario
Joseph Abadi
Joseph Abadi el 18 de Oct. de 2016
I'm running this optimization in batch mode on an external server. Is there any way I can check what's in the command window? I was under the impression that I had to wait for the log file, which is saved only after the code stops running, to see printed output.

Iniciar sesión para comentar.


Alan Weiss
Alan Weiss el 19 de Oct. de 2016
You can write an output function that logs things every 1000 iterations. Use the assignin('base',...) command.
You might also want to use a plot function to keep track of convergence.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation

Categorías

Más información sobre Simulated Annealing en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by