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, optional, default=[[[0, 1], [1, 0.35], [9, 0.35], [10, 1]]]) – Anneal schedules in order of submission. Each schedule is formatted as a list of [time, s] pairs, in which time is in microseconds and s is the normalized persistent current in the range [0,1].
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() >>> sampler_reverse = ReverseAdvanceComposite(sampler) >>> 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)