dimod.binary.BinaryQuadraticModel.energy

BinaryQuadraticModel.energy(sample, dtype: Union[numpy.dtype, None, type, numpy.typing._dtype_like._SupportsDType[numpy.dtype], str, Tuple[Any, int], Tuple[Any, Union[typing_extensions.SupportsIndex, Sequence[typing_extensions.SupportsIndex]]], List[Any], numpy.typing._dtype_like._DTypeDict, Tuple[Any, Any]] = None) Union[int, float, numpy.number][source]

Determine the energy of the given sample.

Parameters
  • sample (samples_like) – Raw sample. samples_like is an extension of NumPy’s array_like structure. See as_samples().

  • dtype – Desired NumPy data type for the energy. Matches dtype by default.

Returns

The energy.