Execute_Load

Top  Previous  Next

When parameter data are loaded using the Execute_Load GAMS acts as if an assignment statement was present, except that it does not merge the data read with the current data; it is a full replacement.  Sets defining domains cannot be loaded.  However sets that are subsets of existing sets and do not define new elements can be loaded at execution time (Domain defining sets can be loaded can at compile time using $Load).

The basic syntax of the statement is

 

Execute_Load 'filename', nameditem1,nameditem2, ... ;

 

The filename argument specifies the name of the GDX file to read.  In particular, a file with this filename with the extension .GDX will be read from the current working directory.

The second part of the statement is a list of items to be read from the GDX file.  For example one could load several items with the command structure

 

Execute_Load 'filename',nameditem1

 nameditem2,

 itemname3

 itemname4 ;

 

It is also possible to have different names for parameters in the GDX file and the GAMS program.  In such a case the syntax is

 

Execute_Load 'filename',internalname1=GDXitemname1 internalname2=GDXitemname2;

Example:

In the model gdxexecintrnsport.gms we introduce the statement

 

execute_load 'tran2',k=j,d,f,a=sup,b=dem,x,supply;

 

The result of this is that the k subset and the parameters are loaded.  We also get advanced basis information when we load variables and equations.

Notes:

Items must be declared with Set, Parameter, Scalar, Variable or Equation statements before the Execute_Load appears.
When loading data domain checking is not enforced so that when an item is resident in a GDX file for set elements not present in the current file these items are ignored and do not create errors or cause generation of any messages.
Load replaces data in arrays that are defined
The name of the active file being loaded from can be changed with the Put_utility 'gdxin' syntax