omnisolver.random.sampler#
Simple implementation of dummy random sampler.
Module Contents#
Classes#
Implementation of simple random-sampler. |
- class omnisolver.random.sampler.RandomSampler(prob)#
Bases:
dimod.SamplerImplementation of simple random-sampler.
This sampler assigns randomly chosen value to each variable, either from the set {0, 1} or the set {-1, 1}, depending on the vartype of BQM being solved.
- property properties#
Properties as a dict containing any additional information about the sampler.
- property parameters#
Parameters as a dict, where keys are keyword parameters accepted by the sampler methods and values are lists of the properties relevent to each parameter.
- variable_samplers#
- get_random_sample(bqm)#
Get random assignment of variables in given BQM.
- sample(bqm, num_reads=1, **parameters)#
Sample from a binary quadratic model.
This method is inherited from the
Samplerbase class.Converts the binary quadratic model to either Ising or QUBO format and then invokes an implemented sampling method (one of
sample_ising()orsample_qubo()).Args:
bqm: A binary quadratic model.
- **parameters:
See the implemented sampling for additional keyword definitions. Unknown keywords are accepted with a warning raised.
Returns: Samples from the binary quadratic model.
- See also:
sample_ising(),sample_qubo()