ommx_openjij_adapter
Functions
|
Convert OpenJij's Response to ommx.v1.Samples |
|
Sampling QUBO with Simulated Annealing (SA) by [openjij.SASampler](https://openjij.github.io/OpenJij/reference/openjij/index.html#openjij.SASampler) |
Package Contents
- ommx_openjij_adapter.response_to_samples(response: openjij.Response) ommx.v1.Samples
Convert OpenJij’s Response to ommx.v1.Samples
- ommx_openjij_adapter.sample_qubo_sa(instance: ommx.v1.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) ommx.v1.Samples
Sampling QUBO with Simulated Annealing (SA) by [openjij.SASampler](https://openjij.github.io/OpenJij/reference/openjij/index.html#openjij.SASampler)
The input instance must be a QUBO (Quadratic Unconstrained Binary Optimization) problem, i.e.
Every decision variables are binary
No constraint
Objective function is quadratic
Minimization problem
You can convert a problem to QUBO via [ommx.v1.Instance.penalty_method](https://jij-inc.github.io/ommx/python/ommx/autoapi/ommx/v1/index.html#ommx.v1.Instance.penalty_method) or other corresponding method.
- Parameters:
instance – ommx.v1.Instance representing a QUBO problem
beta_min – minimal value of inverse temperature
beta_max – maximum value of inverse temperature
num_sweeps – number of sweeps
num_reads – number of reads
schedule – list of inverse temperature
initial_state – initial state
updater – updater algorithm
sparse – use sparse matrix or not.
reinitialize_state – if true reinitialize state for each run
seed – seed for Monte Carlo algorithm
Note that this is a simple wrapper function for openjij.SASampler.sample_qubo method. For more advanced usage, you can use ommx.v1.Instance.as_qubo_format to get QUBO matrix, and use OpenJij manually, and convert the openjij.Response via response_to_samples function.