# Problem 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`

).
Ocean software tools and SAPI’s
REST API provide various abstractions for
encoding the linear and quadratic biases that configure problems on D-Wave
QPUs and enable expansion to problems such as the discrete quadratic models (DQM)
solved on Leap’s hybrid solvers.

For example, Ocean’s `DWaveSampler`

accepts problems
as a `BinaryQuadraticModel`

, which contains both the Q of
the QUBO format and h and J of the Ising format, as well as the
latter three directly; e.g., `DWaveSampler().sample_qubo(Q)`

and also
`DWaveSampler().sample(bqm)`

.

This chapter describes the problem parameters accepted by D-Wave solvers, in alphabetical order. Check the documentation for your preferred API to see which parameters are required.

## bqm¶

Ocean’s `dimod.BinaryQuadraticModel`

(BQM) contains linear and quadratic
biases for problems formulated as
quadratic binary models as well as additional
information such as variable labels and offset.

For example, a BQM might be built from a QUBO:

```
>>> import dimod
>>> Q = {(0, 0): -3, (1, 1): -1, (0, 1): 2, (2, 2): -1, (0, 2): 2}
>>> bqm = dimod.BQM.from_qubo(Q)
```

Some Leap hybrid solvers accept BQMs; for QPU solvers, Ocean converts to Ising format and submits linear and quadratic biases.

## data¶

The submitted problem’s linear and quadratic coefficients in a JSON object
with keys `lin`

and `quad`

.

If you are submitting directly through SAPI’s REST API, see the *Solver API REST Web Services Developer Guide*
for more information; Ocean takes parameters such as h and J of the
Ising format instead.

## dqm¶

Ocean’s `dimod.DiscreteQuadraticModel`

contains linear and quadratic biases
for problems formulated as
discrete binary models as well as additional
information such as variable labels.

Some Leap hybrid solvers accept DQMs; for
example, see Ocean’s `LeapHybridDQMSampler`

.

## format¶

The submitted problem’s format, as a string in the JSON input data.

For example, `"format":"qp"`

if the problem data is provided in the
submission or `ref`

to reference a previously uploaded problem.

If you are submitting directly through SAPI’s REST API, see the *Solver API REST Web Services Developer Guide*
for more information; Ocean sets this parameter implicitly.

## h¶

For Ising problems, the \(h\) values are the linear coefficients (biases).

Because the quantum annealing process[1] minimizes the energy function of the Hamiltonian, and \(h\) is multiplied with the answer, returned states tend toward the opposite sign as that provided as a bias. For example, if you bias a qubit with an \(h\) value of \(-1\), it is more likely to have a final state of \(+1\) in the solution.

[1] | QPU-like solvers emulate this process. |

A problem definition comprises both h and J values. For example, the following is a 7-qubit problem in which \(q_1\) and \(q_4\) are biased with \(-1\) and \(q_0\), \(q_2\), \(q_3\), \(q_4\), and \(q_6\) are biased with \(+1\). Qubits \(q_0\) and \(q_6\) have a ferromagnetic coupling between them with a strength of \(-1\).

```
h = [1, -1, 1, 1, -1, 1, 1]
J = {(0, 6): -1}
```

For QPU solvers:

- To see the supported \(h\) range, check the h_range property. The auto_scale parameter enables you to submit problems with values outside h_range and j_range and have the D-Wave system automatically scale them to fit.
- The programming cycle programs the solver to the specified \(h\) and
\(J\) values for a given Ising problem (or \(Q\) values for a given
QUBO problem). However, since QPU precision is limited, the \(h\)
and \(J\) values (or \(Q\) values) realized on the solver may deviate
slightly from the requested values. For more information, see
*Technical Description of the D-Wave Quantum Processing Unit*.

For QUBO problems, use Q instead of \(h\)
and \(J\); see *Getting Started with the D-Wave System* for more information and converting
between the formulations.

If you are submitting directly through SAPI’s REST API, see Data Encoding and the
*Solver API REST Web Services Developer Guide* for more information.

## J¶

For Ising problems, the \(J\) values are the quadratic coefficients. The larger the absolute value of \(J\), the stronger the coupling between pairs of variables (and qubits on QPU solvers).

An Ising problem definition comprises both h and J values. The following is a 7-qubit problem with a coupling strength of \(-1\) between \(q_0\) and \(q_6\):

```
h = [1, -1, 1, 1, -1, 1, 1]
J = {(0, 6): -1}
```

For QPU solvers:

- This parameter sets the strength of the couplers between qubits:
- \(\textbf {J < 0}\): Ferromagnetic coupling; coupled qubits prefer to be in the same state, \((1,1)\) or \((-1,-1)\).
- \(\textbf {J > 0}\): Antiferromagnetic coupling; coupled qubits prefer to be in opposite states, \((-1,1)\) or \((1,-1)\).
- \(\textbf {J = 0}\): No coupling; qubit states do not affect each other.

- To see the supported \(J\) range, check the j_range property. The auto_scale parameter enables you to submit problems with values outside h_range and j_range range and have the system automatically scale them to fit. Some QPU solvers support an extended \(J\) range for stronger couplings; however, be aware that you cannot use the extended \(J\) range with autoscaling or spin-reversal transforms. See extended_j_range for more information.
- The programming cycle programs the solver to the specified \(h\) and
\(J\) values for a given Ising problem (or \(Q\) values for a given
QUBO problem). However, since QPU precision is limited, the \(h\) and
\(J\) values (or \(Q\) values) realized on the solver may deviate
slightly from the requested values. For more information, see
*Technical Description of the D-Wave Quantum Processing Unit*.

For QUBO problems, use Q instead of \(h\)
and \(J\); see *Getting Started with the D-Wave System* for more information and converting
between the formulations.

If you are submitting directly through SAPI’s REST API, see Data Encoding and the
*Solver API REST Web Services Developer Guide* for more information.

## label¶

Problem label you can optionally tag submissions with. You can set as a label a non-empty string of up to 1024 Windows-1252 characters that has meaning to you or is generated by your application, which can help you identify your problem submission. You can see this label on the Leap dashboard and in solutions returned from SAPI.

The following example submits a trivial Ising problem with a label and shows how such labels are displayed on the Leap dashboard.

```
>>> from dwave.system import DWaveSampler, EmbeddingComposite
>>> sampler = EmbeddingComposite(DWaveSampler())
...
>>> sampleset = sampler.sample_ising({}, {('a', 'b'): -.05},
... label="Test Ising Problem 1")
>>> print(sampleset.info["problem_label"])
Test Ising Problem 1
```

## Q¶

A quadratic unconstrained binary optimization (QUBO) problem is defined using an upper-triangular matrix, \(\rm \textbf{Q}\), which is an \(N \times N\) matrix of real coefficients, and \(\textbf{x}\), a vector of binary variables. The diagonal entries of \(\rm \textbf{Q}\) are the linear coefficients (analogous to \(h\), in Ising problems). The nonzero off-diagonal terms are the quadratic coefficients that define the strength of the coupling between variables (analogous to \(J\), in Ising problems).

Input may be full or sparse. Both upper- and lower-triangular values can be used; (\(i\), \(j\)) and (\(j\), \(i\)) entries are added together.

When using the Ocean tools, this parameter is a dictionary of QUBO coefficients.

For QPU solvers

- If a \(Q\) value is assigned to a coupler not present, an exception is raised. Only entries indexed by working couplers may be nonzero.
- QUBO problems are converted to Ising format before they run on the solver. Ising format uses \(h\) (qubit bias) and \(J\) (coupling strength) to represent the problem; see also h and J.
- The programming cycle programs the solver to the specified
\(h\) and \(J\) values for a given Ising problem (or \(Q\) values
for a given QUBO problem). However, since QPU precision is limited, the
\(h\) and \(J\) values (or \(Q\) values) realized on the solver
may deviate slightly from the requested values. For more information,
see
*Technical Description of the D-Wave Quantum Processing Unit*. - Before sending a problem, check the h_range and j_range properties for the ranges permitted for the solver. Be aware that problems with values outside the supported range will, by default, be scaled down to fit within the supported range; see the auto_scale parameter for more information. Some solvers support an extended \(J\) range for stronger couplings; however, be aware that you cannot use the extended \(J\) range with autoscaling or spin-reversal transforms. See extended_j_range for more information.

If you are submitting directly through SAPI’s REST API, see Data Encoding and the
*Solver API REST Web Services Developer Guide* for more information.

## solver¶

The solver name, as a string in the JSON input data.

For example, `DW_2000Q_6`

selects a particular D-Wave system.

If you are submitting directly through SAPI’s REST API, see the *Solver API REST Web Services Developer Guide*
for more information; Ocean allows you to explicitly select a solver and to
automatically select a solver based on your required features.

## type¶

The type of problem submitted as a string in the JSON input data.

For example, `"type":"ising"`

for an Ising problem.

If you are submitting directly through SAPI’s REST API, see the *Solver API REST Web Services Developer Guide*
for more information. Ocean samplers provide `sample_ising`

for submitting
Ising problems, `sample_qubo`

methods for QUBO problems, `sample_dqm`

for DQM problems, etc.