dwave.optimization.model.Model.iter_decisions#

Model.iter_decisions()#

Iterate over all decision variables in the model.

Examples

This example adds a single decision symbol 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 ...>
>>> decisions = next(model.iter_decisions())