Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

OMMX adapter for Python-MIP

PyPI - Version

This package provides an adapter for the Python-MIP from/to OMMX

Python-MIP as a solver in OMMX toolchain

sequenceDiagram
    participant U as User
    participant A as Adapter
    participant P as Python-MIP
    U->>A: ommx.Instance
    A->>U: Python-MIP model
    U->>P: Python-MIP model and Parameters for Python-MIP;
    P->>P: Solve with CBC, Gurobi, or other solvers
    P->>U: Optimized model
    U->>A: Optimized model and ommx.Instance
    A->>U: ommx.Solution

Python-MIP as a user interface to create OMMX instance

sequenceDiagram
    participant U as User
    participant A as Adapter
    participant O as Other OMMX toolchain
    U->>A: Python-MIP model
    A->>U: ommx.Instance
    U->>O: ommx.Instance and Parameters for other solver
    O->>O: Solve the instance with other solver using other adapter
    O->>U: ommx.Solution

Usage

ommx-python-mip-adapter can be installed from PyPI as follows:

pip install ommx-python-mip-adapter

Python-MIP can be used through ommx-python-mip-adapter by using the following:

from ommx_python_mip_adapter import OMMXPythonMIPAdapter
from ommx import Instance, DecisionVariable

x1 = DecisionVariable.integer(1, lower=0, upper=5)
ommx_instance = Instance.from_components(
    decision_variables=[x1],
    objective=x1,
    constraints={},
    sense=Instance.MINIMIZE,
)

# Create `ommx.Solution` from the `mip.Model`
ommx_solution = OMMXPythonMIPAdapter.solve(ommx_instance)

print(ommx_solution)

You can get ommx.Instance from a Python-MIP model as the following:

import mip
import ommx_python_mip_adapter as adapter

model = mip.Model()
x1 = model.add_var(name="1", var_type=mip.INTEGER, lb=0, ub=5)
x2 = model.add_var(name="2", var_type=mip.CONTINUOUS, lb=0, ub=5)
model.objective = -x1 - 2 * x2
model.add_constr(x1 + x2 - 6 <= 0)

ommx_instance = adapter.model_to_instance(model)

print(ommx_instance)

Reference

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ommx_python_mip_adapter-3.0.0b4.tar.gz (13.4 kB view details)

Uploaded Source

File details

Details for the file ommx_python_mip_adapter-3.0.0b4.tar.gz.

File metadata

File hashes

Hashes for ommx_python_mip_adapter-3.0.0b4.tar.gz
Algorithm Hash digest
SHA256 7c31d0799237395e476e5bf9ec8b32f710b4cdde858f58ea2175959d53040c96
MD5 73445b2594606bc7a0f45c5d5b12d8b4
BLAKE2b-256 6f182a1cc4ec9f8d2e338936a527254b64bf0680b74f2ea01f94373c7cf3809b

See more details on using hashes here.

Provenance

The following attestation bundles were made for ommx_python_mip_adapter-3.0.0b4.tar.gz:

Publisher: release_python.yml on Jij-Inc/ommx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

3.0.0b4 This release

1 file

2.6.3

1 file

2.6.2

1 file

2.6.1

1 file

2.6.0

1 file

2.5.2

1 file

2.5.1

1 file

2.5.0

1 file

2.4.0

1 file

2.3.6

1 file

2.3.5

1 file

2.3.4

1 file

2.3.3

1 file

2.3.2

1 file

2.3.1

1 file

2.3.0

1 file

2.2.0

1 file

2.1.0

1 file

2.0.12

1 file

2.0.11

1 file

2.0.10

1 file

2.0.9

1 file

2.0.8

1 file

2.0.7

1 file

2.0.6

1 file

2.0.5

1 file

2.0.4

1 file

2.0.3

1 file

2.0.2

1 file

2.0.1

1 file

2.0.0

1 file

1.9.5

1 file

1.9.4

1 file

1.9.3

1 file

1.9.2

1 file

1.9.1

1 file

1.9.0

1 file

1.8.6

1 file

1.8.5

1 file

1.8.4

1 file

1.8.3

1 file

1.8.2

1 file

1.8.1

1 file

1.8.0

1 file

1.7.0

1 file

1.6.1

1 file

1.6.0

1 file

1.5.1

1 file

1.5.0

1 file

1.4.4

1 file

1.4.3

1 file

1.4.2

1 file

1.4.0

1 file

1.3.2

1 file

1.3.1

1 file

1.3.0

1 file

1.2.1

1 file

1.2.0

1 file

1.1.1

1 file

1.1.0

1 file

1.0.1

1 file

1.0.0

1 file

0.5.0

1 file

0.4.1

1 file

0.4.0

1 file

0.3.4

1 file

0.1.1

1 file

0.1.0

1 file

0.0.2

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page