dimod.variables.Variables.index

Variables.index()[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.