Conditional Statment

Dear All,

Kindly I would like to know how to write the below conditional statement in GAMS
image.png
Is just make yij and vi binary variables?

Thanks in advance

No. You also have to link binary variables with x.

I assume arc (i, j) is used means that x(i, j) > 0
similarly node i is used means either x(i, j) or x(j, i) is nonzero for all j that connect to node i.

You can do this using a big-M formulation.

  • Atharv

Dear Atharv,

Thanks a lot for your suggestion

I used the big M method as you told me, would you please confirm to me if I’m writing it correctly?
<
Scaler bigM /1000/;

Binary Variable
y(i,j)
v(i);

Equations
VBinC1 “1, if node i is used”
VBinC2 “0, Otherwise” ;

VBinC1(i,j)… x(i,j) =l= bigMv(i);
VBinC2(i,j)… x(i,j) =g= 1e-6 - bigM
(1-v(i));>
image.png