gdx2py.gdxfile

Module for working with GAMS GDX files

Module Contents

gdx2py.gdxfile.GMS_DTYPES
gdx2py.gdxfile.GDX_DTYPE_TEXT = U254
gdx2py.gdxfile.GDX_DTYPE_LABEL = U63
gdx2py.gdxfile.GDX_DTYPE_NUM = f8
gdx2py.gdxfile.EPS_VALUE
gdx2py.gdxfile.SPECIAL_VALUES
gdx2py.gdxfile.GMS_USERINFO_SET_PARAMETER = 0
class gdx2py.gdxfile.GdxFile(filename: str, mode: str = 'r', gams_dir: str = None)

Bases: object

Class for working with a gdx file

Use subscripting (gdx_object[‘<symbolname>’]) to get/set a GAMS set or parameter symbol.

filename

Absolute filename

Type

str

Constructor for GdxFile

Parameters
  • filename – str

  • mode – File open mode: ‘r’ for reading, ‘w’ for writing, ‘w+’ for appending (replaces existing symbol)

  • gams_dir (optional) – Location of GAMS installation directory

Raises
  • RuntimeError – Unable to load gdx library, invalid mode

  • FileNotFoundError – Input file not found

  • ValueError – Unsupported mode

  • OSError – Unable to read/write file

  • Exception – Other errors

keys(self)
close(self)
static symrange(sym_count)