Guys, how can i put a constraint with logical operator like:
const1.. (binaryvariable1= 1 and x(i)y(i)<0) or (binaryvariable1=0 and x(i)y(i)>)
I mean, i wish this constraint makes at least one of the conditions being satisfied.
Logical Syntax
Re: Logical Syntax
Paulo,
We don't use strict inequalities in optimization. Google strict inequality math programming for a wealth of reasons why, perspectives, examples, etc.
You could use a BigM method: given a binary variable y, use
xy <= M * y
yx <= M * (1y)
if M is large enough, the constraint xy<=0 is on when y = 0 and off otherwise.
yx <= 0 is off when y = 0 and on otherwise
Just make M as small as possible.
https://en.wikipedia.org/wiki/Big_M_method
There are other ways to do this also: indicator constraints, disjunctive programming. There is lots written about it in the GAMS docs.
Steve
We don't use strict inequalities in optimization. Google strict inequality math programming for a wealth of reasons why, perspectives, examples, etc.
You could use a BigM method: given a binary variable y, use
xy <= M * y
yx <= M * (1y)
if M is large enough, the constraint xy<=0 is on when y = 0 and off otherwise.
yx <= 0 is off when y = 0 and on otherwise
Just make M as small as possible.
https://en.wikipedia.org/wiki/Big_M_method
There are other ways to do this also: indicator constraints, disjunctive programming. There is lots written about it in the GAMS docs.
Steve

 User
 Posts: 3
 Joined: 1 week ago
Re: Logical Syntax
Thank you so much, its the first time using GAMS and working with this type of programming. I am doing my academic work and was at dead end.dirkse wrote: ↑1 week agoPaulo,
We don't use strict inequalities in optimization. Google strict inequality math programming for a wealth of reasons why, perspectives, examples, etc.
You could use a BigM method: given a binary variable y, use
xy <= M * y
yx <= M * (1y)
if M is large enough, the constraint xy<=0 is on when y = 0 and off otherwise.
yx <= 0 is off when y = 0 and on otherwise
Just make M as small as possible.
https://en.wikipedia.org/wiki/Big_M_method
There are other ways to do this also: indicator constraints, disjunctive programming. There is lots written about it in the GAMS docs.
Steve