Re: FindMinimum of a compiled function??
- To: mathgroup at smc.vnet.net
- Subject: [mg23670] Re: [mg23646] FindMinimum of a compiled function??
- From: Adalbert Hanssen <hanssen at Zeiss.de>
- Date: Mon, 29 May 2000 12:24:00 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Hi, Wijnand This is probably only a partial answer, but probably a good starting point for investigations on Compilability: Alan Hayes once told me the following solution (see [mg20863]) FunctionalFindMinimum[f_, start_List] := (# /. Last[ FindMinimum[f[#], Evaluate[Sequence @@ (Transpose[{#, start}])]]]) &[ Unique[x] & /@ start] f[{x_, y_}] := (x - 1)^2 + (y - 2)^2; FunctionalFindMinimum[f, {2, 0}] {1., 2.} regards Adalbert Wijnand.Schepens at rug.ac.be am 29.05.2000 06:42:00 An: mathgroup at smc.vnet.net@EMAIL Kopie: (Blindkopie: Adalbert Hanssen/Aalen/Zeiss/DE) Thema: [mg23646] FindMinimum of a compiled function?? Hi everybody I want to minimize a function of many variables a number of times, starting from different initial values each time. There doesn't seem to be a way to pass a compiled function to FindMinimum, because you have to give explicit names to the arguments. I know that FindMinimum tries to compile the function. The problem is that I repeat this procedure a lot of times, and I don't want FindMinimum to do all the compiling-work every time over and over. Does FindMinimum remember the compiled version of a function for subsequent minimization? I would think it is more efficient to compile the function once (possibly the derivatives too), and pass this compiled version to FindMinimum... But I fear this is impossible... No? It's a shame that there isn't a version of FindMinimum which takes a function working on a list of real numbers (or a matrix, like in Compile). This is a VERY common thing to do in global minimization (of continuous functions), molecular modeling, and all sorts of simulations. Mathematica's routines isn't fast enough to be competitive with classical procedural languages. Especially since so much attention has been paid to speed up Mathematica vector-routines by packed-array technology, I find it strange that there is no adapted FindMinimum. Can onyone explain me why? Is something of the sort planned for future versions? In my ideal Mathematica-world there would be a function like Minimize: fc=Compile[{x,_Real,1}, ...some function of the x[[i]]... ]; xlist=Table[Random[],10]; fc[xlist] returns real number Minimize[fc, xlist] or Minimize[ {x,_Real,1}, fc, xlist ] or variants including (compiled) gradient Minimize would return {minvalue, xlist} where xlist contains the coordinated at the minimum Is this impossible?? Wijnand Schepens p.s. do Mathematica-developers pay attention to this mailing-list? Maybe they only look at the titles and sigh..