‘NMinimize’ finds wrong answer

A = 10;
a2 = 2.0;
h2 = 1.0;
b2 = 2.0;
d2 = 1850;
L2 = 0.05;
σ2 = 500;
c2 = Which[0 < d2*T <= 50, 7.5, 50 < d2*T <= 200, 5.5,200 < d2*T <= 400,0.5, 400 < d2*T <= 500, 2.5, 500 < d2*T, 1,True, 1]; NMinimize[{A/T + d2*T*c2 +h2*((d2*T)/2 + k*σ2*√(T + L2)) + b2/T*σ2*√(T + L2)*(PDF[NormalDistribution[0, 1], k] - k*(1 - CDF[NormalDistribution[0, 1], k])), 0 <= T <= 3, 0 <= k <= 4}, {T, k}, Method -> “DifferentialEvolution”]

(* {1023.18, {T -> 0.0292988, k -> 2.17944}} *)

NMinimize[{A/T + d2*T*c2 + h2*((d2*T)/2 + k*σ2*√(T + L2))
+ b2/T*σ2*√(T + L2)*(PDF[NormalDistribution[0, 1], k]
– k*(1 – CDF[NormalDistribution[0, 1], k])), 0 <= T <= 3, 0 <= k <= 4}, {T, k}] (* {1241.94, {T -> 0.27027, k -> 1.10251}} *)

I’ve always known NMinimize to find optimal values. However, in this case, NMinimize found a non-optimal answer, so I drew a plot instead.

How can I handle this? Do I have to use Method – > “DifferentialEvolution”?

=================

  

 

Perhaps have a read of the this tutorial reference.wolfram.com/language/tutorial/…
– blochwave
Jul 30 ’15 at 6:55

  

 

Also to quote this answer “A principle in successfully optimizing functions is to make them as smooth and convex as possible.”
– blochwave
Jul 30 ’15 at 7:07

5

 

It is well worth checking what is the default method NMinimize chooses. If not differential evolution, it is probably Nelder-Mead, which is not a good global optimizer (it is a direct search method, but it is really still limited to local minimization). Differential evolution, as you see, is quite powerful (at the expense of many function evaluations); probably the most powerful of all methods offered. But all of the methods provided by NMinimize are just heuristics; you have no guarantee of finding the true global minimum in general.
– Oleksandr R.
Jul 30 ’15 at 12:57

=================

1 Answer
1

=================

I get good result with v10.2 0n my Mac

$Version

“10.2.0 for Mac OS X x86 (64-bit) (July 7, 2015)”

A = 10;
a2 = 2;
h2 = 1;
b2 = 2;
d2 = 1850;
L2 = 5/100;
\[Sigma]2 = 500;
c2 = Which[0 < d2*T <= 50, 15/2, 50 < d2*T <= 200, 11/2, 200 < d2*T <= 400, 1/2, 400 < d2*T <= 500, 5/2, 500 < d2*T, 1, True, 1]; f[k_, T_] = A/T + d2*T*c2 + h2*((d2*T)/2 + k*\[Sigma]2*\[Sqrt](T + L2)) + b2/T*\[Sigma]2*\[Sqrt](T + L2)*(PDF[NormalDistribution[0, 1], k] - k*(1 - CDF[NormalDistribution[0, 1], k])); It seems unusual to me that the function mixes a PDF with a CDF. sol = NMinimize[{f[k, T], 0 <= T <= 3, 0 <= k <= 4}, {T, k}, Method -> #] & /@
{“DifferentialEvolution”, Automatic}

{{696.079, {T -> 0.108108, k -> 1.60671}}, {711.419, {T -> 0.108108,
k -> 1.90547}}}

sol = MinimalBy[sol, First][[1, -1]];

Show[
Plot3D[f[k, T], {T, 0, 0.5}, {k, 0, 4},
ClippingStyle -> None,
PlotPoints -> {201, 50},
PlotStyle -> Opacity[.8]],
Graphics3D[{
Red, AbsolutePointSize[6],
Point[{T, k, f[k, T]} /. sol]}]]

  

 

Thank you for your help!!
– user26674
Jul 30 ’15 at 14:34