@@ -155,6 +155,7 @@ function _complementarity_bounds(
155155) where {T}
156156 return (zero (T), T (Inf ))
157157end
158+
158159function _complementarity_bounds (
159160 :: Type{MOI.Nonpositives} ,
160161 model,
@@ -163,6 +164,7 @@ function _complementarity_bounds(
163164) where {T}
164165 return (T (- Inf ), zero (T))
165166end
167+
166168function _complementarity_bounds (
167169 :: Type{MOI.Zeros} ,
168170 model,
@@ -171,6 +173,7 @@ function _complementarity_bounds(
171173) where {T}
172174 return (zero (T), zero (T))
173175end
176+
174177function _complementarity_bounds (
175178 :: Type{<:MOI.GreaterThan} ,
176179 model,
@@ -179,6 +182,7 @@ function _complementarity_bounds(
179182) where {T}
180183 return (MOI. Utilities. get_bounds (model, T, x2)[1 ], T (Inf ))
181184end
185+
182186function _complementarity_bounds (
183187 :: Type{<:MOI.LessThan} ,
184188 model,
@@ -187,6 +191,7 @@ function _complementarity_bounds(
187191) where {T}
188192 return (T (- Inf ), MOI. Utilities. get_bounds (model, T, x2)[2 ])
189193end
194+
190195function _complementarity_bounds (
191196 :: Type{<:MOI.Interval} ,
192197 model,
@@ -197,11 +202,15 @@ function _complementarity_bounds(
197202end
198203
199204"""
200- reformulate_as_nonlinear_program!(model, relaxation, fun, set::ComplementsWithSetType{S})
205+ reformulate_as_nonlinear_program!(
206+ model,
207+ relaxation,
208+ fun,
209+ set::ComplementsWithSetType{S},
210+ )
201211
202212Reformulate complementarity constraints as a nonlinear program using the given
203213relaxation. The set type `S` determines which bound case to use.
204-
205214"""
206215function reformulate_as_nonlinear_program! (
207216 model:: MOI.ModelLike ,
@@ -334,7 +343,6 @@ For `epsilon ≥ 0`, the complementarity constraint `0 ≤ a ⟂ b ≥ 0` is ref
3343430 ≤ b
335344a + b - sqrt((a + b)^2 + epsilon) ≤ 0
336345```
337-
338346"""
339347struct FischerBurmeisterRelaxation{T} <: AbstractComplementarityRelaxation
340348 epsilon:: T
@@ -439,13 +447,27 @@ For `epsilon ≥ 0`, the complementarity constraint `0 ≤ a ⟂ b ≥ 0` is ref
439447```
440448a . b ≤ epsilon^2
441449(a + epsilon) . (b + epsilon) ≥ epsilon^2
442-
443450```
444451"""
445452struct LiuFukushimaRelaxation{T} <: AbstractComplementarityRelaxation
446453 epsilon:: T
447454end
448455
456+ function _remove_bounds! (model:: MOI.ModelLike , x:: MOI.VariableIndex )
457+ for cidx in [
458+ MOI. ConstraintIndex {MOI.VariableIndex,MOI.Interval{Float64}} (x. value),
459+ MOI. ConstraintIndex {MOI.VariableIndex,MOI.LessThan{Float64}} (x. value),
460+ MOI. ConstraintIndex {MOI.VariableIndex,MOI.GreaterThan{Float64}} (
461+ x. value,
462+ ),
463+ ]
464+ if MOI. is_valid (model, cidx)
465+ MOI. delete (model, cidx)
466+ end
467+ end
468+ return
469+ end
470+
449471function _relax_complementarity_lower_bound! (
450472 model:: MOI.ModelLike ,
451473 relaxation:: LiuFukushimaRelaxation ,
@@ -528,7 +550,6 @@ with the function `ϕ`:
528550 -0.5 ((a -epsilon)^2 + (b - epsilon)^2) otherwise
529551
530552```
531-
532553"""
533554struct KanzowSchwarzRelaxation{T} <: AbstractComplementarityRelaxation
534555 epsilon:: T
0 commit comments