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 with label, lhs_energy, rhs_energy, sense, activity, and violation 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 the dimod.sym.Sense of the constraint. activity is lhs_energy - rhs_energy violation is determined by the type of constraint. If violation 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.