Group Abstract Group Abstract

Message Boards Message Boards

5
|
12.8K Views
|
5 Replies
|
5 Total Likes
View groups...
Share
Share this post:

Solve the Karush-Kuhn-Tucker equations with Reduce

POSTED BY: Frank Kampas
5 Replies

Frank,

You should consider putting this code up in the new Wolfram function repository! It's a great post!

Regards,

Neil

POSTED BY: Neil Singer

I believe that the complexity of Reduce is double exponential. In other words, the time required to do a calculation increases very rapdily with the number of variables and constraints.

POSTED BY: Frank Kampas

Thanks again. I'll try to run it in a more powerful machine. Happy New Year!

Patricio

POSTED BY: Patricio García

Hi

Thanks so much for the code. I've tried on a trivial example and it's very fast. However, when I used it in a more demanding setting, had to abort it since it wouldn't return any result after over an hour running. I'm copying my problem below and I was hoping you cold tell me whether it is the nature of my problem or that I'm mistaken in the use of the code what is causing such a long execution time.

Thanks again

Patricio

T = {{2, 3, 1}, {3, 2, 1}, {1, 4, 2}, {4, 1, 3}};
techniques = Dimensions[T][[1]];
?Vec = ConstantArray[4/6, techniques];
qVec = Array[q, techniques];
onesVec = ConstantArray[1, techniques];
needs = Transpose[T].qVec^(1/?Vec);
FactorNeeds[mix_] := Transpose[T].mix^(1/?Vec);

qcritical = Table[qVec /.
 Minimize[{needs[[j]], onesVec.qVec == 1, Thread[1 >= qVec >= 0]}, 
      qVec, Reals][[2]], {j, 1, factors}];

cons = Join[
  Thread[needs <= FactorNeeds[Transpose[qcritical].{0, 1, 0}]], 
  Thread[qVec >= 0]]

KKTReduce[-qVec.onesVec,cons,qVec]
POSTED BY: Patricio García
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard