@@ -11,13 +11,16 @@ Perform Big-M reformulaiton on a nonlinear constraint at index k of constraint j
11
11
12
12
Perform Big-M reformulation on a constraint at index k of constraint j in disjunct i.
13
13
"""
14
- function big_m_reformulation! (constr:: ConstraintRef , bin_var, M, i, j, k)
15
- M = get_reform_param (M, i, j, k; constr)
14
+ function big_m_reformulation! (constr:: ConstraintRef , bin_var, M0, i, j, k)
15
+ M = get_reform_param (M0, i, j, k; constr)
16
+ if ! ismissing (M0) && constraint_object (constr). set isa MOI. GreaterThan && M > 0
17
+ M = - M # if a positive bigM value was provided and constraint is GreaterThan, use the negative of this number (-M*(1-y) <= func)
18
+ end
16
19
add_to_function_constant (constr, - M)
17
- set_normalized_coefficient (constr, constr. model[bin_var][i] , M)
20
+ set_normalized_coefficient (constr, constr. model[bin_var][i], M)
18
21
end
19
- function big_m_reformulation! (constr:: NonlinearConstraintRef , bin_var, M , i, j, k)
20
- M = get_reform_param (M , i, j, k; constr)
22
+ function big_m_reformulation! (constr:: NonlinearConstraintRef , bin_var, M0 , i, j, k)
23
+ M = get_reform_param (M0 , i, j, k; constr)
21
24
# create symbolic variables (using Symbolics.jl)
22
25
for var_ref in get_constraint_variables (constr)
23
26
symbolic_variable (var_ref)
0 commit comments