|
142 | 142 | PenaltyRelaxation( |
143 | 143 | penalties = Dict{MOI.ConstraintIndex,Float64}(); |
144 | 144 | default::Union{Nothing,T} = 1.0, |
145 | | - no_warning_skip_constraint::Bool = false, |
| 145 | + warn::Bool = true, |
146 | 146 | ) |
147 | 147 |
|
148 | 148 | A problem modifier that, when passed to [`MOI.modify`](@ref), destructively |
@@ -189,8 +189,7 @@ cannot be modified in-place. |
189 | 189 | To modify variable bounds, rewrite them as linear constraints. |
190 | 190 |
|
191 | 191 | If a constraint type can not be modified, a warning is logged and the |
192 | | -constraint is skipped. This can be disabled by setting |
193 | | -`no_warning_skip_constraint = true`. |
| 192 | +constraint is skipped. This can be disabled by setting `warn = false`. |
194 | 193 |
|
195 | 194 | ## Example |
196 | 195 |
|
@@ -247,14 +246,14 @@ true |
247 | 246 | mutable struct PenaltyRelaxation{T} |
248 | 247 | default::Union{Nothing,T} |
249 | 248 | penalties::Dict{MOI.ConstraintIndex,T} |
250 | | - no_warning_skip_constraint::Bool |
| 249 | + warn::Bool |
251 | 250 |
|
252 | 251 | function PenaltyRelaxation( |
253 | 252 | p::Dict{MOI.ConstraintIndex,T}; |
254 | 253 | default::Union{Nothing,T} = one(T), |
255 | | - no_warning_skip_constraint::Bool = false, |
| 254 | + warn::Bool = true, |
256 | 255 | ) where {T} |
257 | | - return new{T}(default, p, no_warning_skip_constraint) |
| 256 | + return new{T}(default, p, warn) |
258 | 257 | end |
259 | 258 | end |
260 | 259 |
|
@@ -293,7 +292,7 @@ function _modify_penalty_relaxation( |
293 | 292 | map[ci] = MOI.modify(model, ci, ScalarPenaltyRelaxation(penalty)) |
294 | 293 | catch err |
295 | 294 | if err isa MethodError && err.f == MOI.modify |
296 | | - if !relax.no_warning_skip_constraint |
| 295 | + if relax.warn |
297 | 296 | @warn( |
298 | 297 | "Skipping PenaltyRelaxation for ConstraintIndex{$F,$S}" |
299 | 298 | ) |
|
0 commit comments