|
Element definition by computation |
Top Previous Next |
|
Elements of subsets may also be computed. This is done by using a statement such as
Set("nameofelement")=yes;
which is equivalent to including a set element named nameofelement in the set declaration. One may also use computations to remove elements by using a statement like
Set("nameofelement")=no; Examples: (sets.gms) Set nSuperset /r1*r15/ nSubset(nsuperset); nSubset(nsuperset)=yes; nSubset("r4")=no;
Set nallitems /Corn,wheat,water,land/ nCrop(nallitems) ; Parameter yield(nallitems) /Corn 100,Wheat 40/; nCrop(nallitems)$(yield(nallitems) gt 0)=yes; Notes:
|