Use ga optimization inside the cost/nonlincon function of a ga optimization possilbe?

1 view (last 30 days)
Dear Matlab Community,
I would like to use a ga optimization within the cost or nonlincon function of another ga optimization. Is this possible in general? I run into strage errors. If I replace the outer ga by fmincon, everything works fine. However, I expect the ga to perform better than fmincon...
Thank you in advance :-)
  2 Comments
John D'Errico
John D'Errico on 5 Jan 2023
Edited: John D'Errico on 5 Jan 2023
Is it possible? Yes, though with some caveats, since GA, as a stochastic optimizer of sorts, means that you will not always find the same solution arise from multiple repeat starts. And that alone makes things slightly problematic. GA CANNOT insure it will always find the global optimum. It just tries as hard as it can.
Is your code correct? Surely not, since your code failed, and I just stated it is technically possible.
Where/what is the error in your code? That is impossible to know, since we don't see what you wrote. The only answer here is "Probable user error".
Should GA perform better than FMINCON? Not always. In fact, it will often be the case that fmincon converges more rapidly and to a tighter tolerance than GA for the number of function evals taken.
Walter Roberson
Walter Roberson on 5 Jan 2023
In my experience, ga is almost always slower and less precise. It does, however, have theoretical advantages where the function is discontinuous or has multiple basins to explore.

Sign in to comment.

Answers (1)

Anshuman
Anshuman on 17 Apr 2023
Yes it is possible but using a GA optimization within the cost or nonlinear constraint function of another GA optimization can lead to performance issues, such as slower convergence and longer computation times. This is because the optimization algorithm needs to evaluate the fitness of each individual in the population, and each evaluation requires running the inner GA optimization.
It is also essential to make sure that the parameters of the inner and outer GA are appropriately configured to avoid conflicts and ensure optimal performance. Also we have to check the compatibility of the objective and constraint functions used in the inner and outer GA optimizations.
In case of errors you can try to use other optimization methods, such as fmincon, to check if this issue is related to the nested GA optimization or not. Also it might be helpful to debug the code to identify the source of the issue.
Hope it helps!

Community Treasure Hunt

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

Start Hunting!