Re: simple two step optimization
- To: mathgroup at smc.vnet.net
- Subject: [mg36945] Re: simple two step optimization
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Thu, 3 Oct 2002 00:16:19 -0400 (EDT)
- Organization: Universitaet Leipzig
- References: <ane7nt$kan$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
- Sender: owner-wri-mathgroup at wolfram.com
Hi, you guess right and if you hinder Mathematica to evaluate opt[] for symbolic arguments, with opt[s_?NumericQ] := Block[{x}, x /. Last[FindMinimum[x - 2.5(1 + Erf[x - s]), {x, 1, 3}]]] NMinimize[] works as expected. Regards Jens Johannes Ludsteck wrote: > > Dear MathGroup Members, > > I want to minimize a function which returns the > minimizing value (arg min) of another function. > > For a simple example consider the following > function opt which returns the arg min of x-2.5(1+Erf[x-s]). > > opt[s_]:=Block[{x}, x/. Last[ > FindMinimum[x-2.5(1+Erf[x-s]), {x,1,3}]]] > > Now in a second step I want (again this is only > a simple example for illustrative purposes) to minimize > (opt[s]-2)^2 with respect to s. > > FindMininum has no problems with this. > > FindMinimum[(opt[s]-2)^2,{s,0.9,1.1}] > {3.18689*^-23, {s -> 0.9816}}\) > > However, NMinimize surrenders(!!!). Typing > > <<NumericalMath`NMinimize` > NMinimize[(opt[s]-2)^2,{s,0.9,1.1}] > only leads to the error message > > FindMinimum::fmnum: Objective function > 0.1 - 2.5 (1. +Erf[0.1 - 1. s]) is not real at {x} = {1.}. > > There is nothing wrong with minimand. It has exactly > one minimum in the Interval[{0.9,1.1}]. > > I guess the reason is that NMinimize calls opt[s] > not with a numerical value for s. This causes the > problem, since opt again calls FindMinimum. > Why? Can someone explain the failure and tell me > how to avoid this drawback? Wolfram Research boasts > that NMinimize can handle any function... > > I hope that nobody will recommend me to use FindMinimum > here instead. I know that the example here could of > course be solved by FindMinimum, but my real world > application can not. > > Best regards and thanks in advance, > Johannes Ludsteck > > <><><><><><><><><><><><> > Johannes Ludsteck > Economics Department > University of Regensburg > Universitaetsstrasse 31 > 93053 Regensburg > Phone +49/0941/943-2741