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}]