Mathematica Asked by user74840 on March 29, 2021
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}]
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];
MatrixForm[res0]
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]]};
MatrixForm[res1]
NOTE
From the results obtained we can observe that the extrema are always at the boundary.
Answered by Cesareo on March 29, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP