Logical constraint

Problems with modeling
Post Reply
Posts: 9
Joined: 1 year ago

Logical constraint

Post by abb.omidi » 6 months ago

Hello everybody
I have a question about coding logical constraint in the GAMS IDE.
Please, let me describe optimization model:
set i /1*2/;
parameter cost(i);
integer variable nb(i);
of.. obj =e= sum(i,cost(i)*nb(i))+(x-1)*500;
con1.. sum(i,nb(i)*ns(i)) =g= N;
There is a logical constraint in the form below:
if(nb(i)<>0) then:
integer variable x;
x = sum(i,nb(i)); "x= sum of number of active variables, nb(1) & nb(2)"
logical constraint means that:
if nb(1)<>0 (and / or) nb(2)<>0 then:
x=0 or1 or 2; "that is sum of active variables not quantity of variables".

Please, let me know, how can I define such a logical constraint?
Best regards
Omidi. A

Post Reply