Problem with conditional summation

Hey everyone,

I’m having a Problem with the summation of a part of a set. After reading numerous threads and the GAMS guide I still can’t find the cause of the code not working.

Code:
alias (m,n);

Positive variables
AI(p,m) quantity sold
Q(p,m) quanitity produced

Equations
AMP(p,m)

Restriction:
AMP(p,m)… sum(n$(ord(m) LE n),(Q(p,m))) =G= sum(n$(ord(m) LE n), AI(p,m));
->This restriction is supposed to make sure that there cannot be sold more products than produced until the period.
I get Errors 135 (Incompatibel operands) and 148 (Dimension different) for both sides of this equation but i juzst cant figure out why.

Is there somebody who knows what to change?

Thanks in advance!

You managed to use ord for m, now you just need to do the same for n:

AMP(p,m).. sum(n$(ord(m) LE ord(n)),(Q(p,m))) =G= sum(n$(ord(m) LE (ord(n)), AI(p,m));

-Michael

It’s working! Thank you very much!