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) | |
![]() | |
parameters (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) |
![]() | |
sample_qubo (self, Q, **parameters) | |
Protected Member Functions | |
_get_result (self, system, model) | |
![]() | |
_convert_validation_schedule (self, schedule, beta) | |
_annealing_schedule_setting (self, model, beta=None, gamma=None, num_sweeps=None, schedule=None) | |
![]() | |
_set_params (self, **kwargs) | |
_sampling (self, **kwargs) | |
_cxxjij_sampling (self, model, init_generator, algorithm, system, reinitialize_state=None, seed=None, offset=None) | |
Protected Attributes | |
_default_params | |
![]() | |
_default_params | |
_params | |
_make_system | |
_algorithm | |
Static Protected Attributes | |
_params | |
Additional Inherited Members | |
![]() | |
schedule_info | |
![]() | |
sample_qubo | |
![]() | |
properties = dict() | |
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 |
|||
) |
Reimplemented from openjij.sampler.sqa_sampler.SQASampler.
|
protected |
Reimplemented from openjij.sampler.sqa_sampler.SQASampler.
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(), openjij.sampler.csqa_sampler.CSQASampler._params, openjij.sampler.sa_sampler.SASampler._params, openjij.sampler.sqa_sampler.SQASampler._params, openjij.sampler.sampler.BaseSampler._set_params(), openjij.sampler.sa_sampler.SASampler.schedule_info, and openjij.sampler.sqa_sampler.SQASampler.schedule_info.
|
protected |
Referenced by openjij.sampler.sampler.BaseSampler._set_params().
|
staticprotected |
Referenced by openjij.sampler.sqa_sampler.SQASampler._annealing_schedule_setting(), openjij.sampler.sa_sampler.SASampler._sample_hubo_old(), openjij.sampler.sampler.BaseSampler._set_params(), openjij.sampler.sa_sampler.SASampler.sample(), openjij.sampler.sqa_sampler.SQASampler.sample(), and openjij.sampler.csqa_sampler.CSQASampler.sample_ising().