Metadata-Version: 2.4
Name: ommx_openjij_adapter
Version: 3.0.0rc1
Summary: OMMX Adapter for OpenJij.
Author-email: "Jij Inc." <info@j-ij.com>
Project-URL: Documentation, https://jij-inc-ommx.readthedocs-hosted.com/en/latest/autoapi/ommx_openjij_adapter/index.html
Project-URL: Repository, https://github.com/Jij-Inc/ommx
Project-URL: Issues, https://github.com/Jij-Inc/ommx/issues
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: License :: OSI Approved :: Apache Software License
Classifier: License :: OSI Approved :: MIT License
Requires-Python: >=3.11
Description-Content-Type: text/markdown
Requires-Dist: ommx<4.0.0,>=3.0.0rc1
Requires-Dist: openjij<1.0.0,>=0.9.2

# OMMX adapter for OpenJij

Sample candidate assignments with [OpenJij](https://www.openjij.org/) and evaluate them against the OMMX problem. You choose the penalty weights when constraints are converted to penalties.

[Installation from a prerelease or `main`](https://jij-inc-ommx.readthedocs-hosted.com/en/latest/getting_started/install.html#install-openjij-adapter) · [日本語の導入手順](https://jij-inc-ommx.readthedocs-hosted.com/ja/latest/getting_started/install.html#install-openjij-adapter)

In v3, `SampleSet.objectives` reports the original objective. Penalties affect the sampling energy, so code that used the v2 objective values as penalized energies must account for that change.

## Sample a constrained problem

```python markdown-code-runner
from ommx import DecisionVariable, FixedPenaltyPreparation, Instance, Sense
from ommx_openjij_adapter import OMMXOpenJijSAAdapter

x = DecisionVariable.binary(0, name="x")
instance = Instance.from_components(
    decision_variables=[x],
    objective=x,
    active_constraints={0: x == 1},
    sense=Sense.Minimize,
)

policy = OMMXOpenJijSAAdapter.recommended_preparation_policy()
policy.fixed_penalty = FixedPenaltyPreparation.uniform_penalty_method_with_fixed_weight(
    weight=2.0
)
instance.prepare(OMMXOpenJijSAAdapter.INPUT_CLASS, policy)

sample_set = OMMXOpenJijSAAdapter.sample_without_preparation(
    instance,
    num_reads=16,
)
print(sample_set.summary)
```

## Reference

[OpenJij adapter API](https://jij-inc-ommx.readthedocs-hosted.com/en/latest/autoapi/ommx_openjij_adapter/index.html#ommx_openjij_adapter.OMMXOpenJijSAAdapter) · [日本語サイトのAPI Reference](https://jij-inc-ommx.readthedocs-hosted.com/ja/latest/autoapi/ommx_openjij_adapter/index.html#ommx_openjij_adapter.OMMXOpenJijSAAdapter)

The adapter reference above describes supported inputs and explicit preparation, including which variable IDs to supply when passing an initial state. The [Book chapter on choosing a formulation](https://jij-inc-ommx.readthedocs-hosted.com/en/latest/book/transform_and_solve.html) explains when to keep or convert a constraint.
