Resolving Several Errors for a Line of Code in GAMS

I have several errors in the following line:

e3_d(b)… sum( (t)$(ord(t) >= 1) and (ord(t) <= t-N_chp_on_max+N_chp_on_max), alpha(b, t) ) =l= N_chp_on_max;

Two errors (',' expected) and (Unknown symbol) for and,
The error (Set identifier or quoted element expected) for ord,
Additionally, for N_chp_on_max, it gives the errors (Dimension different - The symbol is referenced with more/less indices as declared) and (Incompatible operands for addition).
It also gives the error (Incompatible operands for addition) for the last closing parenthesis of the first part of sum.
For the comma before alpha, it gives the following errors:
('=l=' or '=e=' or '=g=' operator expected)
(Unrecognizable item - skip to find a new statement looking for a ';' or a key word to get started again)

I would greatly appreciate it if you could guide me and help me resolve this problem.

There are parentheses missing around your dollar condition

e3_d(b)… sum( (t)$((ord(t) >= 1) and (ord(t) <= t-N_chp_on_max+N_chp_on_max)), alpha(b, t) ) =l= N_chp_on_max;

For the other errors, it would help if you could share the full code, not just a snippet. You seem to be using a symbol with indices that do not match the symbol’s domain. But since you did not share the code where you declare the symbols, it is hard to help.

You might be interested in this section of the dcoumentation that explains how to fix common errors.

I hope this helps!

Fred

1 Like

Thanks for your help. I fixed the problem.