# Solutions of genetic algorithm and globalsearch versus fmincon

31 views (last 30 days)
Rui Albuquerque on 16 Jan 2020
Answered: Rui Albuquerque on 30 Jan 2020
I have a nonlinear constrained optimization problem (it is a constrained max likelihood problem). I have used Matlab's genetic algorithm and globalsearch for it. In each case, I run fmincon starting with the optimal solution to get the Hessian, but the fmincon solution differs from the starting point. Can you help?

Athul Prakash on 27 Jan 2020
Hi Rui,
I assume that after ga/globalsearch have terminated with a solution, you are calling fmincon with the 'hessian' output option present.
Seeing as fmincon is a completely different category of algorithm to either ga or globalsearch, I would infer that fmincon can further run on your solution (most likely giving you more fine-tuned results). What kind of values are you seeing? Are the differences in the values of obj. function or the solution point that surprising, in your case?
Let me also mention that fmincon returns the Hessian at the second-to-last point, not the final point it converged to.
I would suggest using a different approach to finding the Hessian than running fmincon. You may find the following File Exchange link handy for that, though please be aware that tools on File Exchange are submitted by the community, and not built or tested by The Mathworks.

Rui Albuquerque on 27 Jan 2020
Hi Athul,
Indeed, one problem that I was having is that fmincon gives a different solution. It is not a big difference most of the time, though once in a while the estimated coefficients differ significantly. The values of the objective function is improved after fmincon runs which is good, though somewhat odd that globalsearch did not get it. I think I am willing to tolerate this problem.
While fmincon sometimes differed from globalsearch, the Hessian many times came equal to the identity matrix. Is that because the hessian is initiated as an identity matrix and fmincon did not run more than one iteration?
Rui

Alan Weiss on 29 Jan 2020
See Hessian for an explanation of why the fmincon Hessian return is pretty much useless. If you need the Hessian AND the solution is not near a constraint, then fminunc can give a reasonable approximation.
Alan Weiss
MATLAB mathematical toolbox documentation

Rui Albuquerque on 30 Jan 2020
Thank you!

R2019b

### Community Treasure Hunt

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

Start Hunting!

Translated by