Help in understanding optimization problems and solving them in Matlab (choise of appropriate solver)

조회 수: 1 (최근 30일)
Hello
Maybe a classical phrase: I have been trying to understand this since several days but not succeed - really about me!
Lets take a simple constrained optimization problem from here maximazing revenu with bubget constraints. So the problem is
We can solve it in Matlab with fmincon
objective = @(x) -200*x(1)^(2/3)*x(2)^(1/3);
[X,FVAL,EXITFLAG,OUTPUT,LAMBDA,GRAD,HESSIAN] = fmincon(objective,[1,1],[],[],[20, 170],20000,[],[],[])
>> X =
666.6669 39.2157
LAMBDA =
struct with fields:
eqlin: 2.5927
OR we can use Lagrangian cost function and rewrite these to unconstrained optimization problem (Am I right at this stage?)
Then solving this objective function with fminsearch or fminunc (even tried with ga)
lambda = 2.5927;
>> objective = @(x) -200*x(1)^(2/3)*x(2)^(1/3)-lambda*(20*x(1) + 170*x(2) - 20000);
x = fminuncfminunc(objective,[1, 1])
>> Problem appears unbounded.
fminunc stopped because the objective function value is less than
or equal to the value of the objective function limit.
<stopping criteria details>
x =
1.0e+19 *
0.2504 6.4423
>> x = fminsearch(objective,[1, 1])
Exiting: Maximum number of function evaluations has been exceeded
- increase MaxFunEvals option.
Current function value: -51855.290146
x =
0.1088 1.7458
gives different results and even not close to constrained solution with fmincon. I tried to change the sign, put lambda = 1....
So why its like this, where I am wrong or I dont understand something?

채택된 답변

Matt J
Matt J 2019년 5월 17일
편집: Matt J 2019년 5월 17일
You have to reformulate the problem with a convex objective to be certain that the Lagrangian minimization will behave as you're expecting (see Sufficient Conditions for Strong Duality). You can do this as follows:
objective = @(x) -2/3*log(x(1))-1/3*log(x(2));
[Xcon,FVAL,EXITFLAG,OUTPUT,LAMBDA,GRAD,HESSIAN] = fmincon(objective,[1,1],[],[],[20, 170],20000,[],[],[])
objectiveUC = @(x) -2/3*log(x(1))-1/3*log(x(2))+LAMBDA.eqlin*(20*x(1) + 170*x(2) - 20000);
Xunc = fminunc(objectiveUC,[1, 1])
This leads to
Xcon =
666.6664 39.2157
Xunc =
666.6533 39.2154
  댓글 수: 3
Yurii Iotov
Yurii Iotov 2019년 5월 20일
And Matt, please, what I dont understand also is why with these 3 different objective functions
"original"
objective_1 = @(x) -200*x(1)^(2/3)*x(2)^(1/3);
you showed me
objective_2 = @(x) -2/3*log(x(1))-1/3*log(x(2));
and with 200 term
objective = @(x) (-2/3*log(x(1))-1/3*log(x(2)))*200;
with constrained optimization:
[Xcon,FVAL,EXITFLAG,OUTPUT,LAMBDA,GRAD,HESSIAN] = fmincon(objective,[1,1],[],[],[20, 170],20000,[],[],[])
...Gives the same solution for Xcon, but others are differ, especially LAMBDA in wich I am also interested for results interpretation?
it blows my brain a little bit!
Is it because objective_1 and objective_2 have duality property?
And term 200 in objective is just a csaling factor?
...I feel I have some gaps in math...
Matt J
Matt J 2019년 5월 20일
All 3 objectives differ by monotonic transformations, e.g.,
objective_2=-log(-objective_1/200)
is a monotonic function of objective_1. Therefore if one increases or decreases, so does the other, and they therefore have minima at the same locations.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Solver Outputs and Iterative Display에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by