I'm trying to use mathematica to maximize an equation subject to constraints, and it isn't working. The Maximize
commmand just runs for hours without returning anything, and NMaximize
does return solutions, though they aren't maxima, and giving it different neighbourhoods of the arguments gives wildly different solutions. I'm unsure if it is the equation itself, my code, or my approach, or what, so I'd appreciate any advice.
$\max\limits_{\{s,x,t,y\}} \sqrt{s} + \sqrt{t} -xs-ty-\dfrac{50st}{1+x+y} \qquad \text{st.} \qquad \{t,s\} \in [0,10^6]^2\ \land\ x,y\geq0 $
NMaximize[{Sqrt[s] + Sqrt[t] - x s - y t - 50 s t/(1 + x + y), 1000000 >= s >= 0, 1000000 >= t >= 0, x >= 0, y >= 0}, {s, t, x, y}]
returned
{19.6578, {s -> 386.427, t -> 1.27273*10^-8, x -> 2.92059*10^-17, y -> 4427.66}}
That's obviously local, at best, since setting $s=10^6; x=y=t=0$ gives a functional value of $10^3$. I ran the following, hoping that by limiting the algorithm I might get different maxima:
Do[{Print[NMaximize[{Sqrt[s] + Sqrt[t] - x s - y t - 50 s t/(1 + x + y), 1000000 >= s >= 0, x >= 0, y >= 0, 0 <= t <= 1000000}, {{s, i 1000 - 1, i 1000}, t, x, y}]]}, {i, 1000}]
Running that loop gave me hundreds of maxima, with a peak functional value of 1000. They all seem to be similar, for example {1000.,{s->1.*10^6,t->1.25033*10^-9,x->1.89242*10^-17,y->7070.2}}
, with values of $t,x$ being approximately zero.
What is happening? Is mathematica rounding its computations, and is that why it returns so many different maxima? I get lots of messages like NMaximize::cvmit: Failed to converge to the requested accuracy or precision within 100 iterations.
. Why doesn't the Maximize
command return anything? Would increasing working precision help? Am I approaching this wrong? Theoretically there must exist a maximum over the domain I've specified, I've even limited $x,y$ to the same interval to no avail. Is there any other way to go about this?