diff --git a/src/algorithms/KirlikSayin.jl b/src/algorithms/KirlikSayin.jl index add1ac4..d60d09e 100644 --- a/src/algorithms/KirlikSayin.jl +++ b/src/algorithms/KirlikSayin.jl @@ -178,5 +178,5 @@ function minimize_multiobjective!(algorithm::KirlikSayin, model::Optimizer) MOI.delete.(model, ε_constraints) MOI.delete(model, zₖ_constraint) end - return status, solutions + return status, filter_nondominated(MOI.MIN_SENSE, solutions) end diff --git a/src/algorithms/TambyVanderpooten.jl b/src/algorithms/TambyVanderpooten.jl index fb3273a..85ac16f 100644 --- a/src/algorithms/TambyVanderpooten.jl +++ b/src/algorithms/TambyVanderpooten.jl @@ -180,19 +180,21 @@ function minimize_multiobjective!( MOI.delete.(model, ε_constraints) MOI.delete(model, y_k_constraint) push!(V[k], (u, Y)) - if Y ∉ U_N[u][k] + # We want `if !(Y in U_N[u][k])` but this tests exact equality. We want + # an approximate comparison. + if all(!isapprox(Y; atol = 1e-6), U_N[u][k]) _update_search_region(U_N, Y, yN) solutions[Y] = X end bounds_to_remove = Vector{Float64}[] for u_i in keys(U_N) for k in 1:n - if u_i[k] == yI[k] + if isapprox(u_i[k], yI[k]; atol = 1e-6) push!(bounds_to_remove, u_i) else for (u_j, y_j) in V[k] if all(_project(u_i, k) .<= _project(u_j, k)) && - (y_j[k] == u_i[k]) + isapprox(y_j[k], u_i[k]; atol = 1e-6) push!(bounds_to_remove, u_i) end end @@ -205,6 +207,5 @@ function minimize_multiobjective!( end end end - solutions = [SolutionPoint(X, Y) for (Y, X) in solutions] - return status, solutions + return status, [SolutionPoint(X, Y) for (Y, X) in solutions] end diff --git a/test/problems.jl b/test/problems.jl index 146cbd1..192afe0 100644 --- a/test/problems.jl +++ b/test/problems.jl @@ -472,4 +472,28 @@ function test_issue_122(model) return end +function test_issue_133(model) + #!format: off + p = Float64[ + 33 90 96 75 1 69 100 50 63 61 59 95 58 10 77 30 86 89 82 51 38 33 73 54 91 89 95 82 48 67 + 55 36 80 58 20 96 75 57 24 68 37 58 8 85 27 25 71 53 47 72 57 64 1 8 12 68 3 80 20 90 + 22 40 50 73 44 65 12 26 13 77 14 68 71 35 54 98 45 95 98 19 18 38 14 51 37 48 35 97 95 36 + ] + w = Float64[ + 22, 13, 10, 25, 4, 15, 17, 15, 15, 28, 14, 13, 2, 23, 6, 22, 18, 6, 23, + 21, 7, 7, 14, 4, 3, 27, 10, 5, 9, 10 + ] + #!format: on + x = MOI.add_variables(model, length(w)) + MOI.add_constraint.(model, x, MOI.ZeroOne()) + MOI.set(model, MOI.ObjectiveSense(), MOI.MAX_SENSE) + f = MOI.Utilities.vectorize(p * x) + MOI.set(model, MOI.ObjectiveFunction{typeof(f)}(), f) + MOI.add_constraint(model, w' * x, MOI.LessThan(204.0)) + MOI.optimize!(model) + @test MOI.get(model, MOI.TerminationStatus()) == MOI.OPTIMAL + @test MOI.get(model, MOI.ResultCount()) == 95 + return +end + end # module Problems