set_var_valid_value
(function from pyomo.contrib.mindtpy.util
)
- pyomo.contrib.mindtpy.util.set_var_valid_value(var, var_val, integer_tolerance, zero_tolerance, ignore_integrality)[source]
This function tries to set a valid value for variable with the given input. Rounds to Binary/Integer if necessary. Sets to zero for NonNegativeReals if necessary.
- Parameters:
var (Var) – The variable that needs to set value.
var_val (float) – The desired value to set for var.
integer_tolerance (float) – Tolerance on integral values.
zero_tolerance (float) – Tolerance on variable equal to zero.
ignore_integrality (bool, optional) – Whether to ignore the integrality of integer variables, by default False.
- Raises:
ValueError – Cannot successfully set the value to the variable.