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
7 changes: 4 additions & 3 deletions ext/MultiObjectiveAlgorithmsPolyhedraExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ function MOA.minimize_multiobjective!(
n = MOI.output_dimension(model.f)
scalars = MOI.Utilities.scalarize(model.f)
status = MOI.OPTIMAL
optimizer = typeof(model.inner.optimizer)
δ_OPS_optimizer = optimizer()
MOI.set(δ_OPS_optimizer, MOI.Silent(), true)
δ_OPS_optimizer = MOI.instantiate(model.optimizer_factory)
if MOI.supports(δ_OPS_optimizer, MOI.Silent())
MOI.set(δ_OPS_optimizer, MOI.Silent(), true)
end
y = MOI.add_variables(δ_OPS_optimizer, n)
anchors = Dict{Vector{Float64},Dict{MOI.VariableIndex,Float64}}()
yI, yUB = zeros(n), zeros(n)
Expand Down
2 changes: 2 additions & 0 deletions src/MultiObjectiveAlgorithms.jl
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ mutable struct Optimizer <: MOI.AbstractOptimizer
ideal_point::Vector{Float64}
compute_ideal_point::Bool
subproblem_count::Int
optimizer_factory::Any

function Optimizer(optimizer_factory)
return new(
Expand All @@ -137,6 +138,7 @@ mutable struct Optimizer <: MOI.AbstractOptimizer
Float64[],
default(ComputeIdealPoint()),
0,
optimizer_factory,
)
end
end
Expand Down
5 changes: 4 additions & 1 deletion src/algorithms/Sandwiching.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
"""
Sandwiching(precision::Float64)

An algorithm that implemennts the paper described in Koenen, M., Balvert, M., & Fleuren, H. A. (2023). A Renewed Take on Weighted Sum in Sandwich Algorithms: Modification of the Criterion Space. (Center Discussion Paper; Vol. 2023-012). CentER, Center for Economic Research.
An algorithm that implemennts the paper described in Koenen, M., Balvert, M., &
Fleuren, H. A. (2023). A Renewed Take on Weighted Sum in Sandwich Algorithms:
Modification of the Criterion Space. (Center Discussion Paper; Vol. 2023-012).
CentER, Center for Economic Research.

## Compat

Expand Down
31 changes: 31 additions & 0 deletions test/algorithms/Sandwiching.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import MultiObjectiveAlgorithms as MOA
import MultiObjectiveAlgorithms: MOI
import Polyhedra

include(joinpath(dirname(@__DIR__), "mock_optimizer.jl"))

function run_tests()
for name in names(@__MODULE__; all = true)
if startswith("$name", "test_")
Expand Down Expand Up @@ -190,6 +192,35 @@ function test_time_limit()
return
end

function test_solve_failures()
m, n = 2, 10
p1 = [5.0 1 10 8 3 5 3 3 7 2; 10 6 1 6 8 3 2 10 6 1]
p2 = [4.0 6 4 3 1 6 8 2 9 7; 8 8 8 2 4 8 8 1 10 1]
w = [5.0 9 3 5 10 5 7 10 7 8; 4 8 8 6 10 8 10 7 5 1]
b = [34.0, 33.0]
for fail_after in 0:4
model = MOA.Optimizer(mock_optimizer(fail_after))
MOI.set(model, MOA.Algorithm(), MOA.Sandwiching(0.0))
x_ = MOI.add_variables(model, m * n)
x = reshape(x_, m, n)
MOI.add_constraint.(model, x, MOI.Interval(0.0, 1.0))
f = MOI.Utilities.operate(vcat, Float64, sum(p1 .* x), sum(p2 .* x))
MOI.set(model, MOI.ObjectiveSense(), MOI.MAX_SENSE)
MOI.set(model, MOI.ObjectiveFunction{typeof(f)}(), f)
for i in 1:m
f_i = sum(w[i, j] * x[i, j] for j in 1:n)
MOI.add_constraint(model, f_i, MOI.LessThan(b[i]))
end
for j in 1:n
MOI.add_constraint(model, sum(1.0 .* x[:, j]), MOI.EqualTo(1.0))
end
MOI.optimize!(model)
@test MOI.get(model, MOI.TerminationStatus()) == MOI.NUMERICAL_ERROR
@test MOI.get(model, MOI.ResultCount()) == 0
end
return
end

end # TestSandwiching

TestSandwiching.run_tests()
Loading