|
Suppressing terms in equations (right hand side) |
Top Previous Next |
|
GAMS replacement statements involve an item to change in value on the left hand side and a set of terms that constitute the new value on the right hand side. The terms on the right hand side may be conditionally included. $conditionals are used to do this and may act on the term for all cases or on a case by case basis (only if the conditional is set element dependent). They may occur in replacement statements or in model equation specification statements (.. statements). The general format for such a case is
Namedparameter = term1+term$logical condition or Namedequation.. term1+term$logical condition =L= other terms;
and specifies that the term is added into the calculation of namedparameter or the namedequation only if the logical condition is true. Example: qq = qq+1$(x gt 0); qq = 1$(x gt 0); q(i) = a(i)+1$(a(i) gt 0); q(i) = a(i)$(a(i) gt 0); X = sum(I,q(i))$(qq gt 0)+4; Eq4.. xvar+yvar$(qq gt 0)=e=3; Eq5(i).. ivar(i)$(a(i) gt 0)+yvar$(qq gt 0)=e=3;
All say include this term only if the logical condition is true. Notes:
|