RE: NMinimize
- To: mathgroup at smc.vnet.net
- Subject: [mg81763] RE: [mg81740] NMinimize
- From: "David Annetts" <davidannetts at aapt.net.au>
- Date: Wed, 3 Oct 2007 02:27:19 -0400 (EDT)
- References: <200710020947.FAA28904@smc.vnet.net>
Hi Raj, > Could somebody tell me if there is a better way to do this in > Mathematica: > data = Flatten@Import["moistureAtDepth1.dat"]; > data = data[[20000 ;; 30000]]; > ti = Import["times.dat"]; > func[x_, Di_, De_, t_, t1_, t2_] := > (Erfc[x/Sqrt[2400 Di (t - t1)]] - > Erfc[x/Sqrt[2400 Di (t - t2)]] + > Erf[x/Sqrt[2400 De (t - t2) ]]) > parameters = {Di,De}; > NMinimize[ {Plus@@Table[ (data[[i-20000]] - > Plus @@ ((func[15.2, Di, De, i, First@#, Last@#] &) /@ > Select[ti, i - 2880 <= #[[2]] <= i-1 > &]))^2,{i,22881,25000}], > 10^-8<=Di<=10^-1,10^-8<=De<=10^-1},parameters] > > I am interested in Optimizing the NMinimize line. Firstly, are you sure of your model? The model you've given simplifies to func[x_, Di_, De_, t_, t1_, t2_] := Erf[x/Sqrt[2400 De (t - t2) ]]) and Di is superfluous. I would try to use FindMinimum[] rather that NMinimize[] as a first try. Because this function finds local rather than global minima, it's much quicker. Depending on your data, this may be adequate. Next, I would try NMinimize from the local minimum. If that's not good enough, there are many options for NMinimize that given better answers than the default parameters. Start with Method -> {NelderMead, PostProcess -> KKT} There's a tutorial at tutorial/MonitoringAndSelectingAlgorithms that you should try after the one at tutorial/NumericalOptimization Regards, Dave.
- References:
- NMinimize
- From: Raj <rajanikanth@gmail.com>
- NMinimize