Message Boards Message Boards

0
|
4223 Views
|
3 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Solve a Kuhn-Tucker problem symbolically in a short time?

Posted 5 years ago

Hi - I am trying to solve a Kuhn-Tucker constrained optimization problem. I have both tried using the built-in package below and using Solve with the various equality and inequality constraints directly. In both cases I let it run for two days and it would not solve. I'm wondering if there is a more efficient way to do this that anyone is aware of? Perhaps first finding all solutions with the equality conditions then keeping solutions that satisfy the inequality and parameter constraints? Below is my code. Any help would be much appreciated!

kkt[obj_, cons_, vars_, paramcons_:True] := 
  Module[{stdcons, eqcons, ineqcons, lambdas, mus, eqs1, eqs2, eqs3}, 
   stdcons = cons /. {(x_) >= (y_) -> y - x <= 0, (x_) > (y_) -> y - x > 0, 
       (x_) == (y_) -> x - y == 0, (x_) <= (y_) -> x - y <= 0}; 
    eqcons = Cases[stdcons, (x_) == 0 -> x]; 
    ineqcons = Cases[stdcons, (x_) <= 0 -> x]; 
    lambdas = Array[?, Length[ineqcons]]; mus = Array[?, Length[eqcons]]; 
    eqs1 = D[obj + mus . eqcons - lambdas . ineqcons == 0, {vars}]; 
    eqs2 = Thread[lambdas >= 0]; eqs3 = Table[lambdas[[i]]*ineqcons[[i]] == 0, 
      {i, Length[ineqcons]}]; Assuming[paramcons, 
     Refine[Reduce[Join[eqs1, eqs2, eqs3, cons], Join[vars, lambdas, mus], Reals, 
       Backsubstitution -> True]]]]


kkt[?*(i*R - Subscript[d, r] - Subscript[d, 2]) + 
   (1 - ?)*?*((i - Subscript[d, 1]/(?*?*R))*R - Subscript[d, 2]), 
  {i - ?*(Subscript[d, r] + Subscript[d, 2]) - 
     (1 - ?)*(Subscript[d, 1] + ?*Subscript[d, 2]) <= 0, 
   ?*(Subscript[d, r] + Subscript[d, 2] - i) - c - 
     (1 - ?)*(Subscript[d, 1] + ?*Subscript[d, 2]) + i - 
     ?*(Subscript[d, r] + Subscript[d, 2]) <= 0, 
   Subscript[d, 1] - Subscript[d, r] >= 0, ?*Subscript[d, r] - Subscript[d, 1] <= 
    0, i - 1 <= 0}, {Subscript[d, r], Subscript[d, 2], Subscript[d, 1], i}, 
  {? > 0, ? < 1, ? > 0, ? < 1, R > 1, ?*R + ?*(1 - ?)*R > 1, 
   (1 - ?*R)*(1 - ?) < c, ?*(1/((1 - ?)*? + ?) - 1) > c, ?*R < 1, ? < 1, 
   ? > 0}]
POSTED BY: Greg White
3 Replies

Maybe you can start with this demonstration example.

POSTED BY: Shenghui Yang
Posted 5 years ago

Thank you - I do understand the logic it just seems it takes forever when you add parametric restrictions which is a bit surprising to me.

POSTED BY: Greg White

Greg,

@Frank Kampas posted this nice discussion a while back.

Regards,

Neil

POSTED BY: Neil Singer
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract