gamspy 1.19.1__tar.gz → 1.19.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {gamspy-1.19.1/src/gamspy.egg-info → gamspy-1.19.3}/PKG-INFO +1 -1
- {gamspy-1.19.1 → gamspy-1.19.3}/pyproject.toml +1 -1
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/_backend/backend.py +1 -3
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/_cli/show.py +3 -3
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/_container.py +11 -53
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/_miro.py +2 -6
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/_validation.py +2 -1
- {gamspy-1.19.1 → gamspy-1.19.3/src/gamspy.egg-info}/PKG-INFO +1 -1
- {gamspy-1.19.1 → gamspy-1.19.3}/tests/test_gamspy.py +5 -5
- {gamspy-1.19.1 → gamspy-1.19.3}/LICENSE +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/README.md +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/README_PYPI.md +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/setup.cfg +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/__init__.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/__main__.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/_algebra/__init__.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/_algebra/condition.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/_algebra/domain.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/_algebra/expression.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/_algebra/number.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/_algebra/operable.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/_algebra/operation.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/_backend/__init__.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/_backend/engine.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/_backend/local.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/_backend/neos.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/_cli/__init__.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/_cli/cli.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/_cli/gdx.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/_cli/install.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/_cli/list.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/_cli/mps2gms.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/_cli/probe.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/_cli/retrieve.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/_cli/run.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/_cli/uninstall.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/_cli/util.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/_communication.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/_config.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/_convert.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/_database.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/_extrinsic.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/_model.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/_model_instance.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/_options.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/_serialization.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/_symbols/__init__.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/_symbols/alias.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/_symbols/equation.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/_symbols/implicits/__init__.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/_symbols/implicits/implicit_equation.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/_symbols/implicits/implicit_parameter.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/_symbols/implicits/implicit_set.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/_symbols/implicits/implicit_symbol.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/_symbols/implicits/implicit_variable.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/_symbols/parameter.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/_symbols/set.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/_symbols/symbol.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/_symbols/universe_alias.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/_symbols/variable.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/_types.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/_workspace.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/exceptions.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/formulations/__init__.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/formulations/ml/__init__.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/formulations/ml/decision_tree_struct.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/formulations/ml/gradient_boosting.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/formulations/ml/random_forest.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/formulations/ml/regression_tree.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/formulations/nn/__init__.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/formulations/nn/avgpool2d.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/formulations/nn/conv1d.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/formulations/nn/conv2d.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/formulations/nn/linear.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/formulations/nn/maxpool2d.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/formulations/nn/minpool2d.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/formulations/nn/mpool2d.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/formulations/nn/torch_sequential.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/formulations/piecewise.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/formulations/result.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/formulations/shape.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/formulations/utils.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/math/__init__.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/math/activation.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/math/log_power.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/math/matrix.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/math/misc.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/math/probability.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/math/trigonometric.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/py.typed +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/utils.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy/version.py +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy.egg-info/SOURCES.txt +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy.egg-info/dependency_links.txt +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy.egg-info/entry_points.txt +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy.egg-info/requires.txt +0 -0
- {gamspy-1.19.1 → gamspy-1.19.3}/src/gamspy.egg-info/top_level.txt +0 -0
|
@@ -222,9 +222,7 @@ class Backend(ABC):
|
|
|
222
222
|
symbols = filtered_names
|
|
223
223
|
|
|
224
224
|
if len(symbols) != 0:
|
|
225
|
-
self.container._load_records_from_gdx(
|
|
226
|
-
self.container._gdx_out, symbols, create_if_not_declared=True
|
|
227
|
-
)
|
|
225
|
+
self.container._load_records_from_gdx(self.container._gdx_out, symbols)
|
|
228
226
|
self.make_unmodified(symbols)
|
|
229
227
|
|
|
230
228
|
if relaxed_domain_mapping:
|
|
@@ -67,9 +67,9 @@ SOLVER_PAGE_MAP = {
|
|
|
67
67
|
|
|
68
68
|
# cm: component_map, ia: is_academic
|
|
69
69
|
EVALUATIONS: dict[str, Callable[[dict[str, bool], bool], bool]] = {
|
|
70
|
-
"ANTIGONE": lambda cm, ia:
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
"ANTIGONE": lambda cm, ia: (
|
|
71
|
+
cm["AT"] and (cm["CP"] or cm["CL"]) and (cm["CO"] or cm["SN"])
|
|
72
|
+
),
|
|
73
73
|
"BARON": lambda cm, ia: cm["BA"],
|
|
74
74
|
"CBC": lambda cm, ia: True,
|
|
75
75
|
"CONOPT": lambda cm, ia: cm["CO"],
|
|
@@ -588,7 +588,6 @@ class Container(gt.Container):
|
|
|
588
588
|
def _filter_load_symbols(
|
|
589
589
|
self,
|
|
590
590
|
symbol_names: dict[str, str] | list[str],
|
|
591
|
-
create_if_not_declared: bool = False,
|
|
592
591
|
) -> dict[str, str] | list[str]:
|
|
593
592
|
if isinstance(symbol_names, list):
|
|
594
593
|
names = []
|
|
@@ -598,12 +597,7 @@ class Container(gt.Container):
|
|
|
598
597
|
if not isinstance(symbol, gt.Alias) and symbol.synchronize:
|
|
599
598
|
names.append(name)
|
|
600
599
|
else:
|
|
601
|
-
|
|
602
|
-
names.append(name)
|
|
603
|
-
else:
|
|
604
|
-
raise ValidationError(
|
|
605
|
-
f"Cannot load records of `{name}` because it does not exist in the container."
|
|
606
|
-
)
|
|
600
|
+
names.append(name)
|
|
607
601
|
|
|
608
602
|
return names
|
|
609
603
|
|
|
@@ -619,13 +613,7 @@ class Container(gt.Container):
|
|
|
619
613
|
|
|
620
614
|
return mapping
|
|
621
615
|
|
|
622
|
-
def _load_records_from_gdx(
|
|
623
|
-
self,
|
|
624
|
-
load_from: str,
|
|
625
|
-
names: Iterable[str],
|
|
626
|
-
*,
|
|
627
|
-
create_if_not_declared: bool = False,
|
|
628
|
-
) -> None:
|
|
616
|
+
def _load_records_from_gdx(self, load_from: str, names: Iterable[str]) -> None:
|
|
629
617
|
self._temp_container.read(load_from, names)
|
|
630
618
|
original_state = self._options.miro_protect
|
|
631
619
|
self._options.miro_protect = False
|
|
@@ -636,12 +624,7 @@ class Container(gt.Container):
|
|
|
636
624
|
self[name].records = updated_records
|
|
637
625
|
self[name].domain_labels = self[name].domain_names
|
|
638
626
|
else:
|
|
639
|
-
|
|
640
|
-
self._read(load_from, [name])
|
|
641
|
-
else:
|
|
642
|
-
raise ValidationError(
|
|
643
|
-
f"Cannot load records of `{name}` because it does not exist in the container."
|
|
644
|
-
)
|
|
627
|
+
self._read(load_from, [name])
|
|
645
628
|
|
|
646
629
|
self._options.miro_protect = original_state
|
|
647
630
|
self._temp_container.data = {}
|
|
@@ -989,53 +972,28 @@ class Container(gt.Container):
|
|
|
989
972
|
if isinstance(load_from, Path):
|
|
990
973
|
load_from = str(load_from.resolve())
|
|
991
974
|
|
|
992
|
-
create_if_not_declared = symbol_names is None
|
|
993
975
|
if symbol_names is None:
|
|
994
976
|
# If no symbol names are given, all records in the gdx should be loaded
|
|
995
977
|
symbol_names = utils._get_symbol_names_from_gdx(
|
|
996
978
|
self.system_directory, load_from
|
|
997
979
|
)
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
)
|
|
1002
|
-
self._load_records_from_gdx(
|
|
1003
|
-
load_from, symbol_names, create_if_not_declared=create_if_not_declared
|
|
1004
|
-
)
|
|
980
|
+
self._add_statement(f"$declareAndLoad {load_from}")
|
|
981
|
+
symbol_names = self._filter_load_symbols(symbol_names) # type: ignore
|
|
982
|
+
self._load_records_from_gdx(load_from, symbol_names)
|
|
1005
983
|
self._synch_with_gams()
|
|
1006
984
|
return
|
|
1007
985
|
|
|
1008
|
-
if isinstance(symbol_names, list):
|
|
1009
|
-
symbol_names = self._filter_load_symbols(
|
|
1010
|
-
symbol_names, create_if_not_declared
|
|
1011
|
-
)
|
|
1012
|
-
self._add_statement(f"$gdxIn {load_from}")
|
|
1013
|
-
symbols_str = " ".join(symbol_names)
|
|
1014
|
-
self._add_statement(f"$loadDC {symbols_str}")
|
|
1015
|
-
self._add_statement("$gdxIn")
|
|
1016
|
-
elif isinstance(symbol_names, dict):
|
|
1017
|
-
symbol_names = self._filter_load_symbols(
|
|
1018
|
-
symbol_names, create_if_not_declared
|
|
1019
|
-
)
|
|
1020
|
-
self._add_statement(f"$gdxIn {load_from}")
|
|
1021
|
-
symbols_str = " ".join(
|
|
1022
|
-
[f"{value}={key}" for key, value in symbol_names.items()] # type: ignore
|
|
1023
|
-
)
|
|
1024
|
-
self._add_statement(f"$loadDC {symbols_str}")
|
|
1025
|
-
self._add_statement("$gdxIn")
|
|
986
|
+
if isinstance(symbol_names, (list, dict)):
|
|
987
|
+
symbol_names = self._filter_load_symbols(symbol_names)
|
|
1026
988
|
else:
|
|
1027
989
|
raise TypeError("`symbol_names` must be either a list or a dictionary.")
|
|
1028
990
|
|
|
1029
|
-
self._options._debug_options["gdx"] = self._gdx_out
|
|
1030
|
-
self._options._debug_options["gdxSymbols"] = "newOrChanged"
|
|
1031
|
-
self._synch_with_gams()
|
|
1032
|
-
|
|
1033
991
|
if isinstance(symbol_names, dict):
|
|
1034
992
|
self._load_records_with_rename(load_from, symbol_names)
|
|
1035
993
|
else:
|
|
1036
|
-
self._load_records_from_gdx(
|
|
1037
|
-
|
|
1038
|
-
|
|
994
|
+
self._load_records_from_gdx(load_from, symbol_names)
|
|
995
|
+
|
|
996
|
+
self._synch_with_gams()
|
|
1039
997
|
|
|
1040
998
|
def addGamsCode(self, gams_code: str) -> None:
|
|
1041
999
|
"""
|
|
@@ -41,9 +41,7 @@ def load_miro_symbol_records(container: Container):
|
|
|
41
41
|
for name in container._miro_input_symbols
|
|
42
42
|
if not container[name]._already_loaded
|
|
43
43
|
]
|
|
44
|
-
container._load_records_from_gdx(
|
|
45
|
-
MIRO_GDX_IN, names, create_if_not_declared=True
|
|
46
|
-
)
|
|
44
|
+
container._load_records_from_gdx(MIRO_GDX_IN, names)
|
|
47
45
|
for name in names:
|
|
48
46
|
symbol = container[name]
|
|
49
47
|
symbol._already_loaded = True
|
|
@@ -56,9 +54,7 @@ def load_miro_symbol_records(container: Container):
|
|
|
56
54
|
|
|
57
55
|
# Load records of miro output symbols
|
|
58
56
|
if MIRO_GDX_OUT and container._miro_output_symbols:
|
|
59
|
-
container._load_records_from_gdx(
|
|
60
|
-
MIRO_GDX_OUT, container._miro_output_symbols, create_if_not_declared=True
|
|
61
|
-
)
|
|
57
|
+
container._load_records_from_gdx(MIRO_GDX_OUT, container._miro_output_symbols)
|
|
62
58
|
|
|
63
59
|
for name in container._miro_input_symbols + container._miro_output_symbols:
|
|
64
60
|
container[name].modified = False
|
|
@@ -18,7 +18,7 @@ from gamspy.exceptions import GamspyException, ValidationError
|
|
|
18
18
|
|
|
19
19
|
@pytest.mark.unit
|
|
20
20
|
def test_version():
|
|
21
|
-
assert gp.__version__ == "1.19.
|
|
21
|
+
assert gp.__version__ == "1.19.3"
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
@pytest.mark.unit
|
|
@@ -73,20 +73,20 @@ def test_config():
|
|
|
73
73
|
def test_domain_checking_config_performance():
|
|
74
74
|
gp.set_options({"DOMAIN_VALIDATION": 1})
|
|
75
75
|
m = gp.Container()
|
|
76
|
-
i = gp.Set(m, records=range(
|
|
76
|
+
i = gp.Set(m, records=range(99))
|
|
77
77
|
a = gp.Parameter(m, domain=i)
|
|
78
78
|
start = time.time()
|
|
79
|
-
for idx in range(
|
|
79
|
+
for idx in range(99):
|
|
80
80
|
_ = a[idx] + a[idx] + a[idx] + a[idx] + a[idx] + a[idx] + a[idx] + a[idx]
|
|
81
81
|
|
|
82
82
|
timing_with_validation = time.time() - start
|
|
83
83
|
|
|
84
84
|
gp.set_options({"DOMAIN_VALIDATION": 0})
|
|
85
85
|
m = gp.Container()
|
|
86
|
-
i = gp.Set(m, records=range(
|
|
86
|
+
i = gp.Set(m, records=range(99))
|
|
87
87
|
a = gp.Parameter(m, domain=i)
|
|
88
88
|
start = time.time()
|
|
89
|
-
for idx in range(
|
|
89
|
+
for idx in range(99):
|
|
90
90
|
_ = a[idx] + a[idx] + a[idx] + a[idx] + a[idx] + a[idx] + a[idx] + a[idx]
|
|
91
91
|
timing_without_validation = time.time() - start
|
|
92
92
|
gp.set_options({"DOMAIN_VALIDATION": 1})
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|