From octave-sources-request at bevo dot che dot wisc dot edu Tue Aug 7 05:11:47 2001 Subject: Re: Optimization: Replace NaN by Inf From: Jeremy DENISE To: Gabriel Arcos CC: etienne at isr dot ist dot utl dot pt, octave-sources@bevo.che.wisc.edu Date: Tue, 07 Aug 2001 12:11:37 +0200 Gabriel Arcos wrote: > > Suppose you have the problem max F(x), and suppose F(x) have derivative > DF(x). Now, suppose DF(x) can be expressed as DF(x)=P(x)/Q(x). Suppose F > have his maximun at x=x0, so DF(x0) vanish. > ----- Original Message ----- > From: Etienne Grossmann > To: ; > Cc: ; > Sent: Monday, August 06, 2001 1:14 PM > Subject: Optimization: Replace NaN by Inf > > > > > Hello, > > > > when optimizing a function 'f', I am tempted to replace any NaNs > > that it returns by Infs. This way, the returned value can be compared > > w/ other values, and the optimization algorithm is happy. > > > > Can anyone think of a reason not to replace NaNs by Infs inside an > > optimization algorithm? > > > > If not, I'll have my various optimization functions do the > > replacement. > > > > Etienne Hi, Well, I think something has to be cleared: this replacement would only have to take place in the Nelder-Mead algorithm, where only the _values_ of the function to be minimized are used, not the first nor second derivatives. This kind of trick is often used to solve a constrained problem with algorithms primarily designed for unconstrained ones. J