|
openjij
Framework for the Ising model and QUBO.
|


Public Member Functions | |
| __init__ (self, beta=5.0, gamma=1.0, num_sweeps=1000, schedule=None, num_reads=1) | |
| sample_ising (self, h, J, float beta=5.0, float gamma=1.0, int num_sweeps=1000, schedule=None, int num_reads=1, initial_state=None, updater=None, reinitialize_state=True, seed=None) | |
| Public Member Functions inherited from openjij.sampler.sqa_sampler.SQASampler | |
| parameters (self) | |
| __init__ (self) | |
| "openjij.sampler.response.Response" | sample (self, Union["openjij.model.model.BinaryQuadraticModel", dimod.BinaryQuadraticModel] bqm, Optional[float] beta=None, Optional[float] gamma=None, Optional[int] num_sweeps=None, Optional[list] schedule=None, Optional[int] trotter=None, Optional[int] num_reads=None, Optional[Union[list, dict]] initial_state=None, Optional[str] updater=None, Optional[bool] sparse=None, Optional[bool] reinitialize_state=None, Optional[int] seed=None, *, Optional[float] beta_min=None, Optional[float] beta_max=None, Optional[float] coupling_min=None, Optional[float] coupling_max=None, Optional[int] num_threads=None) |
| Public Member Functions inherited from openjij.sampler.sampler.BaseSampler | |
| sample_qubo (self, Q, **parameters) | |
Protected Member Functions | |
| _get_result (self, system, model) | |
| Protected Member Functions inherited from openjij.sampler.sqa_sampler.SQASampler | |
| _convert_validation_schedule (self, schedule, beta) | |
| _parallel_sampling (self, model, ising_graph, init_generator, make_system, algorithm, gamma, reinitialize_state, read_seeds, num_threads) | |
| _annealing_schedule_setting (self, model, beta=None, gamma=None, num_sweeps=None, schedule=None) | |
| Protected Member Functions inherited from openjij.sampler.sampler.BaseSampler | |
| _set_params (self, **kwargs) | |
| _sampling (self, **kwargs) | |
| _cxxjij_sampling (self, model, init_generator, algorithm, system, reinitialize_state=None, seed=None, offset=None, *, read_seeds=None) | |
Additional Inherited Members | |
| Public Attributes inherited from openjij.sampler.sqa_sampler.SQASampler | |
| dict | schedule_info = {"schedule": "custom schedule"} |
| Public Attributes inherited from openjij.sampler.sampler.BaseSampler | |
| sample_qubo | |
| Static Public Attributes inherited from openjij.sampler.sampler.BaseSampler | |
| properties = dict() | |
| Protected Attributes inherited from openjij.sampler.sqa_sampler.SQASampler | |
| _params = dict(self._default_params) | |
| dict | _make_system |
| dict | _algorithm |
| Protected Attributes inherited from openjij.sampler.sampler.BaseSampler | |
| _default_params | |
Sampler with continuous-time simulated quantum annealing (CSQA) using
Hamiltonian.
.. math::
H(s) = s H_p + \\Gamma (1-s)\\sum_i \\sigma_i^x
where :math:`H_p` is the problem Hamiltonian we want to solve.
Args:
beta (float): Inverse temperature.
gamma (float): Amplitude of quantum fluctuation.
schedule (list): schedule list
step_num (int): Number of Monte Carlo step.
schedule_info (dict): Information about a annealing schedule.
num_reads (int): Number of iterations.
num_sweeps (int): number of sweeps
schedule_info (dict): Information about a annealing schedule.
| openjij.sampler.csqa_sampler.CSQASampler.__init__ | ( | self, | |
| beta = 5.0, | |||
| gamma = 1.0, | |||
| num_sweeps = 1000, | |||
| schedule = None, | |||
| num_reads = 1 ) |
|
protected |
Reimplemented from openjij.sampler.sqa_sampler.SQASampler.
Referenced by openjij.sampler.sqa_sampler.SQASampler._parallel_sampling().

| openjij.sampler.csqa_sampler.CSQASampler.sample_ising | ( | self, | |
| h, | |||
| J, | |||
| float | beta = 5.0, | ||
| float | gamma = 1.0, | ||
| int | num_sweeps = 1000, | ||
| schedule = None, | |||
| int | num_reads = 1, | ||
| initial_state = None, | |||
| updater = None, | |||
| reinitialize_state = True, | |||
| seed = None ) |
Sampling from the Ising model.
Args:
h (dict): linear biases
J (dict): quadratic biases
beta (float, optional): inverse temperature
gamma (float, optional): strength of transverse field
num_sweeps (int, optional): number of sampling.
schedule (list, optional): schedule list
num_reads (int, optional): number of iterations
initial_state (optional): initial state of spins
updater (str, optional): updater algorithm
reinitialize_state (bool, optional): Re-initilization at each sampling. Defaults to True.
seed (int, optional): Sampling seed.
Returns:
:class:`openjij.sampler.response.Response`: results
Examples:
for Ising case::
>>> h = {0: -1, 1: -1, 2: 1, 3: 1}
>>> J = {(0, 1): -1, (3, 4): -1}
>>> sampler = openjij.CSQASampler()
>>> res = sampler.sample_ising(h, J)
for QUBO case::
>>> Q = {(0, 0): -1, (1, 1): -1, (2, 2): 1, (3, 3): 1, (4, 4): 1, (0, 1): -1, (3, 4): 1}
>>> sampler = openjijj.CSQASampler()
>>> res = sampler.sample_qubo(Q)
Reimplemented from openjij.sampler.sampler.BaseSampler.
References openjij.sampler.sqa_sampler.SQASampler._annealing_schedule_setting(), openjij.sampler.sampler.BaseSampler._cxxjij_sampling(), _params, openjij.sampler.sampler.BaseSampler._set_params(), openjij.sampler.sa_sampler.SASampler.schedule_info, and openjij.sampler.sqa_sampler.SQASampler.schedule_info.
