dwave.optimization.model.Model.add_constraint#
- Model.add_constraint(value)#
Add a constraint to the model.
- Parameters:
value – Value that must evaluate to True for the state of the model to be feasible.
Examples
This example adds a single constraint to a model.
>>> from dwave.optimization.model import Model >>> model = Model() >>> i = model.integer() >>> c = model.constant(5) >>> model.add_constraint(i <= c)