dimod.binary.BinaryQuadraticModel.from_ising

classmethod BinaryQuadraticModel.from_ising(h: Union[Mapping, Sequence], J: Mapping, offset: float = 0)[source]

Create a binary quadratic model from an Ising problem.

Parameters
  • h – Linear biases of the Ising problem. If a dict, should be of the form {v: bias, ...} where v is a spin-valued variable and bias is its associated bias. If a list, it is treated as a list of biases where the indices are the variable labels.

  • J – Quadratic biases of the Ising problem.

  • offset (optional, default=0.0) – Constant offset.

Returns

A spin-valued binary quadratic model.