Skip to content

Commit

Permalink
Over-estimate nadir point in algorithms to fix cycling (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
kofgokhan authored Oct 22, 2023
1 parent 5cf770f commit e1c79dc
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 40 deletions.
2 changes: 1 addition & 1 deletion src/algorithms/DominguezRios.jl
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ function optimize_multiobjective!(algorithm::DominguezRios, model::Optimizer)
return status, nothing
end
_, Y = _compute_point(model, variables, f_i)
yN[i] = Y
yN[i] = Y + 1
end
MOI.set(model.inner, MOI.ObjectiveSense(), sense)
ϵ = 1 / (2 * n * (maximum(yN - yI) - 1))
Expand Down
2 changes: 1 addition & 1 deletion src/algorithms/KirlikSayin.jl
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ function optimize_multiobjective!(algorithm::KirlikSayin, model::Optimizer)
return status, nothing
end
_, Y = _compute_point(model, variables, f_i)
yI[i] = Y
yI[i] = Y + 1
MOI.set(
model.inner,
MOI.ObjectiveSense(),
Expand Down
2 changes: 1 addition & 1 deletion src/algorithms/TambyVanderpooten.jl
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ function optimize_multiobjective!(
return status, nothing
end
_, Y = _compute_point(model, variables, f_i)
yI[i] = Y
yI[i] = Y + 1
MOI.set(model.inner, MOI.ObjectiveSense(), MOI.MAX_SENSE)
MOI.optimize!(model.inner)
status = MOI.get(model.inner, MOI.TerminationStatus())
Expand Down
38 changes: 19 additions & 19 deletions test/algorithms/DominguezRios.jl
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ function test_knapsack_min_p3()
]
N = MOI.get(model, MOI.ResultCount())
x_sol = hcat([MOI.get(model, MOI.VariablePrimal(i), x) for i in 1:N]...)
@test isapprox(x_sol, X_E'; atol = 1e-6)
y_sol = hcat([MOI.get(model, MOI.ObjectiveValue(i)) for i in 1:N]...)
@test isapprox(y_sol, Y_N'; atol = 1e-6)
@test isapprox(sort(x_sol; dims = 1), sort(X_E'; dims = 1); atol = 1e-6)
y_sol = vcat([MOI.get(model, MOI.ObjectiveValue(i))' for i in 1:N]...)
@test isapprox(sort(y_sol; dims = 1), sort(Y_N; dims = 1); atol = 1e-6)
return
end

Expand Down Expand Up @@ -138,9 +138,9 @@ function test_knapsack_max_p3()
]
N = MOI.get(model, MOI.ResultCount())
x_sol = hcat([MOI.get(model, MOI.VariablePrimal(i), x) for i in 1:N]...)
@test isapprox(x_sol, X_E'; atol = 1e-6)
y_sol = hcat([MOI.get(model, MOI.ObjectiveValue(i)) for i in 1:N]...)
@test isapprox(y_sol, Y_N'; atol = 1e-6)
@test isapprox(sort(x_sol; dims = 1), sort(X_E'; dims = 1); atol = 1e-6)
y_sol = vcat([MOI.get(model, MOI.ObjectiveValue(i))' for i in 1:N]...)
@test isapprox(sort(y_sol; dims = 1), sort(Y_N; dims = 1); atol = 1e-6)
return
end

Expand Down Expand Up @@ -204,9 +204,9 @@ function test_knapsack_min_p4()
]
N = MOI.get(model, MOI.ResultCount())
x_sol = hcat([MOI.get(model, MOI.VariablePrimal(i), x) for i in 1:N]...)
@test isapprox(x_sol, X_E'; atol = 1e-6)
y_sol = hcat([MOI.get(model, MOI.ObjectiveValue(i)) for i in 1:N]...)
@test isapprox(y_sol, Y_N'; atol = 1e-6)
@test isapprox(sort(x_sol; dims = 1), sort(X_E'; dims = 1); atol = 1e-6)
y_sol = vcat([MOI.get(model, MOI.ObjectiveValue(i))' for i in 1:N]...)
@test isapprox(sort(y_sol; dims = 1), sort(Y_N; dims = 1); atol = 1e-6)
return
end

Expand Down Expand Up @@ -270,9 +270,9 @@ function test_knapsack_max_p4()
]
N = MOI.get(model, MOI.ResultCount())
x_sol = hcat([MOI.get(model, MOI.VariablePrimal(i), x) for i in 1:N]...)
@test isapprox(x_sol, X_E'; atol = 1e-6)
y_sol = hcat([MOI.get(model, MOI.ObjectiveValue(i)) for i in 1:N]...)
@test isapprox(y_sol, Y_N'; atol = 1e-6)
@test isapprox(sort(x_sol; dims = 1), sort(X_E'; dims = 1); atol = 1e-6)
y_sol = vcat([MOI.get(model, MOI.ObjectiveValue(i))' for i in 1:N]...)
@test isapprox(sort(y_sol; dims = 1), sort(Y_N; dims = 1); atol = 1e-6)
return
end

Expand Down Expand Up @@ -380,9 +380,9 @@ function test_assignment_min_p3()
N = MOI.get(model, MOI.ResultCount())
x_sol =
hcat([MOI.get(model, MOI.VariablePrimal(i), vec(x)) for i in 1:N]...)
@test isapprox(x_sol, X_E'; atol = 1e-6)
y_sol = hcat([MOI.get(model, MOI.ObjectiveValue(i)) for i in 1:N]...)
@test isapprox(y_sol, Y_N'; atol = 1e-6)
@test isapprox(sort(x_sol; dims = 1), sort(X_E'; dims = 1); atol = 1e-6)
y_sol = vcat([MOI.get(model, MOI.ObjectiveValue(i))' for i in 1:N]...)
@test isapprox(sort(y_sol; dims = 1), sort(Y_N; dims = 1); atol = 1e-6)
return
end

Expand Down Expand Up @@ -490,9 +490,9 @@ function test_assignment_max_p3()
N = MOI.get(model, MOI.ResultCount())
x_sol =
hcat([MOI.get(model, MOI.VariablePrimal(i), vec(x)) for i in 1:N]...)
@test isapprox(x_sol, X_E'; atol = 1e-6)
y_sol = hcat([MOI.get(model, MOI.ObjectiveValue(i)) for i in 1:N]...)
@test isapprox(y_sol, Y_N'; atol = 1e-6)
@test isapprox(sort(x_sol; dims = 1), sort(X_E'; dims = 1); atol = 1e-6)
y_sol = vcat([MOI.get(model, MOI.ObjectiveValue(i))' for i in 1:N]...)
@test isapprox(sort(y_sol; dims = 1), sort(Y_N; dims = 1); atol = 1e-6)
return
end

Expand Down Expand Up @@ -583,7 +583,7 @@ function test_time_limit()
return
end

function __FAIL__test_vector_of_variables_objective()
function test_vector_of_variables_objective()
model = MOI.instantiate(; with_bridge_type = Float64) do
return MOA.Optimizer(HiGHS.Optimizer)
end
Expand Down
36 changes: 18 additions & 18 deletions test/algorithms/KirlikSayin.jl
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ function test_knapsack_min_p3()
]
N = MOI.get(model, MOI.ResultCount())
x_sol = hcat([MOI.get(model, MOI.VariablePrimal(i), x) for i in 1:N]...)
@test isapprox(x_sol, X_E'; atol = 1e-6)
y_sol = hcat([MOI.get(model, MOI.ObjectiveValue(i)) for i in 1:N]...)
@test isapprox(y_sol, Y_N'; atol = 1e-6)
@test isapprox(sort(x_sol; dims = 1), sort(X_E'; dims = 1); atol = 1e-6)
y_sol = vcat([MOI.get(model, MOI.ObjectiveValue(i))' for i in 1:N]...)
@test isapprox(sort(y_sol; dims = 1), sort(Y_N; dims = 1); atol = 1e-6)
return
end

Expand Down Expand Up @@ -135,9 +135,9 @@ function test_knapsack_max_p3()
]
N = MOI.get(model, MOI.ResultCount())
x_sol = hcat([MOI.get(model, MOI.VariablePrimal(i), x) for i in 1:N]...)
@test isapprox(x_sol, X_E'; atol = 1e-6)
y_sol = hcat([MOI.get(model, MOI.ObjectiveValue(i)) for i in 1:N]...)
@test isapprox(y_sol, Y_N'; atol = 1e-6)
@test isapprox(sort(x_sol; dims = 1), sort(X_E'; dims = 1); atol = 1e-6)
y_sol = vcat([MOI.get(model, MOI.ObjectiveValue(i))' for i in 1:N]...)
@test isapprox(sort(y_sol; dims = 1), sort(Y_N; dims = 1); atol = 1e-6)
return
end

Expand Down Expand Up @@ -201,9 +201,9 @@ function test_knapsack_min_p4()
]
N = MOI.get(model, MOI.ResultCount())
x_sol = hcat([MOI.get(model, MOI.VariablePrimal(i), x) for i in 1:N]...)
@test isapprox(x_sol, X_E'; atol = 1e-6)
y_sol = hcat([MOI.get(model, MOI.ObjectiveValue(i)) for i in 1:N]...)
@test isapprox(y_sol, Y_N'; atol = 1e-6)
@test isapprox(sort(x_sol; dims = 1), sort(X_E'; dims = 1); atol = 1e-6)
y_sol = vcat([MOI.get(model, MOI.ObjectiveValue(i))' for i in 1:N]...)
@test isapprox(sort(y_sol; dims = 1), sort(Y_N; dims = 1); atol = 1e-6)
return
end

Expand Down Expand Up @@ -267,9 +267,9 @@ function test_knapsack_max_p4()
]
N = MOI.get(model, MOI.ResultCount())
x_sol = hcat([MOI.get(model, MOI.VariablePrimal(i), x) for i in 1:N]...)
@test isapprox(x_sol, X_E'; atol = 1e-6)
y_sol = hcat([MOI.get(model, MOI.ObjectiveValue(i)) for i in 1:N]...)
@test isapprox(y_sol, Y_N'; atol = 1e-6)
@test isapprox(sort(x_sol; dims = 1), sort(X_E'; dims = 1); atol = 1e-6)
y_sol = vcat([MOI.get(model, MOI.ObjectiveValue(i))' for i in 1:N]...)
@test isapprox(sort(y_sol; dims = 1), sort(Y_N; dims = 1); atol = 1e-6)
return
end

Expand Down Expand Up @@ -380,9 +380,9 @@ function test_assignment_min_p3()
N = MOI.get(model, MOI.ResultCount())
x_sol =
hcat([MOI.get(model, MOI.VariablePrimal(i), vec(x)) for i in 1:N]...)
@test isapprox(x_sol, X_E'; atol = 1e-6)
y_sol = hcat([MOI.get(model, MOI.ObjectiveValue(i)) for i in 1:N]...)
@test isapprox(y_sol, Y_N'; atol = 1e-6)
@test isapprox(sort(x_sol; dims = 1), sort(X_E'; dims = 1); atol = 1e-6)
y_sol = vcat([MOI.get(model, MOI.ObjectiveValue(i))' for i in 1:N]...)
@test isapprox(sort(y_sol; dims = 1), sort(Y_N; dims = 1); atol = 1e-6)
return
end

Expand Down Expand Up @@ -493,9 +493,9 @@ function test_assignment_max_p3()
N = MOI.get(model, MOI.ResultCount())
x_sol =
hcat([MOI.get(model, MOI.VariablePrimal(i), vec(x)) for i in 1:N]...)
@test isapprox(x_sol, X_E'; atol = 1e-6)
y_sol = hcat([MOI.get(model, MOI.ObjectiveValue(i)) for i in 1:N]...)
@test isapprox(y_sol, Y_N'; atol = 1e-6)
@test isapprox(sort(x_sol; dims = 1), sort(X_E'; dims = 1); atol = 1e-6)
y_sol = vcat([MOI.get(model, MOI.ObjectiveValue(i))' for i in 1:N]...)
@test isapprox(sort(y_sol; dims = 1), sort(Y_N; dims = 1); atol = 1e-6)
return
end

Expand Down

0 comments on commit e1c79dc

Please sign in to comment.