Hi,

Im pretty new to GAMS, and I was wondering how to define a conditional

statement that works as follows.

For example, for

Sets i /i1*i4/*

j /j1j4/;

I want to set a conditional statement in an equation that states that

the value of i is adjacent to j,

or [ord(i) EQ ord(j) +1 and ord(i) EQ ord(j) -1], and any other values

of i would not be considered. May I know how i can go about doing

this?

Thank you very much for your time!

\

Hi,

I think you have to do it in this way:

Equation(i,j) $((ord(i) EQ (ord(j) +1)) OR (ord(i) EQ (ord(j) -1)))

You have to use OR instead of AND.

I hope this help

Good Luck!

Luis C

On 10 nov, 00:39, “wei_3...@hotmail.com” wrote:

Hi,

Im pretty new to GAMS, and I was wondering how to define a conditional

statement that works as follows.

For example, for

Sets i /i1*i4/*

j /j1j4/;

I want to set a conditional statement in an equation that states that

the value of i is adjacent to j,

or [ord(i) EQ ord(j) +1 and ord(i) EQ ord(j) -1], and any other values

of i would not be considered. May I know how i can go about doing

this?

Thank you very much for your time!

\