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_reads initial states are defined, additional values are generated as specified by the initial_states_generator parameter. See dimod.as_samples() for a description of “samples-like”.

  • initial_states_generator ({'none', 'tile', 'random'}, optional, default='random') –

    Defines the expansion of initial_states if fewer than num_reads are 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_reads or truncates if greater.

    • ”random”:

      Expands the specified initial states with randomly generated states if fewer than num_reads or 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_generator parameter. If not specified, set to the length of initial_states if provided. If initial_states is 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:

SampleSet that has an initial_state field.

Raises:

ValueError – If the number of initial states specified is smaller than num_reads and initial_states_generator is set to "none".

Examples

See examples in the ReverseBatchStatesComposite class.