linopy.variables.Variable.relax

Contents

linopy.variables.Variable.relax#

Variable.relax()#

Relax the integrality of this variable.

Converts binary or integer variables to continuous. The original type is stored in the model’s _relaxed_registry so that unrelax() can restore it.

Semi-continuous variables are not supported and will raise a NotImplementedError.

For binary variables, the existing [0, 1] bounds are preserved, which is the correct LP relaxation. For integer variables, the existing bounds are preserved as-is.

If the variable is already continuous, this method is a no-op.