MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

NMinimize not returning the best solution

  • To: mathgroup at
  • Subject: [mg121687] NMinimize not returning the best solution
  • From: Nacho <ncc1701zzz at>
  • Date: Mon, 26 Sep 2011 04:13:32 -0400 (EDT)
  • Delivered-to:


I'm trying to minimize a least square problem, non-linear with
constraints, using NMinimize. There are 6 variables.

I was getting high residuals in the solution. I'm testing with
variables calculated from a model I'm trying to fit, not measured
values, so a "perfect" solution should be possible.

I suspected that NMinimize was trapped in a local minimum so I tried
to use StepMonitor to Sow every step and then check the progress of
the intermediate steps.

I've discovered that with the methods SimulatedAnnealing and
NelderMead, the intermediate steps are much better than the returned
solution. In fact, the least square residuals are almost zero, as
expected, but the returned values are much worse. The returned value
is an intermediate step but not the best of them.

The method DifferentialEvolution gives the best intermediate step, but
it's much lower.

I could use the other methods by Sowing all the intermediate results
and then checking the best of the set.

I've also checked that the variables are within constraints, it's not
a problem of intermediate steps being out of bounds.

Do you have any idea why is this happening?

My code is a mess right now, but I could provide you with an example
notebook if that helps.


  • Prev by Date: Re: A fast way to compare two vectors
  • Next by Date: Re: problem opening mathematica
  • Previous by thread: Re: Fittings 2 sets of equations and 2 data sets with nonlinearmodelfit
  • Next by thread: A while into another while