ommx-python-mip-adapter 0.5.0__tar.gz → 1.0.0__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-0.5.0 → ommx_python_mip_adapter-1.0.0}/PKG-INFO +3 -4
  2. {ommx_python_mip_adapter-0.5.0 → ommx_python_mip_adapter-1.0.0}/ommx_python_mip_adapter.egg-info/PKG-INFO +3 -4
  3. {ommx_python_mip_adapter-0.5.0 → ommx_python_mip_adapter-1.0.0}/ommx_python_mip_adapter.egg-info/SOURCES.txt +1 -0
  4. {ommx_python_mip_adapter-0.5.0 → ommx_python_mip_adapter-1.0.0}/ommx_python_mip_adapter.egg-info/requires.txt +2 -2
  5. {ommx_python_mip_adapter-0.5.0 → ommx_python_mip_adapter-1.0.0}/pyproject.toml +6 -4
  6. ommx_python_mip_adapter-1.0.0/tests/test_constant_constraint.py +47 -0
  7. {ommx_python_mip_adapter-0.5.0 → ommx_python_mip_adapter-1.0.0}/README.md +0 -0
  8. {ommx_python_mip_adapter-0.5.0 → ommx_python_mip_adapter-1.0.0}/ommx_python_mip_adapter/__init__.py +0 -0
  9. {ommx_python_mip_adapter-0.5.0 → ommx_python_mip_adapter-1.0.0}/ommx_python_mip_adapter/exception.py +0 -0
  10. {ommx_python_mip_adapter-0.5.0 → ommx_python_mip_adapter-1.0.0}/ommx_python_mip_adapter/ommx_to_python_mip.py +0 -0
  11. {ommx_python_mip_adapter-0.5.0 → ommx_python_mip_adapter-1.0.0}/ommx_python_mip_adapter/python_mip_to_ommx.py +0 -0
  12. {ommx_python_mip_adapter-0.5.0 → ommx_python_mip_adapter-1.0.0}/ommx_python_mip_adapter.egg-info/dependency_links.txt +0 -0
  13. {ommx_python_mip_adapter-0.5.0 → ommx_python_mip_adapter-1.0.0}/ommx_python_mip_adapter.egg-info/top_level.txt +0 -0
  14. {ommx_python_mip_adapter-0.5.0 → ommx_python_mip_adapter-1.0.0}/setup.cfg +0 -0
  15. {ommx_python_mip_adapter-0.5.0 → ommx_python_mip_adapter-1.0.0}/tests/test_instance_to_model.py +0 -0
  16. {ommx_python_mip_adapter-0.5.0 → ommx_python_mip_adapter-1.0.0}/tests/test_integration.py +0 -0
  17. {ommx_python_mip_adapter-0.5.0 → ommx_python_mip_adapter-1.0.0}/tests/test_model_to_instance.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ommx_python_mip_adapter
3
- Version: 0.5.0
3
+ Version: 1.0.0
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-python-mip-adapter
@@ -10,13 +10,12 @@ Classifier: Programming Language :: Python :: 3.8
10
10
  Classifier: Programming Language :: Python :: 3.9
11
11
  Classifier: Programming Language :: Python :: 3.10
12
12
  Classifier: Programming Language :: Python :: 3.11
13
- Classifier: Programming Language :: Python :: 3.12
14
13
  Classifier: License :: OSI Approved :: Apache Software License
15
14
  Classifier: License :: OSI Approved :: MIT License
16
15
  Requires-Python: >=3.8
17
16
  Description-Content-Type: text/markdown
18
- Requires-Dist: ommx<0.6.0,>=0.5.0
19
- Requires-Dist: mip
17
+ Requires-Dist: ommx<2.0.0,>=1.0.0
18
+ Requires-Dist: mip<2.0.0,>=1.15.0
20
19
  Provides-Extra: dev
21
20
  Requires-Dist: markdown-code-runner; extra == "dev"
22
21
  Requires-Dist: mypy; extra == "dev"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ommx_python_mip_adapter
3
- Version: 0.5.0
3
+ Version: 1.0.0
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-python-mip-adapter
@@ -10,13 +10,12 @@ Classifier: Programming Language :: Python :: 3.8
10
10
  Classifier: Programming Language :: Python :: 3.9
11
11
  Classifier: Programming Language :: Python :: 3.10
12
12
  Classifier: Programming Language :: Python :: 3.11
13
- Classifier: Programming Language :: Python :: 3.12
14
13
  Classifier: License :: OSI Approved :: Apache Software License
15
14
  Classifier: License :: OSI Approved :: MIT License
16
15
  Requires-Python: >=3.8
17
16
  Description-Content-Type: text/markdown
18
- Requires-Dist: ommx<0.6.0,>=0.5.0
19
- Requires-Dist: mip
17
+ Requires-Dist: ommx<2.0.0,>=1.0.0
18
+ Requires-Dist: mip<2.0.0,>=1.15.0
20
19
  Provides-Extra: dev
21
20
  Requires-Dist: markdown-code-runner; extra == "dev"
22
21
  Requires-Dist: mypy; extra == "dev"
@@ -9,6 +9,7 @@ ommx_python_mip_adapter.egg-info/SOURCES.txt
9
9
  ommx_python_mip_adapter.egg-info/dependency_links.txt
10
10
  ommx_python_mip_adapter.egg-info/requires.txt
11
11
  ommx_python_mip_adapter.egg-info/top_level.txt
12
+ tests/test_constant_constraint.py
12
13
  tests/test_instance_to_model.py
13
14
  tests/test_integration.py
14
15
  tests/test_model_to_instance.py
@@ -1,5 +1,5 @@
1
- ommx<0.6.0,>=0.5.0
2
- mip
1
+ ommx<2.0.0,>=1.0.0
2
+ mip<2.0.0,>=1.15.0
3
3
 
4
4
  [dev]
5
5
  markdown-code-runner
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "ommx_python_mip_adapter"
7
- version = "0.5.0"
7
+ version = "1.0.0"
8
8
 
9
9
  description = "An adapter for the Python-MIP from/to OMMX."
10
10
  authors = [
@@ -19,13 +19,15 @@ classifiers = [
19
19
  "Programming Language :: Python :: 3.9",
20
20
  "Programming Language :: Python :: 3.10",
21
21
  "Programming Language :: Python :: 3.11",
22
- "Programming Language :: Python :: 3.12",
23
22
  "License :: OSI Approved :: Apache Software License",
24
23
  "License :: OSI Approved :: MIT License",
25
24
  ]
26
25
  dependencies = [
27
- "ommx >= 0.5.0, < 0.6.0",
28
- "mip",
26
+ "ommx >= 1.0.0, < 2.0.0",
27
+
28
+ # FIXME: This project requires latest version of Python-MIP (will be 1.16.0?), which does not release yet.
29
+ # https://github.com/coin-or/python-mip/issues/384
30
+ "mip >= 1.15.0, < 2.0.0",
29
31
  ]
30
32
 
31
33
  [project.urls]
@@ -0,0 +1,47 @@
1
+ import ommx_python_mip_adapter as adapter
2
+ from ommx.v1 import Instance, DecisionVariable, Linear
3
+ import pytest
4
+
5
+
6
+ @pytest.mark.skip(
7
+ reason="This test causes a segfault due to a bug in the Python-MIP fixed in https://github.com/coin-or/python-mip/pull/237, which is not yet released."
8
+ )
9
+ def test_constant_constraint_feasible():
10
+ x = DecisionVariable.continuous(0)
11
+ instance = Instance.from_components(
12
+ decision_variables=[x],
13
+ objective=x,
14
+ constraints=[
15
+ # 1 >= 0 is always true
16
+ Linear(terms={}, constant=1) >= 0,
17
+ x <= 1,
18
+ ],
19
+ sense=Instance.MAXIMIZE,
20
+ )
21
+ result = adapter.solve(instance)
22
+ assert result.HasField("solution")
23
+
24
+ solution = result.solution
25
+ assert solution.state.entries == {0: 1.0}
26
+ assert solution.objective == 1.0
27
+
28
+ assert len(solution.evaluated_constraints) == 2
29
+
30
+
31
+ @pytest.mark.skip(
32
+ reason="This test causes a segfault due to a bug in the Python-MIP fixed in https://github.com/coin-or/python-mip/pull/237, which is not yet released."
33
+ )
34
+ def test_constant_constraint_infeasible():
35
+ x = DecisionVariable.continuous(0)
36
+ instance = Instance.from_components(
37
+ decision_variables=[x],
38
+ objective=x,
39
+ constraints=[
40
+ # -1 >= 0 is always false
41
+ Linear(terms={}, constant=-1) >= 0,
42
+ x <= 1,
43
+ ],
44
+ sense=Instance.MAXIMIZE,
45
+ )
46
+ result = adapter.solve(instance)
47
+ assert result.HasField("infeasible")