Skip to content

Commit ce9435c

Browse files
authored
Ensure filter_nondominated is called for all algorithms (#168)
1 parent f1d87ee commit ce9435c

File tree

6 files changed

+8
-10
lines changed

6 files changed

+8
-10
lines changed

src/MultiObjectiveAlgorithms.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -869,8 +869,8 @@ function _optimize!(model::Optimizer)
869869
status, solutions = optimize_multiobjective!(algorithm, model)
870870
model.termination_status = status
871871
if solutions !== nothing
872-
model.solutions = solutions
873-
_sort!(model.solutions, MOI.get(model, MOI.ObjectiveSense()))
872+
sense = MOI.get(model, MOI.ObjectiveSense())
873+
model.solutions = filter_nondominated(sense, solutions)
874874
end
875875
if !model.silent
876876
_print_footer(stdout, model)

src/algorithms/EpsilonConstraint.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,5 +133,5 @@ function minimize_multiobjective!(
133133
bound = min(Y[1] - constant - ε, bound - ε)
134134
end
135135
MOI.delete(model, ci)
136-
return status, filter_nondominated(MOI.MIN_SENSE, solutions)
136+
return status, solutions
137137
end

src/algorithms/KirlikSayin.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,5 +194,5 @@ function minimize_multiobjective!(algorithm::KirlikSayin, model::Optimizer)
194194
MOI.delete.(model, ε_constraints)
195195
MOI.delete(model, zₖ_constraint)
196196
end
197-
return status, filter_nondominated(MOI.MIN_SENSE, solutions)
197+
return status, solutions
198198
end

src/algorithms/Lexicographic.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,7 @@ function optimize_multiobjective!(algorithm::Lexicographic, model::Optimizer)
110110
break
111111
end
112112
end
113-
sense = MOI.get(model.inner, MOI.ObjectiveSense())
114-
return status, filter_nondominated(sense, solutions)
113+
return status, solutions
115114
end
116115

117116
function _solve_in_sequence(

src/algorithms/RandomWeighting.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,5 +81,5 @@ function optimize_multiobjective!(algorithm::RandomWeighting, model::Optimizer)
8181
end
8282
solutions = filter_nondominated(sense, solutions)
8383
end
84-
return MOI.OPTIMAL, filter_nondominated(sense, solutions)
84+
return MOI.OPTIMAL, solutions
8585
end

test/algorithms/Sandwiching.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,12 @@ function test_molp_2()
9393
C = Float64[3 -2; -1 2]
9494
A = Float64[-4 -8; 3 -6; 4 -2; 1 0; -1 3; -2 4; -6 3]
9595
b = Float64[-8, 6, 14, 6, 15, 18, 9]
96-
results = sort([
97-
[1.0, 5.0] => [-7.0, 9.0], # not sure about this
96+
results = [
9897
[3.0, 6.0] => [-3.0, 9.0],
9998
[4.0, 1.0] => [10.0, -2.0],
10099
[6.0, 5.0] => [8.0, 4.0],
101100
[6.0, 7.0] => [4.0, 8.0],
102-
])
101+
]
103102
sense = MOI.MAX_SENSE
104103
return _test_molp(C, A, b, results, sense)
105104
end

0 commit comments

Comments
 (0)