openjij
Framework for the Ising model and QUBO.
Loading...
Searching...
No Matches
openjij.sampler.csqa_sampler.CSQASampler Class Reference
Inheritance diagram for openjij.sampler.csqa_sampler.CSQASampler:
Collaboration diagram for openjij.sampler.csqa_sampler.CSQASampler:

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)
 
"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)
 
- 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)
 
 _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)
 

Protected Attributes

 _default_params
 
- Protected Attributes inherited from openjij.sampler.sqa_sampler.SQASampler
 _default_params
 
 _params
 
 _make_system
 
 _algorithm
 

Static Protected Attributes

 _params
 

Additional Inherited Members

- Public Attributes inherited from openjij.sampler.sqa_sampler.SQASampler
 schedule_info
 
- Public Attributes inherited from openjij.sampler.sampler.BaseSampler
 sample_qubo
 
- Static Public Attributes inherited from openjij.sampler.sampler.BaseSampler
 properties = dict()
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ __init__()

openjij.sampler.csqa_sampler.CSQASampler.__init__ (   self,
  beta = 5.0,
  gamma = 1.0,
  num_sweeps = 1000,
  schedule = None,
  num_reads = 1 
)

Member Function Documentation

◆ _get_result()

openjij.sampler.csqa_sampler.CSQASampler._get_result (   self,
  system,
  model 
)
protected

◆ sample_ising()

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.

Here is the call graph for this function:

Member Data Documentation

◆ _default_params

openjij.sampler.csqa_sampler.CSQASampler._default_params
protected

◆ _params


The documentation for this class was generated from the following file: