dwave.system.composites.ReverseAdvanceComposite.sample¶
-
ReverseAdvanceComposite.
sample
(bqm, anneal_schedules=None, **parameters)[source]¶ Sample the binary quadratic model using reverse annealing along a given set of anneal schedules.
Parameters: - bqm (
dimod.BinaryQuadraticModel
) – Binary quadratic model to be sampled from. - anneal_schedules (list of lists) – Anneal schedules in order of submission. Each schedule is formatted as a list of [time, s] pairs
- initial_state (dict, optional) – the state to reverse anneal from. If not provided, it will be randomly generated
- **parameters – Parameters for the sampling method, specified by the child sampler.
Returns: dimod.SampleSet
that has initial_state and schedule_index fields.Examples
This example runs 100 reverse anneals each for three schedules on a problem constructed by setting random \(\pm 1\) values on a clique (complete graph) of 15 nodes, minor-embedded on a D-Wave system using the
DWaveCliqueSampler
sampler.>>> import dimod >>> from dwave.system import DWaveCliqueSampler, ReverseAdvanceComposite ... >>> sampler = DWaveCliqueSampler(solver={'qpu': True}) >>> sampler_reverse = ReverseAdvanceComposite(sampler) >>> schedule = schedule = [[[0.0, 1.0], [t, 0.5], [20, 1.0]] for t in (5, 10, 15)] ... >>> bqm = dimod.generators.ran_r(1, 15) >>> init_samples = {i: -1 for i in range(15)} >>> sampleset = sampler_reverse.sample(bqm, ... anneal_schedules=schedule, ... initial_state=init_samples, ... num_reads=100, ... reinitialize_state=True)
- bqm (