Onmulti and Offmulti

Top  Previous  Next

Allows or disallows multiple definition and data statements for a set or parameter.  By default ($Offmulti), GAMS does not allow data statements to be redefined.  If this dollar command is enabled, the second or subsequent data statements are merged with entries of the previous ones.  It is employed using the syntax

 

$Offmulti

or

$Onmulti

 

Ordinarily $Onmulti should not be used as it can have perverse effects.

Example:

$Onmulti

Scalar x /3/

Scalar x /4/;

Set I /i1/;

Set I /i2/;

Set j / /;

Set j /a,b,c/;

Notes:

Note that all multiple data statements are executed before any other statement is executed.
The last value takes precedence.
Default is $Offmulti.
One can use the combination of Onempty and onmulti to develop a model without data and add it at a later stage as in multi.gms.
Onmulti coupled with Onempty can be used in conjunction with save and restart to allow a model to be set up and data integrated later possibly to preserve proprietary model structure.