Skip to main content
Pre-release

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

ommx-openjij-adapter

Provides an adapter between OMMX and OpenJij.

Usage

ommx-openjij-adapter can be installed from PyPI:

pip install ommx-openjij-adapter

OpenJij directly accepts a Binary, unconstrained minimization model through this adapter. Prepare a constrained model explicitly before sampling it:

from ommx import DecisionVariable, Instance
from ommx_openjij_adapter import (
    OMMXOpenJijSAAdapter,
    OpenJijPreparationConfig,
)

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

config = OpenJijPreparationConfig(
    uniform_penalty_weight=2.0,
)
prepared = OMMXOpenJijSAAdapter.prepare(instance, config=config)

prepared_samples = OMMXOpenJijSAAdapter.sample(
    prepared.input,
    num_reads=16,
)
sample_set = prepared.evaluate_source(prepared_samples)

print(sample_set.summary)

The finite penalty weight is a field of the OpenJijPreparationConfig passed to prepare through config=, not an OpenJij backend sampler parameter. It must be chosen explicitly when constraints remain after exact preparation. A finite penalty does not guarantee that every returned sample is feasible for the source model; inspect the feasibility recorded in the decoded SampleSet.

Input class and explicit preparation

OMMXOpenJijSAAdapter.INPUT_CLASS describes the instances that the adapter accepts directly:

  • Binary decision variables
  • a polynomial objective of any degree (QUBO or Binary HUBO)
  • no active regular or special constraints
  • minimization

OMMXOpenJijSAAdapter.check_applicability() checks whether an instance belongs to this input class and satisfies the adapter-specific preconditions. It does not include preparation that the adapter can perform first. Integer log-encoding, maximization-to-minimization conversion, exact lowering of Indicator/OneHot/SOS1 constraints, integer slack, and finite constraint penalties are explicit preparation operations provided by check_preparation() and prepare().

sample() and solve() keep the common adapter contract and accept an Instance only. Explicit preparation therefore returns an OpenJijPreparation: pass its input Instance to the adapter, then use evaluate_source() to evaluate the resulting samples against the source model. The preparation itself is not an Adapter input. The report's config field records the normalized, immutable preparation settings actually used. The remaining fields represent one of four terminal states:

State source_check preparation_failures input_applicability
Source rejected outside the preparation source class empty None
Phase rejected accepted non-empty, with the owning operation None
Candidate rejected accepted empty non-applicable report
Success accepted empty applicable report

source_check is structural source-class membership. Operation availability and preparation policy are checked by the phase that owns them and appear in preparation_failures. steps is the prefix of OpenJij-specific operations that completed before the terminal state; it is an operation audit, not a separate outcome or a composed mathematical guarantee. Common preparation policy, guarantees, and automatic selection are tracked in OMMX issue #1111. By default, this prototype applies only the available exact operations. Discrete integer slack approximation requires setting allow_approximate_integer_slack=True on OpenJijPreparationConfig; setting inequality_integer_slack_max_range alone does not opt into approximation. Finite penalties remain an explicit operation selected through uniform_penalty_weight or penalty_weights on that Config, and do not assert exact constrained support.

Per-constraint penalty weights use regular constraint IDs. A model containing Indicator, OneHot, or SOS1 constraints must therefore use a uniform penalty weight after their exact lowering.

If variable bounds prove an inequality infeasible, check_preparation() and prepare() raise the core-owned ommx.InfeasibleDetected instead of reporting an adapter limitation. ommx.adapter.InfeasibleDetected remains an alias for the same exception object.

The maximum of 53 auxiliary bits checked for each used Integer variable is an availability limit of OMMX's Integer-to-Binary log-encoding operation. It is neither a property of the OpenJij adapter's input class nor an ommx.v2.Feature. The latter is a wire-format forward-compatibility gate that tells readers which serialized semantics they must understand; an adapter's input class and preconditions determine its applicability to an in-memory Instance.

OMMX does not yet implement Kind::Spin. Its addition, including direct OpenJij Spin input, is tracked separately in OMMX issue #1082.

Download files

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

Source Distribution

ommx_openjij_adapter-3.0.0b2.tar.gz (29.0 kB view details)

Uploaded Source

File details

Details for the file ommx_openjij_adapter-3.0.0b2.tar.gz.

File metadata

  • Download URL: ommx_openjij_adapter-3.0.0b2.tar.gz
  • Upload date:
  • Size: 29.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for ommx_openjij_adapter-3.0.0b2.tar.gz
Algorithm Hash digest
SHA256 36e7754a391f957e442cf9902fec754252456282e2a2cb3eaef635be24510e2c
MD5 5b30c13694535084a25e1ab3141275de
BLAKE2b-256 5c22791de5ffd6ea8833e27865c5dfea9de478c06a84018c7c0ed6d91c196a1a

See more details on using hashes here.

Provenance

The following attestation bundles were made for ommx_openjij_adapter-3.0.0b2.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.0b2 This release

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

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