Skip to content

Commit cf1f92e

Browse files
odowremi-garcia
andauthored
Fix warning on non-finite anti-ideal point (#64)
Co-authored-by: Rémi Garcia <[email protected]>
1 parent 1b86584 commit cf1f92e

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

src/MultiObjectiveAlgorithms.jl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,21 @@ function _is_scalar_status_optimal(model::Optimizer)
597597
return _is_scalar_status_optimal(status)
598598
end
599599

600+
function _warn_on_nonfinite_anti_ideal(algorithm, sense, index)
601+
alg = string(typeof(algorithm))
602+
direction = sense == MOI.MIN_SENSE ? "above" : "below"
603+
bound = sense == MOI.MIN_SENSE ? "upper" : "lower"
604+
@warn(
605+
"Unable to solve the model using the `$alg` algorithm because the " *
606+
"anti-ideal point of objective $index is not bounded $direction, and the " *
607+
"algorithm requires a finitely bounded objective domain. The easiest " *
608+
"way to fix this is to add objective $index as a constraint with a " *
609+
"finite $bound. Alteratively, ensure that all of your decision " *
610+
"variables have finite lower and upper bounds."
611+
)
612+
return
613+
end
614+
600615
for file in readdir(joinpath(@__DIR__, "algorithms"))
601616
include(joinpath(@__DIR__, "algorithms", file))
602617
end

src/algorithms/DominguezRios.jl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,7 @@ function optimize_multiobjective!(algorithm::DominguezRios, model::Optimizer)
178178
MOI.optimize!(model.inner)
179179
status = MOI.get(model.inner, MOI.TerminationStatus())
180180
if !_is_scalar_status_optimal(status)
181-
@warn(
182-
"Unable to solve problem using `DominguezRios()` because " *
183-
"objective $i does not have a finite domain.",
184-
)
181+
_warn_on_nonfinite_anti_ideal(algorithm, sense, i)
185182
return status, nothing
186183
end
187184
_, Y = _compute_point(model, variables, f_i)

src/algorithms/KirlikSayin.jl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,7 @@ function optimize_multiobjective!(algorithm::KirlikSayin, model::Optimizer)
123123
MOI.optimize!(model.inner)
124124
status = MOI.get(model.inner, MOI.TerminationStatus())
125125
if !_is_scalar_status_optimal(status)
126-
@warn(
127-
"Unable to solve problem using `KirlikSayin()` because " *
128-
"objective $i does not have a finite domain.",
129-
)
126+
_warn_on_nonfinite_anti_ideal(algorithm, sense, i)
130127
return status, nothing
131128
end
132129
_, Y = _compute_point(model, variables, f_i)

0 commit comments

Comments
 (0)