CQM Solver Parameters#

This section describes the parameters of quantum-classical hybrid constrained quadratic model solvers such as the Leap service’s hybrid_constrained_quadratic_model_version1. For the properties that inform and restrict your use of the solver, see the CQM Solver Properties section.

cqm#

Ocean software’s dimod.ConstrainedQuadraticModel (CQM) contains linear and quadratic biases for problems formulated as constrained quadratic models as well as additional information such as variable labels, offsets, and equality and inequality constraints.

Relevant Properties#

Example#

This example creates a single-constraint CQM and submits it to a CQM solver.

>>> from dimod import ConstrainedQuadraticModel, Binary
>>> from dwave.system import LeapHybridCQMSampler
...
>>> cqm = ConstrainedQuadraticModel()
>>> x = Binary('x')
>>> cqm.add_constraint_from_model(x, '>=', 0, 'Min x')
'Min x'
>>> sampleset = LeapHybridCQMSampler().sample_cqm(cqm)  

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 service’s dashboard and in solutions returned from SAPI.

Example#

This example sets a label on a simple bin-packing problem submitted to a CQM solver.

>>> from dimod.generators import bin_packing
>>> from dwave.system import LeapHybridCQMSampler
...
>>> cqm = bin_packing([3, 5, 1, 3], 7)
>>> sampleset = LeapHybridCQMSampler().sample_cqm(
...     cqm,
...     label="Simple example")     
Problem labels on dashboard.

Fig. 22 Problem labels on the dashboard.#

time_limit#

Specifies the maximum runtime, 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#

Example#

This illustrative example configures a time limit of 6 seconds.

>>> from dimod.generators import bin_packing
>>> from dwave.system import LeapHybridCQMSampler
...
>>> cqm = bin_packing([3, 5, 1, 3], 7)
>>> sampleset = LeapHybridCQMSampler().sample_cqm(
...     cqm,
...     time_limit=6)