@@ -138,7 +138,11 @@ function MOI.modify(model::MOI.ModelLike, relax::PenaltyRelaxation{T}) where {T}
138138    end 
139139    map =  Dict {MOI.ConstraintIndex,MOI.ScalarAffineFunction{T}} ()
140140    for  (F, S) in  MOI. get (model, MOI. ListOfConstraintTypesPresent ())
141-         _modify_penalty_relaxation (map, model, relax, F, S)
141+         if  MOI. supports (model, relax, MOI. ConstraintIndex{F,S})
142+             _modify_penalty_relaxation (map, model, relax, F, S)
143+         else 
144+             @warn (" Skipping PenaltyRelaxation of constraints of type $F -in-$S "  )
145+         end 
142146    end 
143147    return  map
144148end 
@@ -161,20 +165,20 @@ function _modify_penalty_relaxation(
161165    return  map
162166end 
163167
164- function  MOI. modify (
168+ function  MOI. supports (
169+     :: MOI.ModelLike ,
170+     :: PenaltyRelaxation{T} ,
171+     :: Type{<:MOI.ConstraintIndex{F,<:MOI.AbstractScalarSet}} ,
172+ ) where  {T,F<: Union{MOI.ScalarAffineFunction{T},MOI.ScalarQuadraticFunction{T}} }
173+     return  true 
174+ end 
175+ 
176+ function  MOI. supports (
165177    :: MOI.ModelLike ,
166-     ci:: MOI.ConstraintIndex ,
167178    :: PenaltyRelaxation ,
179+     :: Type{<:MOI.ConstraintIndex} ,
168180)
169-     #  We use this fallback to avoid ambiguity errors that would occur if we
170-     #  added {F,S} directly to the argument.
171-     _eltype (:: MOI.ConstraintIndex{F,S} ) where  {F,S} =  F, S
172-     F, S =  _eltype (ci)
173-     @warn (
174-         " Skipping PenaltyRelaxation of constraints of type $F -in-$S "  ,
175-         maxlog =  1 ,
176-     )
177-     return 
181+     return  false 
178182end 
179183
180184function  MOI. modify (
0 commit comments