Optimization in Mathmatica
- To: mathgroup at smc.vnet.net
- Subject: [mg84966] Optimization in Mathmatica
- From: "Ludsteck Johannes" <Johannes.Ludsteck at iab.de>
- Date: Mon, 21 Jan 2008 06:54:12 -0500 (EST)
Dear MathGroup Members,
I want to minimize a function of about 20-30 variables using FindMinimum
and NMinimize.
The objective is a statistical function, i.e. a sum of several thousand
data points.
If the number of Data points exceeds 30000, Mathematica shuts down and
tells me that nout enough memory is available.
My computer has, however, about 2GB available which should suffice for a
problem of this dimension. After some experimentation
I found that the shut down can be avoided by providing two starting
values. Then Mathematica uses the Brent algorithm
which works without derivatives. A further working solution is Nminimize
with option Method->{NelderMead, PostProcess->"KKT"}.
Both strategies are, however, extremely inefficient. I assume that
Mathematica shuts down with other options since it tries to
compute gradients and hessians symbolically. These objects may be huge.
Question: How can I urge Mathematica to do the minimization without
symbolic computations. I searched the documentation but
didn't find detailed information on memory usage in FindMinimum and
Nminimize
Thank you and best regads,
Johannes Ludsteck
Probably that is not important for you. Nevertheless, here are parts of
my code:
chi[u_,v_,d_]:=Which[
d<=-v,u^2-2 u (v+d),
-v<d<u,(u-v-d)^2,
True,v^2+2 v (d-u)];
SetAttributes[chi,Listable];
chiSumPair[y1_,y2_,dx_,b_]:=Total[chi[y1,y2,dx.b]];
chiSumTotal[y1_,y2_,dx_,bx_,bd_]:=
Total[MapThread[
chiSumPair[#2,#1,Map[Append[#,-1]&,-#3],Append[bx,#4]]&,
{y2,y1,dx,bd}]];
...
sol=Last[FindMinimum[chiSumTotal[y1,y2,dx,bx,bd],
Evaluate[Sequence@@start],
MaxIterations->500,Method->"QuasiNewton"]];