Store the optimal information in the history file
Description of feature
The optimal design is stored in the solution object, but not in the history file (remember that the final iteration may not be the optimal solution). Similar to the last key, we should have an optimal key or something that stores the callCounter corresponding to the optimal solution.
Potential solution
This may require stepping through the solution to try and match a callCounter, maybe that's a bit hacky?
Hi @nwu63 , about your potential solution, can you provide example , or python code to show what you mean, i my trying to get the the same "optimal" solution when i run nsga2, and i end up using last which differ from "optimal(s)" solution, best regards
This issue is about finding the optimal solution in the history object. The information is already present in the solution object returned by the optimizer, e.g. sol.xStar. Note that sol.fStar was broken for NSGA2, but I opened a PR to fix it in #330. Once it is merged, the solution object should behave as expected. Docs on the solution object can be found here.
@nwu63 thanks a lot for your comment, best reagards cherifM
@nwu63 do you have test nsga2 for optimise single objective function? An other question, after several generations, i get final solution exactly the same initial solution x0, do you have any way to plot progress of the Fitness function versus the generation?
In the future, please open new issues since your questions are totally unrelated to this issue.
I did add a test for NSGA2 when only a single objective function is present, see #330. For plotting, please see the documentation on postprocessing here. I am not sure if we have something that matches up each generation, since pyOptSparse is primarily focused on gradient-based optimizers and not population-based ones.