diff --git a/src/MultiObjectiveAlgorithms.jl b/src/MultiObjectiveAlgorithms.jl index 2882a60..a4dccd3 100644 --- a/src/MultiObjectiveAlgorithms.jl +++ b/src/MultiObjectiveAlgorithms.jl @@ -869,8 +869,8 @@ function _optimize!(model::Optimizer) status, solutions = optimize_multiobjective!(algorithm, model) model.termination_status = status if solutions !== nothing - model.solutions = solutions - _sort!(model.solutions, MOI.get(model, MOI.ObjectiveSense())) + sense = MOI.get(model, MOI.ObjectiveSense()) + model.solutions = filter_nondominated(sense, solutions) end if !model.silent _print_footer(stdout, model) diff --git a/src/algorithms/EpsilonConstraint.jl b/src/algorithms/EpsilonConstraint.jl index 3bcdb94..a8bad83 100644 --- a/src/algorithms/EpsilonConstraint.jl +++ b/src/algorithms/EpsilonConstraint.jl @@ -133,5 +133,5 @@ function minimize_multiobjective!( bound = min(Y[1] - constant - ε, bound - ε) end MOI.delete(model, ci) - return status, filter_nondominated(MOI.MIN_SENSE, solutions) + return status, solutions end diff --git a/src/algorithms/KirlikSayin.jl b/src/algorithms/KirlikSayin.jl index 8f36040..5e7ee0d 100644 --- a/src/algorithms/KirlikSayin.jl +++ b/src/algorithms/KirlikSayin.jl @@ -194,5 +194,5 @@ function minimize_multiobjective!(algorithm::KirlikSayin, model::Optimizer) MOI.delete.(model, ε_constraints) MOI.delete(model, zₖ_constraint) end - return status, filter_nondominated(MOI.MIN_SENSE, solutions) + return status, solutions end diff --git a/src/algorithms/Lexicographic.jl b/src/algorithms/Lexicographic.jl index 7ca354d..821827a 100644 --- a/src/algorithms/Lexicographic.jl +++ b/src/algorithms/Lexicographic.jl @@ -110,8 +110,7 @@ function optimize_multiobjective!(algorithm::Lexicographic, model::Optimizer) break end end - sense = MOI.get(model.inner, MOI.ObjectiveSense()) - return status, filter_nondominated(sense, solutions) + return status, solutions end function _solve_in_sequence( diff --git a/src/algorithms/RandomWeighting.jl b/src/algorithms/RandomWeighting.jl index 10182c8..d9d287d 100644 --- a/src/algorithms/RandomWeighting.jl +++ b/src/algorithms/RandomWeighting.jl @@ -81,5 +81,5 @@ function optimize_multiobjective!(algorithm::RandomWeighting, model::Optimizer) end solutions = filter_nondominated(sense, solutions) end - return MOI.OPTIMAL, filter_nondominated(sense, solutions) + return MOI.OPTIMAL, solutions end diff --git a/test/algorithms/Sandwiching.jl b/test/algorithms/Sandwiching.jl index ff74b1f..c5df61b 100644 --- a/test/algorithms/Sandwiching.jl +++ b/test/algorithms/Sandwiching.jl @@ -93,13 +93,12 @@ function test_molp_2() C = Float64[3 -2; -1 2] A = Float64[-4 -8; 3 -6; 4 -2; 1 0; -1 3; -2 4; -6 3] b = Float64[-8, 6, 14, 6, 15, 18, 9] - results = sort([ - [1.0, 5.0] => [-7.0, 9.0], # not sure about this + results = [ [3.0, 6.0] => [-3.0, 9.0], [4.0, 1.0] => [10.0, -2.0], [6.0, 5.0] => [8.0, 4.0], [6.0, 7.0] => [4.0, 8.0], - ]) + ] sense = MOI.MAX_SENSE return _test_molp(C, A, b, results, sense) end