How to Solve systems of equations for optimization

62 Views Asked by At

So I am trying to find the local extremizers for $ x_{1}^{2}+x_{2}^{2}-2 x_{1}-10 x_{2}+26 \text { subject to } \frac{1}{5} x_{2}-x_{1}^{2} \leq 0,5 x_{1}+\frac{1}{2} x_{2} \leq 5$

Attempt:

By writing the KKT conditions, we have \begin{aligned} 2 x_{1}-2-2 \mu_{1} x_{1}+5 \mu_{2} &=0 \\ 2 x_{2}-10+\frac{1}{5} \mu_{1}+\frac{1}{2} \mu_{2} &=0 \\ \mu_{1}\left(\frac{1}{5} x_{2}-x_{1}^{2}\right)+\mu_{2}\left(5 x_{1}+\frac{1}{2} x_{2}-5\right) &=0 \\ \mu & \geq 0 \end{aligned}

Then we need to check the cases where $(1) \mu_1 = 0,\mu_2=0$, $(2) \mu_1 > 0,\mu_2=0$, $(3) \mu_1 = 0,\mu_2>0$, $(4) \mu_1 > 0,\mu_2>0$

Case 1: $\left(\mu_{1}=0, \mu_{2}=0\right)$ Solving the first and second Karush-Kuhn-Tucker equations yields $\boldsymbol{x}^{(1)}=[1,5]^{\top}$ However, this point is not feasible and is therefore not a candidate minimizer.

Case 2: $\left(\mu_{1}>0, \mu_{2}=0\right)$ We have two possible solutions: $$ \begin{array}{cl} \boldsymbol{x}^{(2)}=[-0.98,4.8]^{\top} & \mu_{1}^{(2)}=2.02 \\ \boldsymbol{x}^{(3)}=[-0.02,0]^{\top} & \mu_{1}^{(3)}=50 . \end{array} $$ Both $\boldsymbol{x}^{(2)}$ and $\boldsymbol{x}^{(3)}$ satisfy the constraints, and are therefore candidate minimizers.

Case 3: $\left(\mu_{1}=0, \mu_{2}>0\right)$ Solving the corresponding equation yields: $$ \boldsymbol{x}^{(4)}=[0.5050,4.9505]^{\top} \quad \mu_{1}^{(4)}=0.198 . $$ The point $\boldsymbol{x}^{(4)}$ is not feasible, and hence is not a candidate minimizer.

For case 4, $\mu_1 > 0,\mu_2>0$, Supposely the answer is \begin{aligned} \boldsymbol{x}^{(5)}=[0.732,2.679]^{\top} & \boldsymbol{\mu}^{(5)} &=[13.246,3.986]^{\top} \\ \boldsymbol{x}^{(6)}=[-2.73,37.32]^{\top} & \boldsymbol{\mu}^{(6)} &=[188.8,-204]^{\top} . \end{aligned} but I am getting 5 different answers with the matlab code while there should be only two different answers for this case(shown above). The Matlab code result is consistence with the answer in case (1,2,3). I don't think I am missing any constraints. What am I doing wrong for this case 4??

syms x y z k %%x is x1, y is x2, z is mu_1, k is mu_2
eqn1 = 2*x-2-2*x*z+5*k==0;
eqn2 = 2*y+(1/5)*z+0.5*k-10==0;
eqn3 = (1/5)*y*z-z*(x^2)+5*x*k+0.5*k*y-5*k==0;
eqn4 = z > 0;
eqn5 = k > 0;
eqs = [eqn1 eqn2 eqn3 eqn4 eqn5];
S = solve(eqs, [x y z k]);
disp(double(S.x))
disp(double(S.y))
disp(double(S.z))
disp(double(S.k))

Output:

x
    3.0666
    0.0366
         0
         0
         0
y
    4.6011
    0.5472
    4.8000
    4.7913
    0.2087
z
    1.4891
   42.0277
    1.0000
    1.0871
   46.9129
k
    1.0000
    1.0000
    0.4000
    0.4000
    0.4000
1

There are 1 best solutions below

0
On

Problem is that I don't have enough constraints so its not giving the right solution:

By the properties of KKT multipliers

  • if $g_{j}\left(\boldsymbol{x}^{*}\right)<0$ (inactive), then $\mu_{j}^{*}=0$
  • if $\mu_{j}^{*}>0$, the $g_{j}\left(\boldsymbol{x}^{*}\right)=0$ (active)
  • possible: $\mu_{j}^{*}=0$ and $g_{j}\left(x^{*}\right)=0$
  • impossible: $\mu_{j}^{*}>0$ and $g_{j}\left(x^{*}\right)<0$.

By the above, this generates two more extra constraints, given by

eqn6 = (1/5)*y - x^2 == 0;
eqn7 = 5*x + 0.5*y - 5 == 0;
eqs = [eqn1 eqn2 eqn3 eqn4 eqn5,eqn6,eqn7];

this gives the desired answer:

    0.7321

    2.6795

   13.2428

    3.9849