I'm relatively new to solving optimization problems using Mathematica. I have an optimization problem but Mathematica does not seem to be able to solve it. I have tried all sorts of way to re-write it equivalently. The one mentioned in this question seems to be the simplest form of all that I was able to find.

Are there any tricks that can be used to solve this problem?

Minimize[{(c n2)/m2^2+m2/n2,1 < n2 <= n, 1 < m2 <= m}, {n2,m2}]
  • $\begingroup$ If $c>0$, then the estimate from below is $2\sqrt{\frac {c\,n2} {m2^2}\frac {m2} {n2}}\ge 2\sqrt {\frac c {m}}.$ $\endgroup$
    – user64494
    Sep 25 '20 at 12:12
  • 1
    $\begingroup$ Are you sure that a minimum exists inside your region? Is it possible that the minimum is always on the boundary. Try to give numerical values to c,n,m and make a 3D plot using e.g. Plot3D, to get a feeling what is happening. $\endgroup$ Sep 25 '20 at 15:08

You can solve it using the Lagrange multipliers, introducing some slack variables (e1,e2,e3,e4) to handle the inequalities, assuming first to simplify c > 0,(c^2) as follows:

f = c^2 x/y^2 + y/x;
L = f + l1 (x - 1 - e1^2) + l2 (n - x - e2^2) + l3 (y - 1 - e3^2) + l4 (m - y - e4^2)
grad = Grad[L, {x, y, l1, l2, l3, l4, e1, e2, e3, e4}];
sols = Solve[grad == 0, {x, y, l1, l2, l3, l4, e1, e2, e3, e4}];
res = {f, x, y, l1, l2, l3, l4, e1^2, e2^2, e3^2, e4^2} /. sols;
res0 = Union[res];

Now in res0 we have the f values at the diverse stationary points as well as the values for e1^2,e2^2,e3^2,e4^2 that should be non negative to be feasible. Here when ek = 0 means that the k constraint is active. We can proceed in the same way in the case of -c^2.

We can further reduce this set to

res1 = {res0[[2]], res0[[5]], res0[[6]], res0[[8]], res0[[9]], res0[[11]], res0[[13]], res0[[14]]};


From the results obtained we can observe that the extrema are always at the boundary.

  • $\begingroup$ Cesareo: +1. The verification of the case c=1;m=2;n=3; confirms your result. However, it is difficult to find out the optimal values from res0. Maybe, the evaluation of the parameters and then the direct use of Minimize are more convenient. $\endgroup$
    – user64494
    Sep 28 '20 at 15:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.