jijzepttools.model_utils#
Functions#
|
Replace binary and integer variables in the model with continuous variables. |
|
Replace binary and integer variables in the instance with continuous variables. |
Package Contents#
- continuous_relax_model(model, relaxed_vars: list[str] | None = None)#
Replace binary and integer variables in the model with continuous variables.
This function replaces binary and integer variables in the specified model with continuous variables. The variables to be replaced are determined based on the optional list provided. If no list is provided, all binary and integer variables will be replaced with continuous variables.
- Parameters:
model (T) – The problem or expression in which the replacement will be performed.
relaxed_vars (typ.Optional[list[str]], optional) – A list of variable names to be replaced. Only the variables included in this list will be replaced with continuous variables. Defaults to None, in which case all binary and integer variables will be replaced.
- Returns:
A new model with binary and integer variables replaced by continuous variables.
- Return type:
T
Note
Binary variables are replaced with continuous variables with lower bound 0 and upper bound 1.
Integer variables are replaced with continuous variables with the same lower and upper bounds as the original integer variables.
- continuous_relax_instance(instance: ommx.v1.Instance, relaxed_vars: list[str] | None = None, replace: bool = False)#
Replace binary and integer variables in the instance with continuous variables.
This function replaces binary and integer variables in the specified instance with continuous variables. The variables to be replaced are determined based on the optional list provided. If no list is provided, all binary and integer variables will be replaced with continuous variables.
- Parameters:
instance (ommx.v1.Instance) – The instance in which the replacement will be performed.
relaxed_vars (typ.Optional[list[str]], optional) – A list of variable names to be replaced. Only the variables included in this list will be replaced with continuous variables. Defaults to None, in which case all binary and integer variables will be replaced.
replace (bool, optional) – If True, the original instance will be modified. If False, a new instance will be created with the continuous variables. Defaults to False.