Hi, hola and Hallo!
I have to optimize some contrained functions and I am trying to use NMaximize.
I have the following problem (see code below). I use NMaximize for the first function f1 (constraints c1 and variables with start intervals vs1) and get what I want to get. After that I use NMaximize for the function f2 (with c2 and vs2). After this second numerical optimization I run again the very same optimization for f1 again and get a different result although I have not changed the start intervals.
Could you please explain this? The only way I have found to solve this, is to restart everything with Quit[] but maybe you know a easier way to restart only the command NMaximize. I have also tried to set the Method for all optimizations but it does not make any difference, the results still vary.
Thank you very much, muchas gracias, Dankeschön!
f1 = 1445250/(13229 - 4223 Sqrt[30] (v1 + v2));
c1 = Sqrt[30] + 30 v1 >= 0 && Sqrt[30] + 30 v2 >= 0 &&
Sqrt[30] + 30 v3 >= 0 &&
2 + 45 v2 v3 + 45 v1 (v2 + v3) >= 2 Sqrt[30] (v1 + v2 + v3) &&
v1 + v2 + v3 <= Sqrt[(2/15)];
vs1 = {{v1, 0, 0.01}, {v2, 0, 0.01}, {v3, 0, 0.01}};
f2 = 1445250/(13229 - 8446 Sqrt[30] v1);
c2 = 45 v1 <= Sqrt[30] && Sqrt[30] + 30 v1 >= 0;
vs2 = {{v1, 0, 0.01}};
NMaximize[{f1, c1}, vs1]
NMaximize[{f2, c2}, vs2]
NMaximize[{f1, c1}, vs1]
Out[8]= {190.206, {v1 -> 0.121716, v2 -> 0.121716, v3 -> -0.0111781}}
Out[9]= {190.206, {v1 -> 0.121716}}
During evaluation of In[1]:= NMaximize::cvmit: Failed to converge to the requested accuracy or precision within 100 iterations. >>
Out[10]= {190.253, {v1 -> 0.121759, v2 -> 0.121754, v3 -> -0.0111782}}
I also tried
SeedRandom[0]
NMaximize[{f1, c1}, vs1]
SeedRandom[0]
NMaximize[{f2, c2}, vs2]
SeedRandom[0]
NMaximize[{f1, c1}, vs1]
and
BlockRandom[NMaximize[{f1, c1}, vs1]]
BlockRandom[NMaximize[{f2, c2}, vs2]]
BlockRandom[NMaximize[{f1, c1}, vs1]]
but sadly with NO improvement