GDXDUMP

The program gdxdump will write scalars, sets and parameters (tables) to standard output formatted as a GAMS program with data statements. To write to a file, use the output redirection provided by the operating system.

# Usage

gdxdump filename {options}


Options

-v or -version

Write version information only and terminate; all other options will be ignored.

Symb = identifier

Selects a single identifier to be written.

UelTable = identifier

Write all unique elements found in the gdx file to a set using identifier as the name for the set.

Delim = [period, comma, tab, blank]

Selects a different delimiter to separate unique elements; period is the default.

Suppress the header information when writing a single symbol; only the data for the symbol will be written, not its declaration.

The string supplied replaces the default header written by the program. The string can be empty if an empty header is desired; such a string can be written using two single quotes (Header = '')

NoData

Only write the headers for the symbols; no data is written.

CSVAllFields

When writing CSV format and a variable or equation symbol, all fields (level, marginal, lower, upper, and scale) will be written out. Without this option only the level will be written.

Symbols

Generate an alphabetical list of all symbols in the GDX file.

SymbolsAsSet

Generate a set declaration where the data represents basic information of all symbols in the GDX file.

DomainInfo

Generate an alphabetical list of all symbols in the GDX file that includes domain information. The column DomInf can have the following values:

N/A -   The function to get the type of domain information is not available
None -   No domain was specified (domain is the universe)
Relaxed -   The domain is relaxed, i.e. the identifiers shown do not necessarily represent one dimensional sets
Regular -   Regular domain; the identifiers shown are one dimensional sets

Output = filename

Write output to the file specified

Format = [normal, gamsbas, CSV]

Change the output format and the symbols written.

When using the gamsbas format, the program will not write the declarations for the symbols and only write Levels and Marginals for the variables, and Marginals for equations.

The CSV format adds column headers to the output. The CDim=y option uses the unique elements of the last dimension of the symbol as column headers for the values. If domain information is available, the column headers will be made unique if overlapping names have been used for the names of the index positions. If no domain information is available, the index names used will be of the form dim1, dim2, ...

CDim = [Y, N]

Can be used when writing a CSV file; when enabled, the unique elements of the last dimension will be used as column headers for the values.

FilterDef = [Y, N]

When enabled, default values will be filtered and not written. This option is enabled by default. For example, if the Level field (.L) of a variable is zero, the value will not be written.

Note that GDX files can also be viewed using the GAMSIDE.

# Examples

After executing the model trnsport.gms ([TRNSPORT] model from GAMS Model Library) using the gdx option to create the file trnsport.gdx, we use gdxdump for a listing of the symbols in the file.

gams trnsport gdx=trnsport
gdxdump trnsport Symbols


The gdxdump program writes the following:

  Symbol Dim Type  Explanatory text
1 a        1  Par  capacity of plant i in cases
2 b        1  Par  demand at market j in cases
3 c        2  Par  transport cost in thousands of dollars per case
4 cost     0  Equ  define objective function
5 d        2  Par  distance in thousands of miles
6 demand   1  Equ  satisfy demand at market j
7 f        0  Par  freight in dollars per case per thousand miles
8 i        1  Set  canning plants
9 j        1  Set  markets
10 supply   1  Equ  observe supply limit at plant i
11 x        2  Var  shipment quantities in cases
12 z        0  Var  total transportation costs in thousands of dollars


Using the DomainInfo option:

gdxdump trnsport DomainInfo


The gdxdump program writes the following:

SyNr  Type  DomInf Symbol
3   Par Regular a(i)
4   Par Regular b(j)
7   Par Regular c(i, j)
10   Equ    None cost
5   Par Regular d(i, j)
12   Equ Regular demand(j)
6   Par    None f
1   Set    None i(*)
2   Set    None j(*)
11   Equ Regular supply(i)
8   Var Regular x(i, j)
9   Var    None z


Using the SymbolsAsSet option:

gdxdump trnsport symbolsasset


The gdxdump program writes the following:

alias (Symbol, Dim, Type, *)
set    gdxitems(Symbol,Dim,Type)  Items in the GDX file /
"i".1."Set" "canning plants",
"j".1."Set" "markets",
"a".1."Par" "capacity of plant i in cases",
"b".1."Par" "demand at market j in cases",
"d".2."Par" "distance in thousands of miles",
"f".0."Par" "freight in dollars per case per thousand miles",
"c".2."Par" "transport cost in thousands of dollars per case",
"x".2."Var" "shipment quantities in cases",
"z".0."Var" "total transportation costs in thousands of dollars",
"cost".0."Equ" "define objective function",
"supply".1."Equ" "observe supply limit at plant i",
"demand".1."Equ" "satisfy demand at market j"
/;


The default output includes the declaration header and a data statement:

gdxdump trnsport.gdx symb=x


The gdxdump program writes the following:

positive Variable x(i,j) shipment quantities in cases /
'seattle'.'new-york'.L 50,
'seattle'.'chicago'.L 300,
'seattle'.'topeka'.M 0.036,
'san-diego'.'new-york'.L 275,
'san-diego'.'chicago'.M 0.00900000000000001,
'san-diego'.'topeka'.L 275 /;


Next we specify CSV as the output format and use the right most dimension as the column header:

gdxdump trnsport.gdx symb=x format=csv cdim=y


The gdxdump program writes the following:

"i","new-york","chicago","topeka"
"seattle",50,300,0
"san-diego",275,0,275


One can also write the GDX file contents into a GAMS file usign the command:

gdxdump trnsport.gdx > filetouse.gms