|
Ifthen |
Top Previous Next |
|
Expressions can contain a function that take on different values depending on a condition.
X=ifthen(condition,expressioniftrue,expressioniffalse);
where if the condition is true then the function equals expressioniftrue and otherwise equals expressioniffalse. For example (function.gms) below if tt=2 then x will be set to 3 otherwise x=4+y.
X=ifthen(tt=2,3,4+y);
This function can be used on data during GAMS calculation and also in .. equations. When used in .. equations it requires the model type to be DNLP and it is not supported by all available solvers. |