dimod.binary.BinaryQuadraticModel.energies¶
- BinaryQuadraticModel.energies(samples_like, 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) numpy.ndarray [source]¶
Determine the energies of the given samples-like.
- Parameters
samples_like (samples_like) – Raw samples. samples_like is an extension of NumPy’s array_like structure. See
as_samples()
.dtype – Desired NumPy data type for the energy. Defaults to
float64
.
- Returns
Energies for the samples.
Examples
>>> bqm = dimod.BinaryQuadraticModel({}, {("x0", "x1"): -1}, "BINARY") >>> bqm.energies([{"x0": 1, "x1": 1},{"x0": 0, "x1": 1}]) array([-1., 0.])
See also the example under
energy()
.