Metadata-Version: 2.5
Name: ommx-qiskit-opt-mapper-adapter
Version: 0.1.0
Summary: Bidirectional translation between OMMX and Qiskit Addon Opt Mapper
Project-URL: Repository, https://github.com/Jij-Inc/ommx-qiskit-opt-mapper-adapter
Project-URL: Issues, https://github.com/Jij-Inc/ommx-qiskit-opt-mapper-adapter/issues
Author-email: "Jij Inc." <info@j-ij.com>
License-Expression: Apache-2.0
License-File: LICENSE
Keywords: adapter,ommx,optimization,qiskit
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Mathematics
Requires-Python: >=3.10
Requires-Dist: ommx<3.0.0,>=2.6.1
Requires-Dist: qiskit-addon-opt-mapper<0.2.0,>=0.1.0
Description-Content-Type: text/markdown

# OMMX Qiskit Opt Mapper Adapter

Bidirectional, semantics-preserving translation between
[OMMX](https://github.com/Jij-Inc/ommx) and
[Qiskit Addon Opt Mapper](https://github.com/Qiskit/qiskit-addon-opt-mapper).

## Installation

Published releases can be installed with:

```bash
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

```python
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:

```python
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](https://github.com/Jij-Inc/ommx-qiskit-opt-mapper-adapter/blob/main/docs/design.md)
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](https://github.com/Jij-Inc/ommx-qiskit-opt-mapper-adapter/blob/main/CONTRIBUTING.md)
for the contribution workflow and
[SECURITY.md](https://github.com/Jij-Inc/ommx-qiskit-opt-mapper-adapter/blob/main/SECURITY.md)
for private vulnerability reporting.

```bash
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.
