Skip to content

Commit 915b19d

Browse files
committed
Update
1 parent 0ba9da8 commit 915b19d

File tree

7 files changed

+20
-2
lines changed

7 files changed

+20
-2
lines changed

src/algorithms/DominguezRios.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ function optimize_multiobjective!(algorithm::DominguezRios, model::Optimizer)
155155
if solutions !== nothing
156156
solutions = [SolutionPoint(s.x, -s.y) for s in solutions]
157157
end
158+
model.ideal_point .*= -1
158159
return status, solutions
159160
end
160161
n = MOI.output_dimension(model.f)
@@ -173,6 +174,7 @@ function optimize_multiobjective!(algorithm::DominguezRios, model::Optimizer)
173174
end
174175
_, Y = _compute_point(model, variables, f_i)
175176
yI[i] = Y
177+
model.ideal_point[i] = Y
176178
rev_sense = sense == MOI.MIN_SENSE ? MOI.MAX_SENSE : MOI.MIN_SENSE
177179
MOI.set(model.inner, MOI.ObjectiveSense(), rev_sense)
178180
MOI.optimize!(model.inner)

src/algorithms/KirlikSayin.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ function optimize_multiobjective!(algorithm::KirlikSayin, model::Optimizer)
8787
if solutions !== nothing
8888
solutions = [SolutionPoint(s.x, -s.y) for s in solutions]
8989
end
90+
model.ideal_point .*= -1
9091
return status, solutions
9192
end
9293
solutions = SolutionPoint[]
@@ -111,6 +112,7 @@ function optimize_multiobjective!(algorithm::KirlikSayin, model::Optimizer)
111112
end
112113
_, Y = _compute_point(model, variables, f_i)
113114
yI[i] = Y + 1
115+
model.ideal_point[i] = Y
114116
MOI.set(
115117
model.inner,
116118
MOI.ObjectiveSense(),

src/algorithms/TambyVanderpooten.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ function optimize_multiobjective!(
9292
if solutions !== nothing
9393
solutions = [SolutionPoint(s.x, -s.y) for s in solutions]
9494
end
95+
model.ideal_point .*= -1
9596
return status, solutions
9697
end
9798
warm_start_supported = false
@@ -114,6 +115,7 @@ function optimize_multiobjective!(
114115
end
115116
_, Y = _compute_point(model, variables, f_i)
116117
yI[i] = Y + 1
118+
model.ideal_point[i] = Y
117119
MOI.set(model.inner, MOI.ObjectiveSense(), MOI.MAX_SENSE)
118120
MOI.optimize!(model.inner)
119121
status = MOI.get(model.inner, MOI.TerminationStatus())

test/algorithms/Chalmet.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ function test_knapsack_min()
6868
@test isapprox(x_sol, X_E'; atol = 1e-6)
6969
y_sol = hcat([MOI.get(model, MOI.ObjectiveValue(i)) for i in 1:N]...)
7070
@test isapprox(y_sol, Y_N'; atol = 1e-6)
71-
@test MOI.get(model, MOI.ObjectiveBound()) == [-3394.0, -4636.0]
71+
@test MOI.get(model, MOI.ObjectiveBound()) vec(minimum(Y_N; dims = 1))
7272
return
7373
end
7474

@@ -118,7 +118,7 @@ function test_knapsack_max()
118118
@test isapprox(x_sol, X_E'; atol = 1e-6)
119119
y_sol = hcat([MOI.get(model, MOI.ObjectiveValue(i)) for i in 1:N]...)
120120
@test isapprox(y_sol, Y_N'; atol = 1e-6)
121-
@test MOI.get(model, MOI.ObjectiveBound()) == [3395.0, 4636.0]
121+
@test MOI.get(model, MOI.ObjectiveBound()) vec(maximum(Y_N; dims = 1))
122122
return
123123
end
124124

test/algorithms/DominguezRios.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ function test_knapsack_min_p3()
8282
@test isapprox(sort(x_sol; dims = 1), sort(X_E'; dims = 1); atol = 1e-6)
8383
y_sol = vcat([MOI.get(model, MOI.ObjectiveValue(i))' for i in 1:N]...)
8484
@test isapprox(sort(y_sol; dims = 1), sort(Y_N; dims = 1); atol = 1e-6)
85+
@test MOI.get(model, MOI.ObjectiveBound()) vec(minimum(Y_N; dims = 1))
8586
return
8687
end
8788

@@ -141,6 +142,7 @@ function test_knapsack_max_p3()
141142
@test isapprox(sort(x_sol; dims = 1), sort(X_E'; dims = 1); atol = 1e-6)
142143
y_sol = vcat([MOI.get(model, MOI.ObjectiveValue(i))' for i in 1:N]...)
143144
@test isapprox(sort(y_sol; dims = 1), sort(Y_N; dims = 1); atol = 1e-6)
145+
@test MOI.get(model, MOI.ObjectiveBound()) vec(maximum(Y_N; dims = 1))
144146
return
145147
end
146148

@@ -207,6 +209,7 @@ function test_knapsack_min_p4()
207209
@test isapprox(sort(x_sol; dims = 1), sort(X_E'; dims = 1); atol = 1e-6)
208210
y_sol = vcat([MOI.get(model, MOI.ObjectiveValue(i))' for i in 1:N]...)
209211
@test isapprox(sort(y_sol; dims = 1), sort(Y_N; dims = 1); atol = 1e-6)
212+
@test MOI.get(model, MOI.ObjectiveBound()) vec(minimum(Y_N; dims = 1))
210213
return
211214
end
212215

@@ -273,6 +276,7 @@ function test_knapsack_max_p4()
273276
@test isapprox(sort(x_sol; dims = 1), sort(X_E'; dims = 1); atol = 1e-6)
274277
y_sol = vcat([MOI.get(model, MOI.ObjectiveValue(i))' for i in 1:N]...)
275278
@test isapprox(sort(y_sol; dims = 1), sort(Y_N; dims = 1); atol = 1e-6)
279+
@test MOI.get(model, MOI.ObjectiveBound()) vec(maximum(Y_N; dims = 1))
276280
return
277281
end
278282

test/algorithms/KirlikSayin.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ function test_knapsack_min_p3()
7979
@test isapprox(sort(x_sol; dims = 1), sort(X_E'; dims = 1); atol = 1e-6)
8080
y_sol = vcat([MOI.get(model, MOI.ObjectiveValue(i))' for i in 1:N]...)
8181
@test isapprox(sort(y_sol; dims = 1), sort(Y_N; dims = 1); atol = 1e-6)
82+
@test MOI.get(model, MOI.ObjectiveBound()) vec(minimum(Y_N; dims = 1))
8283
return
8384
end
8485

@@ -138,6 +139,7 @@ function test_knapsack_max_p3()
138139
@test isapprox(sort(x_sol; dims = 1), sort(X_E'; dims = 1); atol = 1e-6)
139140
y_sol = vcat([MOI.get(model, MOI.ObjectiveValue(i))' for i in 1:N]...)
140141
@test isapprox(sort(y_sol; dims = 1), sort(Y_N; dims = 1); atol = 1e-6)
142+
@test MOI.get(model, MOI.ObjectiveBound()) vec(maximum(Y_N; dims = 1))
141143
return
142144
end
143145

@@ -204,6 +206,7 @@ function test_knapsack_min_p4()
204206
@test isapprox(sort(x_sol; dims = 1), sort(X_E'; dims = 1); atol = 1e-6)
205207
y_sol = vcat([MOI.get(model, MOI.ObjectiveValue(i))' for i in 1:N]...)
206208
@test isapprox(sort(y_sol; dims = 1), sort(Y_N; dims = 1); atol = 1e-6)
209+
@test MOI.get(model, MOI.ObjectiveBound()) vec(minimum(Y_N; dims = 1))
207210
return
208211
end
209212

@@ -270,6 +273,7 @@ function test_knapsack_max_p4()
270273
@test isapprox(sort(x_sol; dims = 1), sort(X_E'; dims = 1); atol = 1e-6)
271274
y_sol = vcat([MOI.get(model, MOI.ObjectiveValue(i))' for i in 1:N]...)
272275
@test isapprox(sort(y_sol; dims = 1), sort(Y_N; dims = 1); atol = 1e-6)
276+
@test MOI.get(model, MOI.ObjectiveBound()) vec(maximum(Y_N; dims = 1))
273277
return
274278
end
275279

test/algorithms/TambyVanderpooten.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ function test_knapsack_min_p3()
8383
X_E[sortperm(collect(eachrow(Y_N))), :]
8484
@test isapprox(x_sol, X_E; atol = 1e-6)
8585
@test isapprox(y_sol, Y_N; atol = 1e-6)
86+
@test MOI.get(model, MOI.ObjectiveBound()) vec(minimum(Y_N; dims = 1))
8687
return
8788
end
8889

@@ -146,6 +147,7 @@ function test_knapsack_max_p3()
146147
X_E[sortperm(collect(eachrow(Y_N))), :]
147148
@test isapprox(x_sol, X_E; atol = 1e-6)
148149
@test isapprox(y_sol, Y_N; atol = 1e-6)
150+
@test MOI.get(model, MOI.ObjectiveBound()) vec(maximum(Y_N; dims = 1))
149151
return
150152
end
151153

@@ -216,6 +218,7 @@ function test_knapsack_min_p4()
216218
X_E[sortperm(collect(eachrow(Y_N))), :]
217219
@test isapprox(x_sol, X_E; atol = 1e-6)
218220
@test isapprox(y_sol, Y_N; atol = 1e-6)
221+
@test MOI.get(model, MOI.ObjectiveBound()) vec(minimum(Y_N; dims = 1))
219222
return
220223
end
221224

@@ -286,6 +289,7 @@ function test_knapsack_max_p4()
286289
X_E[sortperm(collect(eachrow(Y_N))), :]
287290
@test isapprox(x_sol, X_E; atol = 1e-6)
288291
@test isapprox(y_sol, Y_N; atol = 1e-6)
292+
@test MOI.get(model, MOI.ObjectiveBound()) vec(maximum(Y_N; dims = 1))
289293
return
290294
end
291295

0 commit comments

Comments
 (0)