openjij.sampler.sampler#
This module defines the abstract sampler (BaseSampler).
Classes#
Base sampler class of python wrapper for cxxjij simulator. |
Functions#
|
Decorator for measuring calculation time. |
Module Contents#
- class openjij.sampler.sampler.BaseSampler[source]#
Bases:
dimod.Sampler
Base sampler class of python wrapper for cxxjij simulator.
- remove_unknown_kwargs(**kwargs) Dict[str, Any] #
Remove with warnings any keyword arguments not accepted by the sampler.
- Parameters:
**kwargs – Keyword arguments to be validated.
- Return type:
Dict[str, Any]
Returns: Updated kwargs dict.
Examples
>>> import warnings >>> sampler = dimod.RandomSampler() >>> with warnings.catch_warnings(): ... warnings.filterwarnings('ignore') ... try: ... sampler.remove_unknown_kwargs(num_reads=10, non_param=3) ... except dimod.exceptions.SamplerUnknownArgWarning: ... pass {'num_reads': 10}
- sample(bqm, **parameters)[source]#
Sample from a binary quadratic model.
- Parameters:
bqm (
openjij.BinaryQuadraticModel
) – Binary Qudratic Model**parameters – See the implemented sampling for additional keyword definitions.
- Returns:
results
- Return type:
- sample_ising(h, J, **parameters)[source]#
Sample from an Ising model using the implemented sample method.
- Parameters:
- Returns:
results
- Return type:
- sample_qubo(Q, **parameters)[source]#
Sample from a QUBO model using the implemented sample method.
- Parameters:
Q (
dict or numpy.ndarray
) – Coefficients of a quadratic unconstrained binary optimization- Returns:
results
- Return type:
- parameters#
- properties#