ommx-python-mip-adapter 2.3.3__tar.gz → 2.3.5__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.
- {ommx_python_mip_adapter-2.3.3 → ommx_python_mip_adapter-2.3.5}/PKG-INFO +1 -1
- {ommx_python_mip_adapter-2.3.3 → ommx_python_mip_adapter-2.3.5}/ommx_python_mip_adapter.egg-info/PKG-INFO +1 -1
- {ommx_python_mip_adapter-2.3.3 → ommx_python_mip_adapter-2.3.5}/pyproject.toml +1 -1
- {ommx_python_mip_adapter-2.3.3 → ommx_python_mip_adapter-2.3.5}/tests/test_integration.py +24 -8
- {ommx_python_mip_adapter-2.3.3 → ommx_python_mip_adapter-2.3.5}/README.md +0 -0
- {ommx_python_mip_adapter-2.3.3 → ommx_python_mip_adapter-2.3.5}/ommx_python_mip_adapter/__init__.py +0 -0
- {ommx_python_mip_adapter-2.3.3 → ommx_python_mip_adapter-2.3.5}/ommx_python_mip_adapter/adapter.py +0 -0
- {ommx_python_mip_adapter-2.3.3 → ommx_python_mip_adapter-2.3.5}/ommx_python_mip_adapter/exception.py +0 -0
- {ommx_python_mip_adapter-2.3.3 → ommx_python_mip_adapter-2.3.5}/ommx_python_mip_adapter/python_mip_to_ommx.py +0 -0
- {ommx_python_mip_adapter-2.3.3 → ommx_python_mip_adapter-2.3.5}/ommx_python_mip_adapter.egg-info/SOURCES.txt +0 -0
- {ommx_python_mip_adapter-2.3.3 → ommx_python_mip_adapter-2.3.5}/ommx_python_mip_adapter.egg-info/dependency_links.txt +0 -0
- {ommx_python_mip_adapter-2.3.3 → ommx_python_mip_adapter-2.3.5}/ommx_python_mip_adapter.egg-info/requires.txt +0 -0
- {ommx_python_mip_adapter-2.3.3 → ommx_python_mip_adapter-2.3.5}/ommx_python_mip_adapter.egg-info/top_level.txt +0 -0
- {ommx_python_mip_adapter-2.3.3 → ommx_python_mip_adapter-2.3.5}/setup.cfg +0 -0
- {ommx_python_mip_adapter-2.3.3 → ommx_python_mip_adapter-2.3.5}/tests/test_adapter.py +0 -0
- {ommx_python_mip_adapter-2.3.3 → ommx_python_mip_adapter-2.3.5}/tests/test_constant_constraint.py +0 -0
- {ommx_python_mip_adapter-2.3.3 → ommx_python_mip_adapter-2.3.5}/tests/test_model_to_instance.py +0 -0
|
@@ -124,30 +124,46 @@ def test_relax_constraint():
|
|
|
124
124
|
|
|
125
125
|
|
|
126
126
|
def test_integration_timelimit():
|
|
127
|
-
#
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
127
|
+
# Knapsack Problem
|
|
128
|
+
# fmt: off
|
|
129
|
+
base_v = [
|
|
130
|
+
9, 28, 26, 5, 26, 29, 13, 20, 24, 10, 23, 15, 5, 27, 21, 8, 7, 8, 21, 13,
|
|
131
|
+
24, 5, 5, 6, 20, 16, 25, 12, 28, 20, 20, 6, 6, 10, 29, 29, 17, 12, 26, 20,
|
|
132
|
+
22, 20, 22, 23, 6, 23, 28, 5, 18, 17, 22, 13, 24, 17, 18, 11, 8, 9, 23, 21,
|
|
133
|
+
17, 7, 10, 15, 7, 20, 17, 29, 22, 29, 15, 5, 24, 7, 5, 12, 11, 28, 13, 6,
|
|
134
|
+
9, 8, 8, 13, 6, 15, 27, 7, 15, 29, 9, 26, 25, 27, 6, 26, 29, 26, 9, 10,
|
|
135
|
+
]
|
|
136
|
+
base_w = [
|
|
137
|
+
21, 37, 35, 19, 39, 36, 32, 32, 22, 20, 29, 21, 12, 39, 24, 8, 9, 19, 22, 12,
|
|
138
|
+
38, 21, 7, 9, 24, 23, 35, 27, 29, 21, 18, 10, 20, 21, 30, 35, 36, 10, 45, 36,
|
|
139
|
+
38, 22, 34, 23, 4, 29, 28, 12, 37, 23, 39, 32, 32, 18, 28, 26, 6, 10, 23, 29,
|
|
140
|
+
20, 18, 14, 26, 23, 20, 36, 37, 31, 27, 18, 23, 30, 22, 8, 26, 16, 37, 26, 10,
|
|
141
|
+
24, 12, 11, 21, 4, 14, 34, 12, 15, 34, 24, 27, 36, 31, 23, 37, 45, 44, 7, 20,
|
|
142
|
+
]
|
|
143
|
+
# fmt: on
|
|
144
|
+
v = base_v * 100
|
|
145
|
+
w = base_w * 100
|
|
146
|
+
n = len(v)
|
|
131
147
|
x = [DecisionVariable.binary(i) for i in range(n)]
|
|
132
|
-
constraint = sum(w[i] * x[i] for i in range(n)) <=
|
|
148
|
+
constraint = sum(w[i] * x[i] for i in range(n)) <= 100 * 100
|
|
133
149
|
assert not isinstance(constraint, bool)
|
|
134
150
|
instance = Instance.from_components(
|
|
135
151
|
decision_variables=x,
|
|
136
|
-
objective=sum(
|
|
152
|
+
objective=sum(v[i] * x[i] for i in range(n)),
|
|
137
153
|
constraints=[constraint],
|
|
138
154
|
sense=Instance.MAXIMIZE,
|
|
139
155
|
)
|
|
140
156
|
adapter = OMMXPythonMIPAdapter(instance)
|
|
141
157
|
model = adapter.solver_input
|
|
142
158
|
# Set a very small time limit to force the solver to stop before finding any solution
|
|
143
|
-
model.max_seconds = 0.
|
|
159
|
+
model.max_seconds = 0.01
|
|
144
160
|
model.optimize()
|
|
145
161
|
|
|
146
162
|
with pytest.raises(
|
|
147
163
|
NoSolutionReturned,
|
|
148
164
|
match="No solution was returned during the search",
|
|
149
165
|
):
|
|
150
|
-
adapter.
|
|
166
|
+
adapter.decode_to_state(model)
|
|
151
167
|
|
|
152
168
|
|
|
153
169
|
def test_infeasible_problem():
|
|
File without changes
|
{ommx_python_mip_adapter-2.3.3 → ommx_python_mip_adapter-2.3.5}/ommx_python_mip_adapter/__init__.py
RENAMED
|
File without changes
|
{ommx_python_mip_adapter-2.3.3 → ommx_python_mip_adapter-2.3.5}/ommx_python_mip_adapter/adapter.py
RENAMED
|
File without changes
|
{ommx_python_mip_adapter-2.3.3 → ommx_python_mip_adapter-2.3.5}/ommx_python_mip_adapter/exception.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ommx_python_mip_adapter-2.3.3 → ommx_python_mip_adapter-2.3.5}/tests/test_constant_constraint.py
RENAMED
|
File without changes
|
{ommx_python_mip_adapter-2.3.3 → ommx_python_mip_adapter-2.3.5}/tests/test_model_to_instance.py
RENAMED
|
File without changes
|