Info

This question is closed. Reopen it to edit or answer.

Results from Genetic Algorithm are lost

1 view (last 30 days)
Amirhossein Mehrkesh
Amirhossein Mehrkesh on 10 Aug 2015
Closed: MATLAB Answer Bot on 20 Aug 2021
I was using GA to find the global optima for an optimization problem. I used the hybrid function "fmincon" in the combination with GA so I put ('hybridfcn',@fmincon). The GA ran for few days and I was able to see the average error was going down (through the plot) it reached to a very promising point (f_value) and converged, so it automatically started using the final results as the initial guess for "fmincon" that I got an error massage (saying there is something wrong with inputs) and now when I type x to see the final results from GA it says undefined x. How can I retrieve the last x that GA converged to (Forget about fmincon I do not need it anymore).

Answers (1)

Walter Roberson
Walter Roberson on 11 Aug 2015
You cannot. The data is gone now.
You should debug your code with a much shorter run.
Ideally you should write long code so that it periodically saves its state so that you can resume from there if a problem occurs.
In practice: before doing the run, give the command
dbstop if error
then if a problem occurs you will be put into the debugger with access to the workspace variables.

Community Treasure Hunt

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

Start Hunting!