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#
maximum_number_of_variables defines the maximum number of problem variables for hybrid solvers.
maximum_number_of_biases and maximum_number_of_quadratic_variables define the maximum number of problem biases for hybrid solvers.
maximum_number_of_constraints defines the maximum number of constraints accepted by the solver.
minimum_time_limit_s and maximum_time_limit_hrs define the runtime duration for hybrid 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.
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")

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#
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 runtime 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 runtime for the submitted problem and minimum_time_limit_s.
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)