From 93cbf16e0eb4811be786b20be5a104b0f052978f Mon Sep 17 00:00:00 2001 From: odow Date: Thu, 14 Aug 2025 16:25:30 +1200 Subject: [PATCH] All Dichotomoy to return solutions on error --- src/algorithms/Dichotomy.jl | 3 +-- test/algorithms/Dichotomy.jl | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/algorithms/Dichotomy.jl b/src/algorithms/Dichotomy.jl index d357056..c06abf6 100644 --- a/src/algorithms/Dichotomy.jl +++ b/src/algorithms/Dichotomy.jl @@ -112,8 +112,7 @@ function optimize_multiobjective!(algorithm::Dichotomy, model::Optimizer) w = y_d[2] / (y_d[2] - y_d[1]) status, solution = _solve_weighted_sum(model, algorithm, [w, 1.0 - w]) if !_is_scalar_status_optimal(status) - # Exit the solve with some error. - return status, nothing + break # Exit the solve with some error. elseif solution ≈ solutions[a] || solution ≈ solutions[b] # We have found an existing solution. We're free to prune (a, b) # from the search space. diff --git a/test/algorithms/Dichotomy.jl b/test/algorithms/Dichotomy.jl index e423904..6e0a1b7 100644 --- a/test/algorithms/Dichotomy.jl +++ b/test/algorithms/Dichotomy.jl @@ -434,6 +434,8 @@ function test_solve_failures() end MOI.optimize!(model) @test MOI.get(model, MOI.TerminationStatus()) == MOI.NUMERICAL_ERROR + @test MOI.get(model, MOI.ResultCount()) == + (fail_after < 2 ? 0 : fail_after) end return end