ommx-python-mip-adapter 2.3.2__tar.gz → 2.3.4__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.
Files changed (17) hide show
  1. {ommx_python_mip_adapter-2.3.2 → ommx_python_mip_adapter-2.3.4}/PKG-INFO +1 -1
  2. {ommx_python_mip_adapter-2.3.2 → ommx_python_mip_adapter-2.3.4}/ommx_python_mip_adapter.egg-info/PKG-INFO +1 -1
  3. {ommx_python_mip_adapter-2.3.2 → ommx_python_mip_adapter-2.3.4}/pyproject.toml +1 -1
  4. {ommx_python_mip_adapter-2.3.2 → ommx_python_mip_adapter-2.3.4}/tests/test_integration.py +24 -8
  5. {ommx_python_mip_adapter-2.3.2 → ommx_python_mip_adapter-2.3.4}/README.md +0 -0
  6. {ommx_python_mip_adapter-2.3.2 → ommx_python_mip_adapter-2.3.4}/ommx_python_mip_adapter/__init__.py +0 -0
  7. {ommx_python_mip_adapter-2.3.2 → ommx_python_mip_adapter-2.3.4}/ommx_python_mip_adapter/adapter.py +0 -0
  8. {ommx_python_mip_adapter-2.3.2 → ommx_python_mip_adapter-2.3.4}/ommx_python_mip_adapter/exception.py +0 -0
  9. {ommx_python_mip_adapter-2.3.2 → ommx_python_mip_adapter-2.3.4}/ommx_python_mip_adapter/python_mip_to_ommx.py +0 -0
  10. {ommx_python_mip_adapter-2.3.2 → ommx_python_mip_adapter-2.3.4}/ommx_python_mip_adapter.egg-info/SOURCES.txt +0 -0
  11. {ommx_python_mip_adapter-2.3.2 → ommx_python_mip_adapter-2.3.4}/ommx_python_mip_adapter.egg-info/dependency_links.txt +0 -0
  12. {ommx_python_mip_adapter-2.3.2 → ommx_python_mip_adapter-2.3.4}/ommx_python_mip_adapter.egg-info/requires.txt +0 -0
  13. {ommx_python_mip_adapter-2.3.2 → ommx_python_mip_adapter-2.3.4}/ommx_python_mip_adapter.egg-info/top_level.txt +0 -0
  14. {ommx_python_mip_adapter-2.3.2 → ommx_python_mip_adapter-2.3.4}/setup.cfg +0 -0
  15. {ommx_python_mip_adapter-2.3.2 → ommx_python_mip_adapter-2.3.4}/tests/test_adapter.py +0 -0
  16. {ommx_python_mip_adapter-2.3.2 → ommx_python_mip_adapter-2.3.4}/tests/test_constant_constraint.py +0 -0
  17. {ommx_python_mip_adapter-2.3.2 → ommx_python_mip_adapter-2.3.4}/tests/test_model_to_instance.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ommx_python_mip_adapter
3
- Version: 2.3.2
3
+ Version: 2.3.4
4
4
  Summary: An adapter for the Python-MIP from/to OMMX.
5
5
  Author-email: "Jij Inc." <info@j-ij.com>
6
6
  Project-URL: Repository, https://github.com/Jij-Inc/ommx
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ommx_python_mip_adapter
3
- Version: 2.3.2
3
+ Version: 2.3.4
4
4
  Summary: An adapter for the Python-MIP from/to OMMX.
5
5
  Author-email: "Jij Inc." <info@j-ij.com>
6
6
  Project-URL: Repository, https://github.com/Jij-Inc/ommx
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "ommx_python_mip_adapter"
7
- version = "2.3.2"
7
+ version = "2.3.4"
8
8
 
9
9
  description = "An adapter for the Python-MIP from/to OMMX."
10
10
  authors = [{ name = "Jij Inc.", email = "info@j-ij.com" }]
@@ -124,30 +124,46 @@ def test_relax_constraint():
124
124
 
125
125
 
126
126
  def test_integration_timelimit():
127
- # KnapSack Problem
128
- p = [10, 13, 18, 32, 7, 15, 12, 6, 22, 20, 19, 13, 11, 39, 10]
129
- w = [11, 15, 20, 35, 10, 33, 28, 23, 11, 10, 12, 16, 17, 26, 29]
130
- n = len(p)
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)) <= sum(w) // 2
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(p[i] * x[i] for i in range(n)),
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.0001
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.decode(model)
166
+ adapter.decode_to_state(model)
151
167
 
152
168
 
153
169
  def test_infeasible_problem():