dimod.ConstrainedQuadraticModel.check_feasible

ConstrainedQuadraticModel.check_feasible(sample_like, rtol: float = 1e-06, atol: float = 1e-08) bool[source]

Return the feasibility of the given sample.

A sample is feasible if all constraints are satisfied. A constraint’s satisfaction is tested using the following equation:

\[violation <= (atol + rtol * | rhs\_energy | )\]

where violation and rhs_energy are as returned by iter_constraint_data().

Parameters
  • sample_like – A sample.

  • rtol – The relative tolerance.

  • atol – the absolute tolerance.

Returns

True if the sample is feasible (given the tolerances).