Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 4 additions & 17 deletions ext/Polyhedra/GeneralDichotomy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,15 @@ function MOA.minimize_multiobjective!(
for (i, weight) in enumerate(weights)
sol_z = weight.w' * new_sol.y
if sol_z < weight.z - atol
# The new solution is strictly better than the previous.
if length(weight.adj_bnd) < n_obj
weight.removed = true
n_removed += 1
else
end
union!(polytope_sol, weight.adj_sol)
if !weight.removed
weight.adj_sol = Int[new_sol_ind]
weight.z = sol_z
end
union!(polytope_sol, weight.adj_sol)
elseif sol_z <= weight.z + atol
# The new solution is equal in value to the previous.
push!(weight.adj_sol, new_sol_ind)
Expand All @@ -115,20 +115,7 @@ function MOA.minimize_multiobjective!(
for idx in eachindex(Polyhedra.points(poly))
w = get(poly, idx)
z = w' * new_sol.y
if (i = get(equal_weights, _round(w; atol), nothing)) !== nothing
# Update an existing extreme weight.
weights[i].z = z
weights[i].tested = true
weights[i].adj_sol = Int[new_sol_ind]
if length(weights[i].adj_bnd) < n_obj - 1
if !weights[i].removed
weights[i].removed = true
n_removed += 1
end
else
weights[i].removed = false
end
else
if (i = get(equal_weights, _round(w; atol), nothing)) === nothing
# Insert a new extreme weight.
adj_bnd, adj_sol = Int[], Int[]
for elt in Polyhedra.incidenthalfspaceindices(poly, idx)
Expand Down
8 changes: 8 additions & 0 deletions test/algorithms/test_GeneralDichotomy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,14 @@ function test_vlp()
MOI.set(model, MOI.Silent(), true)
MOI.set(model, MOA.Algorithm(), MOA.GeneralDichotomy())
MOI.optimize!(model)
N = MOI.get(model, MOI.ResultCount())
y_sol = map(1:N) do i
return round.(Int, 10 .* MOI.get(model, MOI.ObjectiveValue(i)))
end
Y_N = [[15, 15, 0], [5, 10, 5], [5, 5, 10], [10, 5, 5]]
for i in length(Y_N)
@test Y_N[i] ∈ y_sol
end
return
end

Expand Down
Loading