dimod.ConstrainedQuadraticModel.fix_variable#

ConstrainedQuadraticModel.fix_variable(v: Hashable, value: float, *, cascade: bool | None = None) dict[Hashable, float][source]#

Fix the value of a variable in the model.

Note that this function does not test feasibility.

Parameters:
  • v – Variable label for a variable in the model.

  • value – Value to assign variable v.

  • cascade – Deprecated. Does nothing.

Returns:

An empty dictionary, for legacy reasons.

Raises:

ValueError – If v is not the label of a variable in the model.

Deprecated since version 0.12.0: The cascade keyword argument will be removed in 0.14.0. It currently does nothing.