small number safely considered as zero

Problems with modeling
Post Reply
Nikou
User
User
Posts: 33
Joined: 4 years ago

small number safely considered as zero

Post by Nikou »

I would like to model the following logic
IF X = 0 THEN Y = 1
IF X > 0 THEN Y => 0

X is declared to be positive variable
Y is declared to be binary

I model this in GAMS as follows:

Y =g= 1 - X * BigNumber ;

So,
If X = 0 then Y => 1 and because Y is binary Y=1
If X => 1/BigNumber then Y => 0

My question is, how big should BigNumber be in order not to get into trouble?
Fred
Posts: 372
Joined: 7 years ago

Re: small number safely considered as zero

Post by Fred »

Hi,

In Math Programming, strict inequalities (as in your condition X>0) make no sense. For more details see: https://support.gams.com/gams:formulate ... _condition
Apart from that, I don't see how your single =g= constraint should force y=0 if x>0.

Once you know "how much" greater than zero (e.g. X>=1e-6) X should be to imply Y=0, you can use the reformulation described here: https://support.gams.com/gams:formulate ... s[]=strict

If you know bounds for X, you can usually derive how big your bigNumber (frequently referred to as bigM) has to be.

I hope this helps!

Best,
Fred
Post Reply