If you want express everything into the exact notation you presented
the problem
- you declare two integer sets (ie. subsets of the predefined set
Integers), say SetI, SetR
- your constraint is indexed over i: FirstConstraint(i | 1 <= i <= 24)
- the definition of the constraint is:
sum(r | 1 <= r <= i+2, x(r)) + sum(r | 23 <= r <= i, P(r)) >= 0
Notice that i+2 in the above expression is actual a lead operator (if
you don't know what it is, look it up in the Language reference),
so the lead value only coincides with the numerical value if there are
no consecutive integers missing from it. Otherwise you have to
resort to using the ord operator.
Alternatively, you should skip using meaningless names integer sets
and set elements, parameters and variables alltogether, and start
using more meaningful names for sets, set elements, parameters and
variables..This is especially useful if your model grows, and
remembering where all the silly identifier and element names stand for
becomes very, very cumbersome.
Cheers,
Marcel