Multiple sets

Top  Previous  Next

Operations indexing sets may involve multiple sets.  In such a case one can write the function in multiple ways.  For example the sum over the sets I and J of c(I,J)*v(I,J)) can be written as either (calculate.gms)

 

R=sum((I,J),c(I,J)*v(I,J));

or

R=sum(I,sum(J,c(I,J)*v(I,J)));

Notes:

Note how the parentheses match up.
When multiple sets are addressed they need to be enclosed in parentheses.
PROD, SMIN and SMAX indices are handled just as the SUM is above.