linopy.variables.Variable.fix

Contents

linopy.variables.Variable.fix#

Variable.fix(value=None, decimals=8, overwrite=True)#

Fix the variable to a given value by adding an equality constraint.

If no value is given, the current solution value is used.

Parameters:
  • value (float/array_like, optional) – Value to fix the variable to. If None, the current solution is used.

  • decimals (int, optional) – Number of decimal places to round continuous variables to. Integer and binary variables are always rounded to 0 decimal places. Default is 8.

  • overwrite (bool, optional) – If True (default), overwrite an existing fix constraint for this variable. If False, raise an error if the variable is already fixed.