Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1995
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1995

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

Search the Archive

Optimizing FindMinimum for speed using intermediate calculations.

  • To: mathgroup at christensen.cybernetics.net
  • Subject: [mg1175] Optimizing FindMinimum for speed using intermediate calculations.
  • From: Bill Harbaugh <harbaugh at students.wisc.edu>
  • Date: Sat, 20 May 1995 04:23:30 -0400
  • Organization: University of Wisconsin, Madison

Hello

I am trying to maximize a likelihood function, using FindMinimum.  This 
involves finding the parameters (x,y in my simplified example) that max 
(min, in my example) the sum of the values of a function applied to some 
data (ddist, in my example).  

My actual problem is very long and my question is about how to optimize 
my mma code for speed.

This function involves some intermediate results (x1,y1 in my example) 
which vary across the x,y parameters but are constant across the d's.  
(In my actual problem, these intermediate results are found using NSolve, 
so I am specifying the functions using := rather than =). I am trying to 
only calculate these once for each iteration on x,y, and then apply the 
results to each of the d's in the list ddist.  The code below shows how I 
do this without trying to optimize.


ddist={1,2,3,4,5,6,7,8,9,10}
x1:=x+1
y1:=y+2
l[d_]:=(x1*d)^2+(y1*d)^2

f=Apply[Plus,
    Map[l,ddist]
  ]

FindMinimum[f,{x,{-1,1}},{y,{-1,1}}]




This works, but it seems the following should be faster.

Clear[l];
Clear[f];
l[d_]:=(x1*d)^2+(y1*d)^2

f={x1=x+1,y1=y+2,Apply[Plus,
    Map[l,ddist]
  ]}

FindMinimum[f[[3]],{x,{-1,1}},{y,{-1,1}}]

This also works, but timing results are inconclusive. I would appreciate 
suggestions on any other approaches that might speed this up.  I am also 
asking mma support for help, and will forward their reply.

Bill Harbaugh
harbaugh at students.wisc.edu



  • Prev by Date: triangular phase diagram
  • Next by Date: BUGGY Graphics
  • Previous by thread: Re: triangular phase diagram
  • Next by thread: Re: Optimizing FindMinimum for speed using intermediate calculations.