Solver Parameters¶
The quantum machine instructions (QMI) you send to D-Wave QPU
solvers comprise
problem parameters (e.g., linear biases,
h
, of an Ising problem) and solver parameters
that control how the problem is run (e.g., an annealing schedule,
anneal_schedule). Likewise, Leap
hybrid solvers accept parameters that control how the problem is run.
This chapter describes, in alphabetical order, the solver parameters1 accepted by SAPI solvers2.
- 1
Ocean software tools include various other parameters that are processed client-side, not sent on to SAPI; for example, the
DWaveSampler
class might accept aretry_interval
to configure the time its failover routine waits for a solver if no solver is found. See the Ocean documentation for those parameters.- 2
Ocean software also provides classical solvers such as dwave-greedy that you can run locally. See the Ocean documentation for information on parameters of such solvers.
anneal_offsets¶
Provides offsets to annealing paths, per qubit.
Default is no offsets.
Relevant Properties¶
anneal_offset_ranges defines the ranges of valid anneal offset values.
anneal_offset_step and anneal_offset_step_phi0 define the quantization steps.
Example¶
This example offsets the anneal of a qubit in a two-qubit illustrative Ising problem.
>>> from dwave.system import FixedEmbeddingComposite, DWaveSampler
>>> qpu = DWaveSampler(solver={'topology__type': 'pegasus'})
>>> J = {(1, 2): -1}
>>> embedding = {1: [30], 2: [2940]}
>>> print(qpu.properties['anneal_offset_ranges'][2940])
[-0.7012257815714587, 0.6717794151250857]
>>> sampler = FixedEmbeddingComposite(qpu, embedding)
>>> offset = [0]*qpu.properties['num_qubits']
>>> offset[2940]=0.2
>>> sampleset = FixedEmbeddingComposite(qpu, embedding).sample_ising({}, J,
... num_reads=1000, anneal_offsets=offset)
The D-Wave system used for this example is an Advantage that has couplers between active qubits 30 and 2940. Select a suitable embedding for the QPU you run examples on.
anneal_schedule¶
Introduces variations to the global anneal schedule. For a reverse anneal, use the anneal_schedule parameter with the initial_state and reinitialize_state parameters.
An anneal schedule variation is defined by a series of pairs of floating-point numbers identifying points in the schedule at which to change slope. The first element in the pair is time \(t\) in microseconds with a granularity of 0.01 \(\mu s\) for Advantage and 0.02 \(\mu s\) for D-Wave 2000Q systems; the second, anneal fraction \(s\) in the range [0,1]. The resulting schedule is the piecewise-linear curve that connects the provided points.
The following rules apply to the set of anneal schedule points provided:
Time \(t\) must increase for all points in the schedule.
For forward annealing, the first point must be \((0, 0)\).
For reverse annealing, the anneal fraction \(s\) must start and end at \(s = 1\).
In the final point, anneal fraction \(s\) must equal 1 and time \(t\) must not exceed the maximum value in the annealing_time_range property.
The number of points must be \(\geq 2\).
The upper bound on the number of points is system-dependent; check the max_anneal_schedule_points property. For reverse annealing, the maximum number of points allowed is one more than the number given by this property.
The steepest slope of any curve segment, \(\frac{s_i - s_{i-1}}{t_i - t_{i-1}}\) must not be greater than the inverse of the minimum anneal time. For example, for a QPU with a annealing_time_range value of
[ 0.5, 2000 ]
, the minimum anneal time is 0.5 \(\mu s\), so the steepest supported slope is 2 \(\mu s^{-1}\). If you want a section of the piecewise-linear curve that starts at time point \(t_4 = 30 \mu s\) to increase from \(s_4=0.7\) to \(s_5=0.8\), this example QPU supports a schedule that contains \(t_5 = 30.06 \mu s\) ([... [30.0, 0.7], [30.06, 0.8], ...]
), which has a maximum slope of \(1 \frac{2}{3}\), but not one that contains \(t_5 = 30.04 \mu s\) ([... [30.0, 0.7], [30.04, 0.8], ...]
), which has a maximum slope of \(2 \frac{1}{2}\).
Default anneal schedules are described in the QPU-specific anneal schedules documents.
Relevant Properties¶
max_anneal_schedule_points shows the maximum number of points permitted in an anneal schedule.
default_annealing_time shows the default annealing time for the solver.
annealing_time_range defines the limits of the allowable range for the anneal schedule.
Interacts with Parameters¶
annealing_time and anneal_schedule parameters are mutually exclusive.
num_spin_reversal_transforms: spin-reversal transforms are incompatible with reverse annealing.
anneal_schedule (or annealing_time), readout_thermalization, num_reads (samples), and programming_thermalization values taken together must meet the limitations specified in problem_run_duration_range.
Example¶
This illustrative example configures a reverse-anneal schedule on a random native problem.
>>> from dwave.system import DWaveSampler
>>> import random
>>> qpu = DWaveSampler()
>>> J = {coupler: random.choice([-1, 1]) for coupler in qpu.edgelist}
>>> initial = {qubit: random.randint(0, 1) for qubit in qpu.nodelist}
>>> reverse_schedule = [[0.0, 1.0], [5, 0.45], [99, 0.45], [100, 1.0]]
>>> reverse_anneal_params = dict(anneal_schedule=reverse_schedule,
... initial_state=initial,
... reinitialize_state=True)
>>> sampleset = qpu.sample_ising({}, J, num_reads=1000, **reverse_anneal_params)
annealing_time¶
Sets the duration, in microseconds with a resolution of 0.01 \(\mu s\) for Advantage and 0.02 \(\mu s\) for D-Wave 2000Q systems, of quantum annealing time, per read. This value populates the qpu_anneal_time_per_sample field returned in the timing structure. Supported values are positive floating-point numbers.
Default value is shown by default_annealing_time.
Relevant Properties¶
annealing_time_range defines the supported range of valid times.
Interacts with Parameters¶
annealing_time and anneal_schedule parameters are mutually exclusive. Configuring a value of
T
for annealing_time is equivalent to configuringanneal_schedule=[[0, 0], [T, 1]]
.annealing_time (or anneal_schedule), readout_thermalization, num_reads (samples), and programming_thermalization values taken together must meet the limitations specified in problem_run_duration_range.
Example¶
This illustrative example configures the anneal time on a random native problem.
>>> from dwave.system import DWaveSampler
>>> import random
>>> qpu = DWaveSampler()
>>> J = {coupler: random.choice([-1, 1]) for coupler in qpu.edgelist}
>>> long_time = qpu.properties["annealing_time_range"][1]
>>> sampleset = qpu.sample_ising({}, J, num_reads=10, annealing_time=long_time)
answer_mode¶
Indicates how answers are returned from the solver3. Supported values are,
raw
—Answers returned individually in the order they were read from the solver. Use this setting if the returned time sequences are an important part of the solution data.The answer contains two fields, solutions and energies. The solutions field is a list of lists; the inner lists all have length num_qubits and entries from \({-1, +1}\) for Ising problems or \({0, 1}\) for QUBO problems. Values of \(3\) denote unused or inactive qubits. The energies field contains the energy of each corresponding solution.
histogram
—Answers returned as a histogram sorted in order of increasing energies. Answers contain the solutions and energies fields, but solutions are unique and sorted in increasing-energy order. Duplicate answers are merged and include a num_occurrences field, which indicates how many times each solution appeared.
- 3
Ocean tools receive these answers from SAPI and process them. For example, if you submit a problem using Ocean’s
EmbeddingComposite
, the answer is mapped from qubits to the logical variables of your problem.
For optimizing emulator solvers, when answer_mode is histogram
, the
num_occurrences field contains all ones, except possibly for the lowest-energy
solution. That first entry is set so that the sum of all entries is
num_reads.
Default value is histogram
.
Interacts with Parameters¶
num_reads defines the number of reads.
max_answers specifies the maximum number of answers.
Example¶
This illustrative example sets the answer format to raw
.
>>> from dwave.system import DWaveSampler, EmbeddingComposite
>>> J = {('s1', 's2'): 0.5, ('s1', 's3'): 0.5, ('s2', 's3'): 0.5}
>>> sampleset = EmbeddingComposite(DWaveSampler()).sample_ising({}, J,
... num_reads=100, answer_mode='raw')
auto_scale¶
Indicates whether \(h\) and \(J\) values are rescaled:
true
—\(h\) and \(J\) values in the problem are rescaled to use as much of the range of \(h\) (h_range) and the range of \(J\) (j_range) as possible. When enabled, \(h\) and \(J\) values need not lie within the solver’s range of \(h\) and \(J\), but must still be finite.false
—\(h\) and \(J\) values in the problem are used as is. If the \(h\) and \(J\) values are outside the range of the solver, problem submission fails.
For problems that use the regular \(J\) range of a solver, this parameter is enabled by default. For problems that use the extended \(J\) range, it is disabled (and cannot be enabled while the extended range is in use). See also j_range and extended_j_range.
Auto-scaling works as follows. Each QPU has an allowed range of values for the biases and strengths of qubits and couplers. Unless you explicitly disable auto-scaling, the values defined in your problem are adjusted to fit the entire available range, by dividing them by a positive (non-zero) factor defined as:
Ocean software’s samplers often have a chain strength parameter: because the QPU’s qubits are sparsely connected, problem variables might be represented by more than one physical qubit (a “chain” of qubits), strongly coupled so as to return the same value. Typically, chains are generated by minor-embedding tools such as Ocean’s minorminer. Setting a value for chain strength determines the values set for the couplers used in forming these chains. When using auto-scaling, the \(J\) values of chain couplers are scaled together with the given or converted \(J\) values. Similarly, if you disable auto-scaling, any chain strength you specify must result in coupling values within the allowed range for the QPU.
Problems specified in QUBO form are always converted to Ising for the submitted QMIs. When using auto-scaling, the converted problem’s \(h\) and \(J\) values are rescaled as described above. Note that bias values in the converted form, which have a dependency on the number of quadratic interactions in the QUBO, can be larger than the maximum bias of the original form. For example, the four-variable QUBO below, which has a maximum bias value of 2,
when converted to an Ising model, has a bias with a value greater than 2.0, \(h_1=2.375\), as shown below:
>>> import dimod
>>> Q = {(1, 1): 2, (2, 2): 1.5, (3, 3): -0.5, (4, 4): -1.0,
... (1, 2): 2, (1, 3): 1.5, (1, 4): 2}
>>> dimod.qubo_to_ising(Q)
({1: 2.375, 2: 1.25, 3: 0.125, 4: 0.0}, {(1, 2): 0.5, (1, 3): 0.375, (1, 4): 0.5}, 2.375)
Default is to auto-scale problems.
Interacts with Parameters¶
auto_scale cannot be used with extended_j_range and flux_biases.
Example¶
The example checks a QPU’s range of \(h\) and \(J\) before submitting a
two-variable Ising problem to a QPU. auto_scale is implicitly True for the
DWaveSampler
class, so the \(h\) and
\(J\) values are automatically rescaled by \(\frac{-3.6}{-2}=1.8\).
>>> from dwave.system import DWaveSampler, EmbeddingComposite
>>> sampler = EmbeddingComposite(DWaveSampler())
...
>>> sampler.child.properties['j_range']
[-1.0, 1.0]
>>> sampler.child.properties['h_range']
[-2.0, 2.0]
>>> h = {'a': -3.6, 'b': 2.3}
>>> J = {('a', 'b'): 1.5}
>>> sampleset = sampler.sample_ising(h, J)
beta¶
Provides a value for the Boltzmann distribution parameter. Used when sampling postprocessing is enabled on D-Wave 2000Q systems. Can be any finite float.
As in statistical mechanics, \(\beta\) represents inverse temperature: \(1/(k_B T)\), where \(T\) is the thermodynamic temperature in kelvin and \(k_B\) is Boltzmann’s constant. In the D-Wave software, postprocessing refines the returned solutions to target a Boltzmann distribution characterized by \(\beta\), which is represented by a floating point number without units. When choosing a value for \(\beta\), be aware that lower values result in samples less constrained to the lowest energy states. For more information on \(\beta\) and how it is used in the sampling postprocessing algorithm, see the QPU Solver Datasheet guide.
Default value is 3.0 for sampling emulators and 10.0 for the D-Wave 2000Q VFYC .
Relevant Properties¶
annealing_time_range defines the supported range of valid times.
- default_beta specifies the default value for sampling
emulators.
beta_range specifies the supported range for sampling emulators.
Interacts with Parameters¶
postprocess defines what type of postprocessing the system runs.
Example¶
This illustrative example sets beta
on a D-Wave 2000Q system.
>>> from dwave.system import DWaveSampler
>>> import random
>>> qpu = DWaveSampler(solver={'topology__type': 'chimera'})
>>> J = {coupler: random.choice([-1, 1]) for coupler in qpu.edgelist}
>>> sampleset = qpu.sample_ising({}, J, num_reads=10, postprocess='sampling',
... beta=100)
chains¶
Defines which qubits represent the same logical variable. Used only when postprocessing is enabled on D-Wave 2000Q systems. Ensures that all qubits in the same chain have the same value within each sample.
Provide the indices of the qubits that are in a chain. Qubits in a chain must be connected, and no qubit may appear more than once.
Default is no chains.
Interacts with Parameters¶
postprocess defines what type of postprocessing the system runs.
Example¶
This illustrative example provides the chains found by Ocean software’s minorminer.
>>> from dwave.system import DWaveSampler, FixedEmbeddingComposite
>>> import minorminer
...
>>> J = {('s1', 's2'): 0.5, ('s1', 's3'): 0.5, ('s2', 's3'): 0.5}
>>> qpu = DWaveSampler(solver={'topology__type': 'chimera'})
>>> embedding = minorminer.find_embedding(J.keys(), qpu.edgelist)
>>> sampleset = FixedEmbeddingComposite(qpu, embedding).sample_ising({}, J,
... num_reads=10,
... postprocess='sampling',
... chains=list(embedding.values()))
flux_biases¶
List of flux-bias offset values with which to calibrate a chain. Often required when using the extended \(J\) range to create a strongly coupled chain for certain embeddings, as described in the QPU Solver Datasheet guide.
Provide an array of flux-bias offset values, in normalized offset units4, for all qubits, working or not. Use 0 for no offset.
- 4
Flux-biases applied to the qubit body are in units of \(\Phi_0\).
Default is no flux-bias offsets.
Relevant Properties¶
extended_j_range defines the extended range of values possible for the coupling strengths.
per_qubit_coupling_range defines the coupling range permitted per qubit for this solver.
flux_drift_compensation indicates whether the D-Wave system compensates for flux drift.
Interacts with Parameters¶
Cannot be used with auto_scale or num_spin_reversal_transforms.
Example¶
This example sets a flux-bias value of a qubit in a two-qubit illustrative Ising problem.
>>> from dwave.system import FixedEmbeddingComposite, DWaveSampler
>>> qpu = DWaveSampler(solver={'topology__type': 'chimera'})
>>> J = {('s1', 's2'): 0.5, ('s1', 's3'): 0.5, ('s2', 's3'): 0.5}
>>> embedding = {'s1': [1444], 's2': [1441], 's3': [1445, 1443]}
>>> fb = [0]*qpu.properties['num_qubits']
>>> fb[1445] = 5*qpu.properties["anneal_offset_step_phi0"]
>>> fb[1443] = -2*qpu.properties["anneal_offset_step_phi0"]
>>> sampleset = FixedEmbeddingComposite(qpu, embedding).sample_ising({}, J,
... num_reads=100, flux_drift_compensation=False, flux_biases=fb)
The D-Wave system used for this example is a D-Wave 2000Q that has particular couplers. Select a suitable embedding for the QPU you run examples on.
flux_drift_compensation¶
Boolean flag indicating whether the D-Wave system compensates for flux drift. The procedure it follows to do so is described in detail in Appendix A of the QPU Solver Datasheet guide.
flux_drift_compensation=true
—Compensate for flux drift.flux_drift_compensation=false
—Do not compensate for flux drift.
Default is to compensate for flux drift.
Interacts with Parameters¶
flux_biases enables you to apply flux-bias offsets manually, which you may want to do If you disable this parameter.
Example¶
This example disables flux-drift compensation.
>>> from dwave.system import EmbeddingComposite, DWaveSampler
>>> sampler = EmbeddingComposite(DWaveSampler())
>>> J = {('s1', 's2'): 0.5, ('s1', 's3'): 0.5, ('s2', 's3'): 0.5}
>>> sampleset = sampler.sample_ising({}, J, num_reads=100,
... flux_drift_compensation=False)
h_gain_schedule¶
Sets a time-dependent gain for linear coefficients (qubit biases, see the h parameter) in the Hamiltonian. This parameter enables you to specify the \(g(t)\) function in,
where \({\hat\sigma_{x,z}^{(i)}}\) are Pauli matrices operating on a qubit \(q_i\) and \(h_i\) and \(J_{i,j}\) are the qubit biases and coupling strengths.
This time-dependent gain, \(g(t)\), is specified, similarly to the anneal_schedule parameter, by a series of pairs of floating-point numbers identifying points in the schedule at which to change the gain applied to h. The first element in the pair is time, \(t\) in microseconds with a resolution of 0.01 \(\mu s\) for Advantage and 0.02 \(\mu s\) for D-Wave 2000Q systems; the second, the unitless \(g\) in the range h_gain_schedule_range. The resulting time-dependent gain is the piecewise-linear curve that connects the provided points over the same range of times as the anneal_schedule.
The following rules apply to the set of gain points provided:
Time \(t\), in microseconds, must increase for all points in the schedule.
The first point of time must be zero, \(t=0.0\).
The last point of time must match the last time in the anneal_schedule or the annealing_time.
The number of points must be \(\geq 2\).
Additional rules that govern maximum slope (i.e., how quickly \(g(t)\) can change) vary by product; check the QPU properties document for your system.
Default \(g(t)\), when left unspecified, is 1, which can be explicitly coded as
h_gain_schedule=[[0,1],[t_final,1]]
where t_final is the requested annealing time.
Relevant Properties¶
h_gain_schedule_range defines the range of the time-dependent gain values permitted for the solver.
Note
In conjunction with the auto_scale parameter, the h_gain_schedule parameter enables you to extend the range of your submitted problem’s linear coefficients (h) beyond the advertised h_range. Such use is not recommended for standard problem solving: the QPU is calibrated for linearity only within the advertised h_range and j_range. Increased integrated control errors (ICE) are expected outside that range.
If you configure
auto_scale=False
when using this parameter, ensure that \(\max_i(h\_gain*h_i)\) and \(\min_i(h\_gain*h_i)\) are within h_range.max_anneal_schedule_points defines the maximum number of anneal-schedule points permitted.
max_h_gain_schedule_points defines the maximum number of gain changes allowed.
Interacts with Parameters¶
h defines the linear biases for the problem.
anneal_schedule defines the anneal schedule.
Example¶
This illustrative example sets an h-gain schedule.
>>> from dwave.system import EmbeddingComposite, DWaveSampler
>>> sampler = EmbeddingComposite(DWaveSampler())
>>> h = {'s1': 1, 's2': 1.5, 's3': -0.75}
>>> J = {('s1', 's2'): 0.5, ('s1', 's3'): 0.5, ('s2', 's3'): 0.5}
>>> anneal_schedule = [[0.0, 0.0], [40.0, 0.4], [140.0, 0.4], [150, 1.0]]
>>> h_schedule = [[0.0, 1], [40.0, 1], [140.0, 2], [143.0, 0], [150, 0]]
>>> sampleset = sampler.sample_ising(h, J, num_reads=500,
... anneal_schedule=anneal_schedule,
... h_gain_schedule=h_schedule)
initial_state¶
Initial state to which the system is set for reverse annealing. Specifies the initial classical state of all qubits.
Provide (qubit, state) pairs, where qubit is the qubit index, i, and state is:
-1 or 1—Ising problems, active qubits
0 or 1—QUBO problems, active qubits
3—Unused or inactive qubits
Interacts with Parameters¶
anneal_schedule defines the anneal schedule. When initial_state is provided, indicates that the requested anneal schedule change is a reverse anneal.
reinitialize_state reinitializes for each anneal. Note that this impacts timing.
num_spin_reversal_transforms is incompatible with reverse annealing.
Example¶
This illustrative example configures a reverse-anneal schedule on a random native problem.
>>> from dwave.system import DWaveSampler
>>> import random
>>> qpu = DWaveSampler()
>>> J = {coupler: random.choice([-1, 1]) for coupler in qpu.edgelist}
>>> initial = {qubit: random.randint(0, 1) for qubit in qpu.nodelist}
>>> reverse_schedule = [[0.0, 1.0], [5, 0.45], [99, 0.45], [100, 1.0]]
>>> reverse_anneal_params = dict(anneal_schedule=reverse_schedule,
... initial_state=initial,
... reinitialize_state=True)
>>> sampleset = qpu.sample_ising({}, J, num_reads=1000, **reverse_anneal_params)
max_answers¶
Specifies the maximum number of answers returned from the solver. Must be an integer > 0.
If answer_mode is
histogram
—Total number of distinct answers. Because answers in this mode are sorted by energy, these are the bestmax_answers
answers.If answer_mode is
raw
—Limits the returned values to the first max_answers of num_reads samples. In this mode, max_answers should never be more than num_reads.
Default value is num_reads.
Interacts with Parameters¶
num_reads defines the maximum number of requested answers.
answer_mode defines the answer mode.
Example¶
This illustrative example resulted in fewer samples than the configured num_reads.
>>> from dwave.system import EmbeddingComposite, DWaveSampler
>>> sampler = EmbeddingComposite(DWaveSampler())
>>> J = {('s1', 's2'): 0.5, ('s1', 's3'): 0.5, ('s2', 's3'): 0.5}
>>> sampleset = sampler.sample_ising({}, J, num_reads=1000,
... max_answers=5)
>>> print(sampleset)
s1 s2 s3 energy num_oc. chain_.
0 +1 -1 -1 -0.5 202 0.0
1 -1 -1 +1 -0.5 132 0.0
2 +1 -1 +1 -0.5 112 0.0
3 -1 +1 -1 -0.5 248 0.0
4 -1 +1 +1 -0.5 95 0.0
['SPIN', 5 rows, 789 samples, 3 variables]
num_reads¶
Indicates the number of states (output solutions) to read5 from the solver. Must be a positive integer in the range given by the num_reads_range solver property.
- 5
Terms synonymous to reads are anneals and samples.
Default value is 1
.
Interacts with Parameters¶
max_answers sets the maximum number of answers to be returned from the solver.
anneal_schedule or annealing_time, readout_thermalization, num_reads (samples), and programming_thermalization values taken together must meet the limitations specified in problem_run_duration_range.
Example¶
This illustrative example requests 1250 samples.
>>> from dwave.system import EmbeddingComposite, DWaveSampler
>>> sampler = EmbeddingComposite(DWaveSampler())
>>> Q = {('x1', 'x2'): 1, ('x1', 'z'): -2, ('x2', 'z'): -2, ('z', 'z'): 3}
>>> sampleset = sampler.sample_qubo(Q, answer_mode='raw', num_reads=1250)
>>> len(sampleset)
1250
num_spin_reversal_transforms¶
Specifies the number of spin-reversal transforms6 to perform.
- 6
Also known as gauge transformations.
Applying a spin-reversal transform can improve results by reducing the impact of analog errors that may exist on the QPU. This technique works as follows: Given an \(n\)-variable Ising problem, we can select a random \(g\in\{\pm1\}^n\) and transform the problem via \(h_i\mapsto h_ig_i\) and \(J_{ij}\mapsto J_{ij}g_ig_j\). A spin-reversal transform does not alter the mathematical nature of the Ising problem. Solutions \(s\) of the original problem and \(s^\prime\) of the transformed problem are related by \(s^\prime_i=s_ig_i\) and have identical energies. However, the sample statistics can be affected by the spin-reversal transform because the QPU is a physical object with asymmetries.
Spin-reversal transforms work correctly with postprocessing and chains. Majority voting happens on the original problem state, not on the transformed state.
Be aware that each transform reprograms the QPU; therefore, using more than 1 transform will increase the amount of time required to solve the problem. For more information about timing, see the QPU Solver Datasheet guide.
Default is no spin-reversal transforms.
Interacts with Parameters¶
num_reads defines the maximum number of requested answers, and this is the maximum allowed value of spin-reversal transforms.
flux_biases and extended_j_range ranges are incompatible with spin-reversal transforms.
Example¶
This illustrative example executes 5 spin-reversal transforms.
>>> from dwave.system import EmbeddingComposite, DWaveSampler
>>> sampler = EmbeddingComposite(DWaveSampler())
>>> Q = {('x1', 'x2'): 1, ('x1', 'z'): -2, ('x2', 'z'): -2, ('z', 'z'): 3}
>>> sampleset = sampler.sample_qubo(Q, num_reads=100,
... num_spin_reversal_transforms=5)
postprocess¶
Postprocessing optimization and sampling algorithms provide local improvements with minimal overhead to solutions obtained from the quantum processing unit (QPU).
Ocean software provides postprocessing tools, and you can optionally run postprocessing online on D-Wave 2000Q systems.
Defines what type of postprocessing the system runs online on raw solutions:
“” (empty string)—No postprocessing (default). Note that if this option is selected for the VFYC solver, sampling postprocessing runs.
sampling
—Runs a short Markov-chain Monte Carlo (MCMC) algorithm with single bit-flips starting from each sample. The target probability distribution is a Boltzmann distribution at inverse temperature \(\beta\).optimization
—Performs a local search on each sample, stopping at a local minimum.
When postprocessing is enabled, qubits in the same chain, defined by the chains parameter, are first set to the same value by majority vote. Postprocessing is performed on the logical problem but qubit-level answers are returned. For more information about postprocessing, see the QPU Solver Datasheet guide.
For problems that use the VFYC solver, postprocessing always runs. If you do not choose a postprocessing option, sampling postprocessing runs. When sampling postprocessing runs, the default \(\beta\) value is 10.
Example¶
This illustrative example uses postprocessing on a D-Wave 2000Q system.
>>> from dwave.system import EmbeddingComposite, DWaveSampler
>>> sampler = EmbeddingComposite(DWaveSampler(solver={'topology__type': 'chimera'}))
>>> Q = {('x1', 'x2'): 1, ('x1', 'z'): -2, ('x2', 'z'): -2, ('z', 'z'): 3}
>>> sampleset = sampler.sample_qubo(Q, num_reads=10, postprocess='sampling')
programming_thermalization¶
Sets the time, in microseconds with a resolution of 0.01 \(\mu s\) for Advantage and 0.02 \(\mu s\) for D-Wave 2000Q systems, to wait after programming the QPU for it to cool back to base temperature (i.e., post-programming thermalization time). Lower values accelerate solving at the expense of solution quality. Supported values are positive floating-point numbers. This value contributes to the total qpu_programming_time, which is returned by SAPI with the problem solutions.
Default value for a solver is given in the default_programming_thermalization property.
Relevant Properties¶
programming_thermalization_range defines the range of allowed values.
Interacts with Parameters¶
anneal_schedule or annealing_time, readout_thermalization, num_reads (samples), and programming_thermalization values taken together must meet the limitations specified in problem_run_duration_range.
Example¶
This illustrative example sets a value of half the supported maximum.
>>> from dwave.system import EmbeddingComposite, DWaveSampler
>>> sampler = EmbeddingComposite(DWaveSampler())
>>> Q = {('x1', 'x2'): 1, ('x1', 'z'): -2, ('x2', 'z'): -2, ('z', 'z'): 3}
>>> pt = int(sampler.child.properties["programming_thermalization_range"][1]/2)
>>> sampleset = sampler.sample_qubo(Q, num_reads=10,
... programming_thermalization=pt)
readout_thermalization¶
Sets the time, in microseconds with a resolution of 0.01 \(\mu s\) for Advantage and 0.02 \(\mu s\) for D-Wave 2000Q systems, to wait after each state is read from the QPU for it to cool back to base temperature (i.e., post-readout thermalization time). This value contributes to the qpu_delay_time_per_sample field, which is returned with the problem solutions. Supported values are positive floating-point numbers.
Default value for a solver is given in the default_readout_thermalization property.
Relevant Properties¶
readout_thermalization_range defines the range of allowed values.
Interacts with Parameters¶
anneal_schedule or annealing_time, readout_thermalization, num_reads (samples), and programming_thermalization values taken together must meet the limitations specified in problem_run_duration_range.
Example¶
This illustrative example sets a value of half the supported maximum.
>>> from dwave.system import EmbeddingComposite, DWaveSampler
>>> sampler = EmbeddingComposite(DWaveSampler())
>>> Q = {('x1', 'x2'): 1, ('x1', 'z'): -2, ('x2', 'z'): -2, ('z', 'z'): 3}
>>> rt = int(sampler.child.properties["readout_thermalization_range"][1]/2)
>>> sampleset = sampler.sample_qubo(Q, num_reads=10,
... readout_thermalization=rt)
reduce_intersample_correlation¶
Reduces sample-to-sample correlations caused by the spin-bath polarization effect7 by adding a delay between reads.
- 7
See the QPU Solver Datasheet for more information on this effect.
Boolean flag indicating whether the system adds a delay.
reduce_intersample_correlation=true
—Adds delay.reduce_intersample_correlation=false
(default)—Does not add delay.
Important
Enabling this parameter drastically increases problem run times. To avoid exceeding the maximum problem run time configured for your system, limit the number of reads when using this feature. For more information on timing, see the QPU Solver Datasheet guide.
Default is to not add delay between reads.
Example¶
This illustrative example configures a delay between reads.
>>> from dwave.system import EmbeddingComposite, DWaveSampler
>>> sampler = EmbeddingComposite(DWaveSampler())
>>> Q = {('x1', 'x2'): 1, ('x1', 'z'): -2, ('x2', 'z'): -2, ('z', 'z'): 3}
>>> sampleset = sampler.sample_qubo(Q, num_reads=10,
... reduce_intersample_correlation=True)
reinitialize_state¶
When using the reverse annealing feature, you must supply the initial state to which the system is set; see the initial_state parameter. If multiple reads are requested in a single call to the Solver API, you have two options for the starting state of the system. These are controlled by the reinitialize_state Boolean parameter:
reinitialize_state=true
—Reinitialize to the specified initial state for every anneal-readout cycle. Each anneal begins from the state given in the initial_state parameter. The amount of time required to reinitialize varies by system; typical D-Wave 2000Q systems require between 100 and 600 microseconds for this operation.reinitialize_state=false
—Initialize only at the beginning, before the first anneal cycle. Each anneal (after the first) is initialized from the final state of the qubits after the previous cycle. Be aware that even if this parameter is disabled, reverse annealing adds a small amount of time (\(\approx 10 \ \mu s\)) for each read.
See also anneal_schedule.
Default is to reinitialize to the specified initial state for every anneal in reverse-anneal submissions.
Interacts with Parameters¶
anneal_schedule defines the anneal schedule.
anneal_schedule or annealing_time, readout_thermalization, num_reads (samples), and programming_thermalization values taken together must meet the limitations specified in problem_run_duration_range.
num_spin_reversal_transforms is incompatible with reverse annealing.
Example¶
This illustrative example configures a reverse-anneal schedule on a random native problem with each anneal initialized from the final state of the previous cycle.
>>> from dwave.system import DWaveSampler
>>> import random
>>> qpu = DWaveSampler()
>>> J = {coupler: random.choice([-1, 1]) for coupler in qpu.edgelist}
>>> initial = {qubit: random.randint(0, 1) for qubit in qpu.nodelist}
>>> reverse_schedule = [[0.0, 1.0], [5, 0.45], [99, 0.45], [100, 1.0]]
>>> reverse_anneal_params = dict(anneal_schedule=reverse_schedule,
... initial_state=initial,
... reinitialize_state=False)
>>> sampleset = qpu.sample_ising({}, J, num_reads=1000, **reverse_anneal_params)
time_limit¶
Specifies the maximum run time, in seconds, the solver is allowed to work on the given problem. Can be a float or integer.
Default value is problem dependent.
Relevant Properties¶
minimum_time_limit defines the range of supported values for a given BQM or DQM problem.
minimum_time_limit_s defines the minimum supported value for any given CQM problem. The specified time_limit cannot be lower than the smaller of this value and the calculated default run time for the submitted problem.
For CQM solvers, num_biases_multiplier, num_constraints_multiplier, and num_variables_multiplier define multipliers used in the internal calculation of the default run time for a given problem. The specified time_limit cannot be lower than the smaller of the calculated default run time for the submitted problem and minimum_time_limit_s.
Example¶
This illustrative example configures a time limit of 6 seconds.
>>> from dwave.system import LeapHybridSampler
>>> Q = {('x1', 'x2'): 1, ('x1', 'z'): -2, ('x2', 'z'): -2, ('z', 'z'): 3}
>>> sampleset = LeapHybridSampler().sample_qubo(Q, time_limit=6)