[Date Index]
[Thread Index]
[Author Index]
NMinimize Strange Results
*To*: mathgroup at smc.vnet.net
*Subject*: [mg55502] NMinimize Strange Results
*From*: "Marcelo Mayall" <mmayall at bol.com.br>
*Date*: Sat, 26 Mar 2005 02:39:40 -0500 (EST)
*Sender*: owner-wri-mathgroup at wolfram.com
NMinimize Strange Results:
It's always interesting to reduce the amount of times that a certain
function needs to be executed along an optimization process.
However, after doing some optimization tests, I observed that small changes
in the input parameters syntax of the NMinimize function took to a
substantial increase of the processing time and until then, I still
didn't understand perfectly what is happening.
My impression is that in some occasions although defining the option
"PostProcess" as False, internally the function NMinimize continues
doing local optimizations ("PostProcess" -> True). And in some cases
with restrictions, the impression that I had is that the function
NMinimize executes 2 times the objective function to find the value
of the penalty ("PenaltyFunction"), reducing so the performance of the code.
Below, I put some simple cases that exemplify such situations.
Does anybody have any idea of what is going on?
___________________________________________________
The function f[x] below is defined in such a way that the counter "i"
counts how many times f[x] was executed. And the counter "j" counts
how many times the NMinimize EvaluationMonitor indicates that it
executed the function f[x]. If we consider the simple case of minimization
by a genetic algorithm without pos-processing:
in[1]:= f[x_?NumericQ]:=(i++;x^2)
in[2]:= i=0;j=0;
NMinimize[ f[x] , x ,
Method->{"DifferentialEvolution","PostProcess"->False},EvaluationMonitor:>j++];
Print[i, " ", j];
out[2]:= 511 511
Correctly it's observed that, as for the counter "i" as for the counter
"j", the function f[x] was called 511 times. However, introducing a simple
restriction a strange result is verified:
in[3]:= i=0;j=0;
NMinimize[{ f[x] , x > -1000 }, x ,
Method->{"DifferentialEvolution","PostProcess"->False},EvaluationMonitor:>j++]
Print[i, " ", j];
out[3]:= 1752 511
Similarly, introducing "f[{x}]":
in[4]:= Remove[f]
f[{x_?NumericQ}] := (i++; x^2)
i=0;j=0;
NMinimize[ f[{x}] , x ,
Method->{"DifferentialEvolution","PostProcess"->False},EvaluationMonitor:>j++];
Print[i, " ", j];
out[4]:= 1022 511
In other words, while the function NMinimize indicates that f[x] was
executed only 511 times the counter "i" indicates that the function f[x]
was executed a lot more (1752 and 1022 times).
Any Ideas?
Prev by Date:
**Re: MD5 Brain teaser**
Next by Date:
**Re: Hypergeometric integral looks wrong ?**
Previous by thread:
**Re: solve question/simplify question**
Next by thread:
**Questions about Abs[_]**
| |