@@ -19,7 +19,7 @@ function hull_reformulation!(constr::ConstraintRef{<:AbstractModel, MOI.Constrai
19
19
# replace each variable with its disaggregated version
20
20
for var_ref in get_constraint_variables (constr)
21
21
is_binary (var_ref) && continue # NOTE: binaries from nested disjunctions are not disaggregated and don't need to be swapped out
22
- var_ref in m. ext[:disaggregated_variables ] && continue # disaggregated variables are not touched
22
+ var_ref in values ( m. ext[:disaggregated_variables ]) && continue # disaggregated variables are not touched
23
23
# get disaggregated variable reference
24
24
var_name_i = name_disaggregated_variable (var_ref, bin_var, i)
25
25
var_i_ref = variable_by_name (m, var_name_i)
@@ -85,7 +85,7 @@ function disaggregate_variables(m::Model, disj, bin_var)
85
85
bounds_dict = :variable_bounds_dict in keys (obj_dict) ? obj_dict[:variable_bounds_dict ] : Dict () # NOTE: should pass as an keyword argument
86
86
for var in var_refs
87
87
is_binary (var) && continue # NOTE: don't disaggregate binary variables from nested disjunctions
88
- var in m. ext[:disaggregated_variables ] && continue # skip already disaggregated variables
88
+ var in values ( m. ext[:disaggregated_variables ]) && continue # skip already disaggregated variables
89
89
# define UB and LB
90
90
LB, UB = get_bounds (var, bounds_dict)
91
91
# disaggregate variable and add bounding constraints
@@ -95,10 +95,7 @@ function disaggregate_variables(m::Model, disj, bin_var)
95
95
var_name_i = Symbol (var_name_i_str)
96
96
# create disaggregated variable
97
97
var_i = add_disaggregated_variable (m, var, LB, UB, var_name_i_str)
98
- push! (
99
- m. ext[:disaggregated_variables ],
100
- var_i
101
- )
98
+ m. ext[:disaggregated_variables ][var_name_i_str] = var_i
102
99
# apply bounding constraints on disaggregated variable
103
100
var_i_lb = " $(var_name_i) _lb"
104
101
var_i_ub = " $(var_name_i) _ub"
0 commit comments