Load

Top  Previous  Next

This dollar command loads specified items from a GDX file.  It is employed using the syntax

 

$Load item1 item2 ...

 

but must be used in conjunction with the command $Gdxin.

Example:

(gdxintrnsport.gms)

$gdxin tran2

$Load

  Sets

       i   canning plants

       j   markets          ;

$Load i j

  Parameters

       a(i)  capacity of plant i in cases

       b(j)  demand at market j in cases;

$Load a=sup

$Loaddc b=dem

  Parameter d(i,j)  distance in thousands of miles;

$Load d

  Scalar f  freight in dollars per case per thousand miles   ;

$Load f

$gdxin

Notes:

Load is followed by the names of items to load separated by a space.
Load must be preceded and succeeded by a $Gdxin.  The preceding $Gdxin specifies the GDX file name and opens the file. The succeeding $Gdxin closes the file.  More than one Load can appear in between.
When the $Load is not followed by arguments this causes a listing of the GDX file contents to be generated.
Load brings in the data at compile time and may be used to load sets, parameters, and variable or equation starting values, bounds and scales.
Execute_load is the execution time counterpart of this command.
GAMS does not check to see if the sets referenced match with the elements of the sets in the data.  If one wishes that checking then the alternative $Loaddc should be used.
The universal set can be read for a GDX by using the syntax by $LOAD id=*.