ommx_openjij_adapter#
Classes#
Sampling QUBO or HUBO with Simulated Annealing (SA) by openjij.SASampler |
Functions#
|
Convert openjij.Response to |
|
Deprecated: renamed to |
|
Deprecated: Use |
Package Contents#
- class OMMXOpenJijSAAdapter(ommx_instance: Instance, *, beta_min: float | None = None, beta_max: float | None = None, num_sweeps: int | None = None, num_reads: int | None = None, schedule: list | None = None, initial_state: list | dict | None = None, updater: str | None = None, sparse: bool | None = None, reinitialize_state: bool | None = None, seed: int | None = None, uniform_penalty_weight: float | None = None, penalty_weights: dict[int, float] = {}, inequality_integer_slack_max_range: int = 32)#
Sampling QUBO or HUBO with Simulated Annealing (SA) by openjij.SASampler
- decode_to_samples(data: openjij.Response) Samples#
Convert openjij.Response to
SamplesThere is a static method
decode_to_samples()that does the same thing.
- classmethod sample(ommx_instance: Instance, *, beta_min: float | None = None, beta_max: float | None = None, num_sweeps: int | None = None, num_reads: int | None = None, schedule: list | None = None, initial_state: list | dict | None = None, updater: str | None = None, sparse: bool | None = None, reinitialize_state: bool | None = None, seed: int | None = None, uniform_penalty_weight: float | None = None, penalty_weights: dict[int, float] = {}, inequality_integer_slack_max_range: int = 32) SampleSet#
- classmethod solve(ommx_instance: Instance, *, beta_min: float | None = None, beta_max: float | None = None, num_sweeps: int | None = None, num_reads: int | None = None, schedule: list | None = None, initial_state: list | dict | None = None, updater: str | None = None, sparse: bool | None = None, reinitialize_state: bool | None = None, seed: int | None = None, uniform_penalty_weight: float | None = None, penalty_weights: dict[int, float] = {}, inequality_integer_slack_max_range: int = 32, diagnostics: DiagnosticsSink | None = None) Solution#
Solve an OMMX instance.
Run.log_solveowns the reserveddiagnosticskeyword and passes a sink to every adapter. Adapters may record adapter-defined dataclass diagnostics into the sink during the solve; leaving it empty means no diagnostics are stored. Adapters do not need to catch exceptions raised by a non-conforming diagnostics sink.
- ADDITIONAL_CAPABILITIES: frozenset[AdditionalCapability]#
- inequality_integer_slack_max_range: int = 32#
Max range for integer slack variables in inequality constraints, passed to
Instance.to_quboorInstance.to_hubo
- ommx_instance: Instance#
ommx.v1.Instance representing a QUBO or HUBO problem
The input instance must be a QUBO (Quadratic Unconstrained Binary Optimization) or HUBO (Higher-order Unconstrained Binary Optimization) problem, i.e.
All decision variables are binary
No constraints
Objective function is quadratic (QUBO) or higher (HUBO).
Minimization problem
You can convert an instance to QUBO or HUBO via
ommx.v1.Instance.penalty_method()or other corresponding method.
- penalty_weights: dict[int, float]#
Penalty weights for each constraint, passed to
Instance.to_quboorInstance.to_hubo
- reinitialize_state: bool | None = None#
if true reinitialize state for each run (parameter only used if problem is QUBO)
- decode_to_samples(response: openjij.Response) Samples#
Convert openjij.Response to
Samples
- response_to_samples(response: openjij.Response) Samples#
Deprecated: renamed to
decode_to_samples()
- sample_qubo_sa(instance: Instance, *, beta_min: float | None = None, beta_max: float | None = None, num_sweeps: int | None = None, num_reads: int | None = None, schedule: list | None = None, initial_state: list | dict | None = None, updater: str | None = None, sparse: bool | None = None, reinitialize_state: bool | None = None, seed: int | None = None) Samples#
Deprecated: Use
OMMXOpenJijSAAdapter.sample()instead