@@ -17,6 +17,22 @@ function reformulate_disjunction(m::Model, disj...; bin_var, reformulation, para
17
17
end
18
18
reformulate (disj, bin_var, reformulation, param)
19
19
20
+ # show new constraints as a Dict
21
+ new_constraints = Dict {Symbol,Any} (
22
+ Symbol (bin_var," [$i ]" ) => disj[i] for i in eachindex (disj)
23
+ )
24
+ new_constraints[Symbol (bin_var," _XOR" )] = constraint_by_name (m, " XOR(disj_$bin_var )" )
25
+ for var in vars
26
+ agg_con_name = " $(var) _$(bin_var) _aggregation"
27
+ agg_con = constraint_by_name (m, agg_con_name)
28
+ if ! isnothing (agg_con)
29
+ new_constraints[Symbol (agg_con_name)] = agg_con
30
+ end
31
+ end
32
+ return new_constraints
33
+
34
+ # remove model.optimize_hook ?
35
+
20
36
# return m[bin_var]
21
37
end
22
38
@@ -26,7 +42,13 @@ function check_disjunction!(m, disj)
26
42
if constr isa Tuple # NOTE: Make it so that it must be bundled in a Tuple (not Array), to avoid confusing it with a Variable Array
27
43
constr_list = []
28
44
for constr_j in constr
29
- push! (constr_list, check_constraint! (m, constr_j))
45
+ if constr_j isa Tuple # if using a begin..end block, a tuple of constraints is created (loop through these)
46
+ for constr_jk in constr_j
47
+ push! (constr_list, check_constraint! (m, constr_jk))
48
+ end
49
+ else
50
+ push! (constr_list, check_constraint! (m, constr_j))
51
+ end
30
52
end
31
53
push! (disj_new, Tuple (constr_list))
32
54
elseif constr isa Union{ConstraintRef, Array, Containers. DenseAxisArray, Containers. SparseAxisArray}
0 commit comments