dimod.QuadraticModel.set_quadratic#

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

Set the quadratic bias between a pair of variables in the quadratic model.

Parameters:
  • u – Variable in the quadratic model.

  • v – Variable in the quadratic model.

  • bias – Quadratic bias to set for interaction (u, v).

Raises:
  • TypeError – If u or v is not hashable.

  • ValueError – If a variable is not in the model or if u == v for binary-valued variables (self-loops are not allowed for such variables).