dimod.ConstrainedQuadraticModel.relabel_variables

ConstrainedQuadraticModel.relabel_variables(mapping: Mapping[Hashable, Hashable], inplace: bool = True) ConstrainedQuadraticModel[source]

Relabel the variables of the objective and constraints.

Parameters
  • mapping – Mapping from the old variable labels to the new.

  • inplace – Relabels the model’s variables in-place if True, or returns a copy of the model with relabeled variables if False.

Returns

A constrained quadratic model. Itself by default, or a copy if inplace is set to False.