omnisolver.random.sampler#

Simple implementation of dummy random sampler.

Module Contents#

Classes#

RandomSampler

Implementation of simple random-sampler.

class omnisolver.random.sampler.RandomSampler(prob: float)#

Bases: dimod.Sampler

Implementation 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: dimod.BQM) Dict[Hashable, int]#

Get random assignment of variables in given BQM.

sample(bqm: dimod.BQM, num_reads=1, **parameters) dimod.SampleSet#

Sample from a binary quadratic model.

This method is inherited from the Sampler base class.

Converts the binary quadratic model to either Ising or QUBO format and then invokes an implemented sampling method (one of sample_ising() or sample_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()