gamspy#
- gamspy.set_options(options: dict[Literal['GAMS_SYSDIR', 'VALIDATION', 'DOMAIN_VALIDATION', 'SOLVER_OPTION_VALIDATION', 'MAP_SPECIAL_VALUES', 'ASSUME_VARIABLE_SUFFIX', 'USE_PY_VAR_NAME', 'DROP_DOMAIN_VIOLATIONS', 'ALLOW_AMBIGUOUS_EQUATIONS'], Any]) None[source]#
Sets the given configuration options.
- Parameters:
- optionsdict[str, Any]
- Raises:
- ValidationError
In case the given options are not in dict type.
Examples
>>> import gamspy as gp >>> gp.set_options({"DOMAIN_VALIDATION": 1})
- gamspy.get_option(name: str) Any[source]#
Returns the requested option.
- Parameters:
- namestr
Option name.
- Returns:
- Any
The value of the option.
- Raises:
- KeyError
In case the option is not set.
Examples
>>> import gamspy as gp >>> gp.set_options({"DOMAIN_VALIDATION": 0}) >>> gp.get_option("DOMAIN_VALIDATION") 0 >>> gp.set_options({"DOMAIN_VALIDATION": 1})
- gamspy.serialize(container: Container, path: str) None[source]#
Serializes the given Container into a zip file.
- Parameters:
- containerContainer
Container to be serialized.
- pathstr
Path to the zip file.
Examples
>>> import gamspy as gp >>> m = gp.Container() >>> i = gp.Set(m, "i", records=range(3)) >>> gp.serialize(m, "serialization_path.zip")
- gamspy.deserialize(path: str) Container[source]#
Deserializes the given zip file into a Container.
- Parameters:
- pathstr
Path to the zip file.
- Returns:
- Container
Deserialized Container.
- Raises:
- ValidationError
In case the given path is not a zip file.
Examples
>>> import gamspy as gp >>> m = gp.Container() >>> i = gp.Set(m, "i", records=["i1"]) >>> m.serialize("model.zip") >>> m2 = gp.deserialize("model.zip") >>> print(m2["i"].toList()) ['i1']