Skip to content

Commit 418d6c9

Browse files
authored
Fix bug in Chalmet (#117)
1 parent 32bbb16 commit 418d6c9

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/algorithms/Chalmet.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ function optimize_multiobjective!(algorithm::Chalmet, model::Optimizer)
8989
end
9090
_, y2[1] = _compute_point(model, variables, f1)
9191
if y2[1] solutions[1].y[1]
92-
return MOI.OPTIMAL, [solutions]
92+
return MOI.OPTIMAL, solutions
9393
end
9494
MOI.set(model.inner, MOI.ObjectiveFunction{typeof(f2)}(), f2)
9595
y2_constraint = MOI.Utilities.normalize_and_add_constraint(

test/algorithms/Chalmet.jl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,23 @@ function test_too_many_objectives()
218218
return
219219
end
220220

221+
function test_single_point()
222+
model = MOA.Optimizer(HiGHS.Optimizer)
223+
MOI.set(model, MOA.Algorithm(), MOA.Chalmet())
224+
MOI.set(model, MOI.Silent(), true)
225+
x = MOI.add_variables(model, 2)
226+
MOI.add_constraint.(model, x, MOI.EqualTo(1.0))
227+
MOI.set(model, MOI.ObjectiveSense(), MOI.MIN_SENSE)
228+
f = MOI.Utilities.operate(vcat, Float64, 1.0 .* x...)
229+
MOI.set(model, MOI.ObjectiveFunction{typeof(f)}(), f)
230+
MOI.optimize!(model)
231+
@test MOI.get(model, MOI.TerminationStatus()) == MOI.OPTIMAL
232+
@test MOI.get(model, MOI.ResultCount()) == 1
233+
@test MOI.get(model, MOI.PrimalStatus()) == MOI.FEASIBLE_POINT
234+
@test (MOI.get(model, MOI.VariablePrimal(), x), [1.0, 1.0]; atol = 1e-6)
235+
return
236+
end
237+
221238
end # module TestChalmet
222239

223240
TestChalmet.run_tests()

0 commit comments

Comments
 (0)