From cd6952417ed22cf17e7ed030bfdf98193e024624 Mon Sep 17 00:00:00 2001 From: Luis-Varona Date: Wed, 5 Nov 2025 12:20:47 -0400 Subject: [PATCH] Bugfix for epsilon-optimizers There were several minor syntax, etc. bugs in the EpsilonOptimization submodule. These are now (hopefully) all fixed. --- .../solvers/alpha_branch_and_bound.jl | 12 ++++++++---- .../solvers/lipschitz_branch_and_bound.jl | 12 ++++++++---- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/EpsilonOptimization/solvers/alpha_branch_and_bound.jl b/src/EpsilonOptimization/solvers/alpha_branch_and_bound.jl index c003c32..855a631 100644 --- a/src/EpsilonOptimization/solvers/alpha_branch_and_bound.jl +++ b/src/EpsilonOptimization/solvers/alpha_branch_and_bound.jl @@ -75,8 +75,12 @@ function _epsilon_minimize_impl( while ( iterations < max_iterations && !isempty(rects_cand) && - min(lower_bound, first(rects_cand).lower_bound) <= threshold && - minimum - threshold >= epsilon + ( + isinf(threshold) || ( + min(lower_bound, first(rects_cand).lower_bound) <= threshold && + minimum - threshold >= epsilon + ) + ) ) rect = pop!(rects_cand) f_val = f(rect.x_min) @@ -112,15 +116,15 @@ function _epsilon_minimize_impl( return EpsilonMinimizationResult( solver, - epsilon, lower, upper, + epsilon, minimizer, minimum, ( epsilon_optimal=minimum - lower_bound < epsilon, threshold_reached=minimum - threshold < epsilon, - threshold_unreachable=lower_bound > threshold, + threshold_unreachable=-Inf < threshold < lower_bound, iterations=iterations >= max_iterations, ), ) diff --git a/src/EpsilonOptimization/solvers/lipschitz_branch_and_bound.jl b/src/EpsilonOptimization/solvers/lipschitz_branch_and_bound.jl index df52346..2e33fc4 100644 --- a/src/EpsilonOptimization/solvers/lipschitz_branch_and_bound.jl +++ b/src/EpsilonOptimization/solvers/lipschitz_branch_and_bound.jl @@ -73,8 +73,12 @@ function _epsilon_minimize_impl( while ( iterations < max_iterations && !isempty(rects_cand) && - min(lower_bound, first(rects_cand).lower_bound) <= threshold && - minimum - threshold >= epsilon + ( + isinf(threshold) || ( + min(lower_bound, first(rects_cand).lower_bound) <= threshold && + minimum - threshold >= epsilon + ) + ) ) rect = pop!(rects_cand) @@ -107,15 +111,15 @@ function _epsilon_minimize_impl( return EpsilonMinimizationResult( solver, - epsilon, lower, upper, + epsilon, minimizer, minimum, ( epsilon_optimal=minimum - lower_bound < epsilon, threshold_reached=minimum - threshold < epsilon, - threshold_unreachable=lower_bound > threshold, + threshold_unreachable=-Inf < threshold < lower_bound, iterations=iterations >= max_iterations, ), )