dimod.AdjMapBQM.add_variable

AdjMapBQM.add_variable(self, v=None, Bias bias=0.0)

Add a variable to the binary quadratic model.

Parameters:
  • v (hashable, optional) – A label for the variable. Defaults to the length of the binary quadratic model, if that label is available. Otherwise defaults to the lowest available positive integer label.
  • bias (numeric, optional, default=0) – The initial bias value for the added variable. If v is already a variable, then bias (if any) is adding to its existing linear bias.
Returns:

The label of the added variable.

Return type:

hashable

Raises:

TypeError – If the label is not hashable.