dimod.ConstrainedQuadraticModel.iter_constraint_data¶
- ConstrainedQuadraticModel.iter_constraint_data(sample_like) Iterator[dimod.constrained.ConstraintData] [source]¶
Yield information about the constraints for the given sample.
- Parameters
sample_like – A sample.
- Yields
A
collections.namedtuple
withlabel
,lhs_energy
,rhs_energy
,sense
,activity
, andviolation
fields.label
is the constraint label.lhs_energy
is the energy of the left hand side of the constraint.rhs_energy
is the energy of the right hand side of the constraint.sense
is thedimod.sym.Sense
of the constraint.activity
islhs_energy - rhs_energy
violation
is determined by the type of constraint. Ifviolation
is positive, that means that the constraint has been violated by that amount. If it is negative, that means that the constraint has been satisfied by the amount.