Error for constraint of sets

Dear All,

I have a problem to write syntax of this simple formula “n not equal m” in equation section. This n, m are sets with n = {1,2,3} and m = {1,2,3,4}. I try to solve this problem by using this syntax to represent that n is not equal to m

notequalm(m) … m - n =g= abs(1);

However, I get these error warnings :

108 notequalm(m) … m - n =g= abs(1);
**** $148 $148,653

148 Dimension different - The symbol is referenced with more/less
indices as declared
257 Solve statement not checked because of previous errors
653 The left side of an equation cannot be a set expression

How to solve this problem? Thank you for the asnwers.

Hi Urise

This is not correct for several reasons and it is not clear to me what you want to achieve.
Even if you would model it like this:

set m /14/,
n(m) /1
3/;

notequalm(m,n) … ord(m) - ord(n) =g= 1;

nothing happens in the rest of your model.

If you would have another equation

eq1(m)…
a(m) + b(m) =G= 10;

this equation would still be there for every m and not for every m > n.

Cheers
Renger

Hi Renger,

Actually I want to limit my objective function in which the index “m” and “p” should not be equal to “n”.

How to do this in GAMS syntax? I try it in equation section but those errors happened.

Show your objektive function…