dimod.variables.Variables.index#

Variables.index(v, permissive=False)[source]#

Return the index of v.

Parameters:
  • v (Variable) – A variable.

  • permissive (bool, optional, default=False) – If True, the variable will be inserted, guaranteeing an index can be returned.

Returns:

The index of the given variable.

Return type:

int

Raises:

ValueError – If the variable is present and permissive is False.