|
Execution time selected item GDX file creation |
Top Previous Next |
|
An Execute_Unload command creates a GDX file containing selected problem data. The data in the GDX file are those present at the time that the statement is executed. The results of all prior calculations and the most recent solve for any model will be reflected. The basic syntax of the statement is
Execute_Unload 'filename', nameditem1,nameditem2, ... ;
The filename argument specifies the name of the resultant GDX file. In particular, a file with this name is created with the extension .GDX and is placed in the current working directory. This opens and closes the GDX file and does all the writing. Note the Execute_Unload command overwrites any existing file with the name filename.gdx so all writing to the file must be done in one statement. The second part of the statement is a list of items to be placed in the GDX file and has several variants. For example, one could use multiple lines and unload several items with the command structure
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_Unload 'filename', internalname1=GDXitemname1 i2=gf2;
and would result in the GAMS item called internalname1 being called gdxitemname1 in the GDX file and i2 being called gf2. This syntax again can be repeated for multiple items. Finally when the Execute_Unload is run without any items named then the GDX file automatically contains all items in the GAMS program, ie
Execute_Unload 'filename'
will cause filename to contain all sets, parameters etc. Example: In the model gdxexectrnsport.gms we introduce the statement
execute_unload 'tran2',i,j,d,f,a=sup,b=dem,x,supply;
The result of this is the writing of the GDX file tran2.gdx that contains the data for the sets i and j plus the parameters d, f, a and b as well as the variables x and the equations supply. In that file the a and b items have been renamed and are identified as sup and dem.
Notes
|