From: José Miguel Quesada Pérez [mailto:jmquesadap@gmail.com]
Sent: lunes, 07 de marzo de 2011 07:14 p.m.
To: ‘bartender_m@yahoo.com’
Subject: RE: Constraint Based on the Value of an Uncontrolled Variable {or The Curse of the Dreaded GAMS 149 Error}
Hi Charis
The message “Error 52 Endogenous $-control operations not allowed” happens due to your definition of the penalty equation.
As I wrote before, making the equation to depend on the variables makes the problem a non linear system. You are making the equation (penalty) depend on an “endogenous” variable (x). That’s why you get this message.
I think you could re-write your code for working correctly with MIP and solving your problem in the way you need of assigning a 0 cost if no marble is assigned to the pail, with a code like the following (I think equations Penalty2 and Penalty 3, with the changes on the OF will make the treak).
Hope this helps a little.
Best Regards
Jose
Variables
ChargeZero(c,p);
Binary Variable ChargeZero;
Equations
Penalty2
Penalty 3;
penalty(c,p)… sum(m,marblebag(m,c)*x(m,p)) =e= goal(c) + overgoal(c,p) - undergoal(c,p);
penalty2(c,p)… goal(c) -undergoal(c,p) + ChargeZero(c,p) =g=1; /This will force ChargeZero to be = 1 if no marble is assigned/
penalty3(c,p)… undergoal(c,p)-ChargeZero(c,p)*goal(c)=g=0 /This will force ChargeZero to be = 0 if undergoal<Goal
obj… totalpenalty =e= overgoal +
undergoal-sum((c,p),Goal(c)*ChargeZero(c,p)); /This will nullify the undergoal in case there is no marble assigned
MODEL sortmarbles /ALL/;
SOLVE sortmarbles using MIP minimizing totalpenalty;
\
To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.