Help in understanding optimization problems and solving them in Matlab (choise of appropriate solver)
Show older comments
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?
Accepted Answer
More Answers (0)
Categories
Find more on Solver Outputs and Iterative Display in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!