@@ -8,24 +8,24 @@ function reformulate_disjunction(
88 method:: MBM
99)
1010 ref_cons = Vector {JuMP.AbstractConstraint} ()
11- for d in disj. indicators
12- # Make a copy to avoid modifying during iteration
13- constraints = copy (_indicator_to_constraints (model)[d])
14- for cref in constraints
15- con = JuMP. constraint_object (cref)
16- if con isa JuMP. ScalarConstraint{<: Any , <: MOI.Interval }
17- # Create lower and upper bound constraints
18- lower_con = JuMP. build_constraint (error, con. func,
19- MOI. GreaterThan (con. set. lower))
20- upper_con = JuMP. build_constraint (error, con. func,
21- MOI. LessThan (con. set. upper))
22- # Create new disjunct constraints
23- JuMP. add_constraint (model,_DisjunctConstraint (lower_con, d))
24- JuMP. add_constraint (model,_DisjunctConstraint (upper_con, d))
25- JuMP. delete (model, cref)
26- end
27- end
28- end
11+ # for d in disj.indicators
12+ # # Make a copy to avoid modifying during iteration
13+ # constraints = copy(_indicator_to_constraints(model)[d])
14+ # for cref in constraints
15+ # con = JuMP.constraint_object(cref)
16+ # if con isa JuMP.ScalarConstraint{<:Any, <:MOI.Interval}
17+ # # Create lower and upper bound constraints
18+ # lower_con = JuMP.build_constraint(error, con.func,
19+ # MOI.GreaterThan(con.set.lower))
20+ # upper_con = JuMP.build_constraint(error, con.func,
21+ # MOI.LessThan(con.set.upper))
22+ # # Create new disjunct constraints
23+ # JuMP.add_constraint(model,_DisjunctConstraint(lower_con, d))
24+ # JuMP.add_constraint(model,_DisjunctConstraint(upper_con, d))
25+ # JuMP.delete(model, cref)
26+ # end
27+ # end
28+ # end
2929 for d in disj. indicators
3030 method. conlvref = [x for x in disj. indicators if x != d]
3131 _reformulate_disjunct (model, ref_cons, d, method)
@@ -191,6 +191,31 @@ function reformulate_disjunct_constraint(
191191 return [lower_con, upper_con]
192192end
193193
194+ function reformulate_disjunct_constraint (
195+ model:: JuMP.AbstractModel ,
196+ con:: JuMP.ScalarConstraint{T, S} ,
197+ bconref:: Union {Dict{<: LogicalVariableRef ,<: JuMP.AbstractVariableRef },
198+ Dict{<: LogicalVariableRef ,<: JuMP.GenericAffExpr }},
199+ method:: MBM
200+ ) where {T, S <: _MOI.Interval }
201+ set_values = _set_values (con. set)
202+ upper_func = JuMP. @expression (model,
203+ con. func - sum (method. M[i] * bconref[i] for i in keys (method. M))
204+ )
205+ upper_con = JuMP. build_constraint (error, upper_func,
206+ MOI. LessThan (set_values[2 ])
207+ )
208+
209+ lower_func = JuMP. @expression (model,
210+ con. func + sum (method. M[i] * bconref[i] for i in keys (method. M))
211+ )
212+ lower_con = JuMP. build_constraint (error, lower_func,
213+ MOI. GreaterThan (set_values[1 ])
214+ )
215+
216+ return [lower_con, upper_con]
217+ end
218+
194219function reformulate_disjunct_constraint (
195220 :: JuMP.AbstractModel ,
196221 :: F ,
@@ -300,6 +325,29 @@ function _maximize_M(
300325 )
301326end
302327
328+ function _maximize_M (
329+ model:: JuMP.AbstractModel ,
330+ objective:: JuMP.ScalarConstraint{T, S} ,
331+ constraints:: Vector{<:DisjunctConstraintRef} ,
332+ method:: MBM
333+ ) where {T, S <: _MOI.Interval }
334+ set_values = _set_values (objective. set) # Returns (lower, upper)
335+ return max (
336+ _mini_model (
337+ model,
338+ JuMP. ScalarConstraint (objective. func, MOI. GreaterThan (set_values[1 ])),
339+ constraints,
340+ method
341+ ),
342+ _mini_model (
343+ model,
344+ JuMP. ScalarConstraint (objective. func, MOI. LessThan (set_values[2 ])),
345+ constraints,
346+ method
347+ )
348+ )
349+ end
350+
303351function _maximize_M (
304352 :: JuMP.AbstractModel ,
305353 :: F ,
@@ -351,7 +399,8 @@ function _mini_model(
351399) where {T,S <: Union{_MOI.Nonpositives, _MOI.Nonnegatives,_MOI.Zeros, MOI.EqualTo, MOI.Interval} ,
352400 C <: Union{DisjunctConstraintRef, DisjunctionRef} }
353401 error (" This type of constraints and objective constraint has " *
354- " not been implemented for MBM subproblems" )
402+ " not been implemented for MBM subproblems \n " *
403+ " Objective: $(T) $(S) \n Constraints: $(C) " )
355404end
356405
357406# ###############################################################################
0 commit comments