Skip to main content

OMMX Qiskit Opt Mapper Adapter

Bidirectional, semantics-preserving translation between OMMX and Qiskit Addon Opt Mapper.

Installation

Published releases can be installed with:

pip install ommx-qiskit-opt-mapper-adapter

This adapter targets OMMX 2 exclusively and requires ommx>=2.6.1,<3.0.0. It supports the published Opt Mapper 0.1 release series and requires qiskit-addon-opt-mapper>=0.1.0,<0.2.0.

This is an independent adapter maintained by Jij Inc. It is not an official Qiskit project.

Usage

from qiskit_addon_opt_mapper import OptimizationProblem
from ommx_qiskit_opt_mapper_adapter import from_ommx, to_ommx

problem = OptimizationProblem("example")
problem.binary_var("x")
problem.integer_var(0, 5, "y")
problem.maximize(constant=1, linear={"x": 2}, quadratic={("x", "y"): 1})
problem.linear_constraint({"x": 1, "y": 1}, "<=", 4, "capacity")

instance = to_ommx(problem)
restored_problem = from_ommx(instance)

You can also use the namespace-style facade:

from ommx_qiskit_opt_mapper_adapter import OMMXQiskitOptMapperAdapter

restored_problem = OMMXQiskitOptMapperAdapter.from_ommx(instance)

Supported model features

Feature OMMX → Opt Mapper Opt Mapper → OMMX
Binary variables Yes Yes
Integer variables and representable bounds Yes Yes
Continuous variables and representable bounds Yes Yes
Native unbounded variables Yes Yes
Minimize / maximize Yes Yes
Polynomial objective of any order Yes Yes
Polynomial equality / inequality constraints Yes Yes
Arbitrary OMMX variable / constraint IDs Preserved Restored
Names, subscripts, parameters, descriptions Preserved as metadata Restored
Spin variables N/A Explicit error
Semi-integer / semi-continuous variables Explicit error N/A

The adapter never silently approximates an unsupported domain or constraint. See the design notes for normalization and metadata details. Finite OMMX bounds whose absolute value is at least 1e20 are rejected because Opt Mapper reserves that range as its representation of infinity.

Development

See CONTRIBUTING.md for the contribution workflow and SECURITY.md for private vulnerability reporting.

uv sync --group dev
uv run pytest --cov
uv run mypy src
uv run ruff check .
uv run ruff format --check .

License

Apache License 2.0.

Download files

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

Source Distribution

ommx_qiskit_opt_mapper_adapter-0.1.0.tar.gz (183.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file ommx_qiskit_opt_mapper_adapter-0.1.0.tar.gz.

File metadata

File hashes

Hashes for ommx_qiskit_opt_mapper_adapter-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c5a12be41703e19389bae128a8d82ed9dc9a2002bab72348292cbab8ee6ef25f
MD5 a47a86906a0e0ce2229ddbe30e9e6bb3
BLAKE2b-256 893974303dfdab5cc538e2f22fbf08f3d5c9dd3ecaacd876a1d9e7b73aec3685

See more details on using hashes here.

Provenance

The following attestation bundles were made for ommx_qiskit_opt_mapper_adapter-0.1.0.tar.gz:

Publisher: publish.yml on Jij-Inc/ommx-qiskit-opt-mapper-adapter

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

File details

Details for the file ommx_qiskit_opt_mapper_adapter-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ommx_qiskit_opt_mapper_adapter-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e47840feebaf810d03e29692a1b423d69b99631170f47a84586aca4fc1a9909a
MD5 2251acab6272c861562c0f922c716a54
BLAKE2b-256 3f5519c9b119eafebbaf46124da72bf45b39dd92cc1804bdaeb2b5e4f705349f

See more details on using hashes here.

Provenance

The following attestation bundles were made for ommx_qiskit_opt_mapper_adapter-0.1.0-py3-none-any.whl:

Publisher: publish.yml on Jij-Inc/ommx-qiskit-opt-mapper-adapter

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

0.1.0 This release

2 files

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