|
Conditionals |
Top Previous Next |
|
Certainly when doing calculations and setting up models cases arise where one might wish to do different things conditional upon data. In particular, one might wish to do a calculation like z=x/y only if y is nonzero or one might wish to define demand equations only for cases where demand exists. Incorporation of such considerations into GAMS program involves what's known as the $conditional as extensively discussed in the Conditionals chapter. Below I present several examples of this feature. Generally the expressions are of the form
term$logical condition
which says do something with term only if the logical condition is true where the $ can be read as if it were the word if. Conditionals can appear in a number of contexts, as I will illustrate below. |