Hi,
Have a look at the Long Minuit writeup:
http://wwwasdoc.web.cern.ch/wwwasdoc/minuit/
in particular the comments around the "seek"
command.
My approach with a function like yours would
be to use "evolutionary strategy" like
simulated annealing to find the true minimum
and then use minuit to get error estimates,
contours etc.
Eddy
--- Rüdiger Berlich <ruediger.berlich@iwr.fzk.de>
wrote:
> Dear all,
> I'm trying to compare TMinuit's ability to minimize
> a function with
> Evolutionary Strategies. I'm using a modified
> version of the Ifit.C example
> of ROOT's tutorial section. I have "designed" a
> function that, for a gradient
> descent, should be very difficult to deal with due
> to the large number of
> local minima, whose number increases with increasing
> distance from 0 :
>
> (cos(x^2+y^2) + 2)*(x^2+y^2)
>
> This is a parabola-shaped "wave" symmetric around
> (0,0), whose amplitude and
> frequency increases with increasing distance from 0
> (there are concentric
> "valleys" around 0).
>
> Starting at (100,100), Evolutionary Strategies find
> the minimum at (0,0)
> without problems. TMinuit, with the program listed
> below yields the following
> result :
>
> FCN=20002.5 FROM MIGRAD STATUS=CONVERGED 40
> CALLS 41 TOTAL
> EDM=3.39986e-10 STRATEGY= 1
> ERROR MATRIX ACCURATE
> EXT PARAMETER
> STEP FIRST
> NO. NAME VALUE ERROR
> SIZE DERIVATIVE
> 1 a1 1.00012e+02 5.38438e-03
> 4.76897e-05 -5.21611e-01
> 2 a2 1.00000e+02 5.38504e-03
> 4.76838e-05 -5.21555e-01
>
> So basically TMinuit returns the starting value and
> seems to have got stuck in
> the very first minumum it found. I've also tried
> "MINIMIZE" (i.e MIGRAD +
> SIMPLEX -- no success) and SEEK (somewhat better
> results, but still not
> good). Is there anything I'm doing wrong here ?
>
> Thanks for your help,
> Ruediger Berlich
>
>
>
/********************************************************************/
>
> #include "TMinuit.h"
>
> void fcn(Int_t &npar, Double_t *gin, Double_t &f,
> Double_t *par, Int_t iflag)
> {
> Double_t square = (par[0]*par[0] + par[1]*par[1]);
> f = (cos(square)+2.)*square;
> }
>
> void compfunc2()
> {
> TMinuit *gMinuit = new TMinuit(2);
> gMinuit->SetFCN(fcn);
>
> Double_t arglist[10];
> Int_t ierflg = 0;
>
> arglist[0] = 1;
> gMinuit->mnexcm("SET ERR", arglist ,1,ierflg);
>
> static Double_t vstart[2] = {100., 100.};
> static Double_t step[2] = {4., 4.};
> gMinuit->mnparm(0, "a1", vstart[0], step[0],
> 0,0,ierflg);
> gMinuit->mnparm(1, "a2", vstart[1], step[1],
> 0,0,ierflg);
>
> arglist[0] = 500;
> arglist[1] = 0.1;
> gMinuit->mnexcm("MIGRAD", arglist ,2,ierflg);
>
> Double_t amin,edm,errdef;
> Int_t nvpar,nparx,icstat;
>
> gMinuit->mnstat(amin,edm,errdef,nvpar,nparx,icstat);
> gMinuit->mnprin(3,amin);
> }
>
> /*************************************************************************/
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:16 MET