dimod.testing.asserts.assert_response_energies#

assert_response_energies(response, bqm, precision=7)[source]#

Assert that each sample in the given response has the correct energy.

Parameters:
  • response (SampleSet) – Response as returned by a dimod sampler.

  • bqm (BinaryQuadraticModel) – Binary quadratic model (BQM) used to generate the samples.

  • precision (int, optional, default=7) – Equality of energy is tested by calculating the difference between the response’s sample energy and that returned by BQM’s energy(), rounding to the closest multiple of 10 to the power of minus precision.

Raises:
  • AssertionError – If any of the samples in the response do not match their

  • associated energy.