dimod.QuadraticModel.add_quadratic#

QuadraticModel.add_quadratic(u: Hashable, v: Hashable, bias: float | floating | integer)[source]#

Add quadratic bias to a pair of variables.

Parameters:
  • u – Variable in the quadratic model.

  • v – Variable in the quadratic model.

  • bias – Quadratic bias for the interaction.

Raises:
  • ValueError – If a specified variable is not in the model.

  • ValueError – If any self-loops are given on binary-valued variables. E.g. (u, u, bias) is not a valid triplet for spin variables.