dwave.system.composites.ReverseBatchStatesComposite.sample#
- ReverseBatchStatesComposite.sample(bqm, initial_states=None, initial_states_generator='random', num_reads=None, seed=None, **parameters)[source]#
Sample the binary quadratic model using reverse annealing from multiple initial states.
- Parameters:
bqm (
BinaryQuadraticModel) – Binary quadratic model to be sampled from.initial_states (samples-like, optional, default=None) – One or more samples, each defining an initial state for all the problem variables. If fewer than
num_readsinitial states are defined, additional values are generated as specified by theinitial_states_generatorparameter. Seedimod.as_samples()for a description of “samples-like”.initial_states_generator ({'none', 'tile', 'random'}, optional, default='random') –
Defines the expansion of
initial_statesif fewer thannum_readsare specified:- ”none”:
Not supported when the number of initial states specified is smaller than
num_reads.
- ”tile”:
Reuses the specified initial states if fewer than
num_readsor truncates if greater.
- ”random”:
Expands the specified initial states with randomly generated states if fewer than
num_readsor truncates if greater.
num_reads (int, optional, default=len(initial_states) or 1) – Number of required anneals. If greater than the number of provided initial states, additional states must be generated using the
initial_states_generatorparameter. If not specified, set to the length ofinitial_statesif provided. Ifinitial_statesis not provided, defaults to 1.seed (int (32-bit unsigned integer), optional) – Seed to use for the pseudorandom number generator (PRNG). Specifying a particular seed with a constant set of parameters produces identical submissions. If not specified, a random seed is chosen.
**parameters – Parameters for the sampling method, specified by the child sampler.
- Returns:
SampleSetthat has aninitial_statefield.- Raises:
ValueError – If the number of initial states specified is smaller than
num_readsandinitial_states_generatoris set to"none".
Examples
See examples in the
ReverseBatchStatesCompositeclass.