dimod.variables.Variables.index

Variables.index()[source]

Return the index of v.

Parameters
  • v (hashable) – 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 not present and permissive is

  • False.