Conditionals to restrict set coverage

Top  Previous  Next

In sums, minimums, maximums and products it is not always desirable to operate over all the members of a set.  One accomplishes this by adding a conditional or addressing over a tuple or subset as discussed below.  Such a conditional can take on a number of forms.

Examples:

(calculate.gms)

Examples using a relatively simple conditional on the numerical value of a parameter are

 

mA(i)$xvar.l(i)=mr(i);

mA(i) =mr(i) $xvar.l(i);

r=sum(i$xvar.l(i),mr(i));

r=smin(i$xvar.l(i),mr(i));

r=prod(i$xvar.l(i),mr(i));

Eq7(i)$ma(i).. zZ{I}=l=10*[3+2]**{34/(11+12)}+{11-1};

Eq8(j)$w(j)..  z2(j)=e= sum(I$ma(i),jr(I,j)*xvar(i)) ;

Notes:

A fuller discussion of these topics appears in the conditional and sets chapters.
The equations with the conditionals on the left hand side operate significantly different from those with the conditional on the right hand side as discussed below.