gdx2py
¶
Submodules¶
Package Contents¶
-
class
gdx2py.
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)¶
-
-
class
gdx2py.
GAMSSet
(keys: Sequence[tuple], domain: Sequence[str] = None, expl_text: str = '', assoc_texts: Sequence[str] = None)¶ Bases:
gdx2py.gams._GAMSNDimSymbol
Class for GAMS Sets
-
elements
¶ Set elements
- Type
list
-
expl_text
¶ Set explanatory text
- Type
str
-
assoc_texts
¶ Set element associated texts
- Type
list
Constructor for GAMSSet
- Parameters
keys – Sequence of tuples of strings for the keys
domain (optional) – Sequence of domain set names, use None for the universal set
expl_text (optional) – Explanatory text
assoc_texts (optional) – Set element associated texts
- Raises
ValueError –
-
property
elements
(self)
-
property
assoc_texts
(self)
-
-
class
gdx2py.
GAMSScalar
(value: float, expl_text: str = '')¶ Bases:
gdx2py.gams._GAMSSymbol
Class for GAMS Scalars (0-dimensional Parameters)
-
expl_text
¶ Symbol explanatory text
- Type
str
Class constructor
- Parameters
name – Symbol name
value – Value
- Raises
ValueError –
-
-
class
gdx2py.
GAMSParameter
(data: Mapping[tuple, float], domain: Sequence[str] = None, expl_text: str = '')¶ Bases:
gdx2py.gams._GAMSNDimSymbol
Class for GAMS Parameters
-
domain
¶ List of set names that make the domain of the symbol
- Type
list
-
expl_text
¶ Symbol explanatory text
- Type
str
-
keys
()¶ Return a view to the symbol’s keys
-
values
()¶ Return a view to the symbol’s values
Constructor for GAMSParameter
- Parameters
data – Dictionay of keys and values
domain (optional) – List of domain set names, use None for the universal set
expl_text (optional) – Explanatory text
- Raises
ValueError –
-
keys
(self)
-
values
(self)
-
to_pandas
(self)¶
-