dwave.optimization.model.Model.iter_constraints#
- Model.iter_constraints()#
Iterate over all constraints in the model.
Examples
This example adds a single constraint to a model and iterates over it.
>>> from dwave.optimization.model import Model >>> model = Model() >>> i = model.integer() >>> c = model.constant(5) >>> model.add_constraint(i <= c) <dwave.optimization.symbols.LessEqual at ...> >>> constraints = next(model.iter_constraints())