Onempty and Offempty

Top  Previous  Next

Allows empty data statements for set, parameter or table data.  It is employed using the syntax

 

$Offempty

or

$Onempty

Notes:

$Onempty tells GAMS to allow empty data statements such as (onempty.gms)

$onempty

set k(*)  an emply set / /;        

parameter data(k) / /;

set I /i2/

table aa(I,I)

   i2

i2    ;

 

$Offempty suppresses them.
The default setting is $Offempty and data statements cannot be empty.
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.
When a set is specified as empty it must be defined with dimensions present ie above the statement set k(*) indicates k is one dimensional.
When a table is specified as empty it must be defined with a place for at least one element as is done in the aa table with the i2 entries above.
Onempty coupled with Onmulti 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.