1

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 maximizing revenue with budget constraints. So the problem is

enter image description here

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?)

enter image description here

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?

thanks in advance!

Yurii
  • 13
  • 4
  • As the output clearly tells you, your last calls did not reach the solution, but finished because of other reasons. The results are no trustable – Ander Biguri May 17 '19 at 15:28
  • 1
    I'm voting to close this question as off-topic because it is not about programming. – High Performance Mark May 17 '19 at 15:46
  • Well its really related with Matlab and its syntax so neither I am using Matlab functions in a wrong way either I am wrong in my expectations, which are, yes , related to math theory – Yurii May 17 '19 at 15:54

0 Answers0