From 2d0bc2cf19becfd3f985703a220f3438e91ac2a9 Mon Sep 17 00:00:00 2001 From: RichieHakim Date: Sat, 6 Apr 2024 19:25:20 -0400 Subject: [PATCH] Fix condition for stopping optimization trials --- bnpm/optimization.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bnpm/optimization.py b/bnpm/optimization.py index c054828..b06a083 100644 --- a/bnpm/optimization.py +++ b/bnpm/optimization.py @@ -321,7 +321,7 @@ def check( self.converged, self.reason_converged = True, 'tol_frac' print(f'Stopping. Convergence reached. Best value ({self.best*10000}) over last ({self.n_patience}) trials fractionally changed less than ({self.tol_frac})') if self.verbose else None study.stop() - elif self.num_trial >= self.max_trials: + elif self.num_trial >= self.max_trials - 1: self.converged, self.reason_converged = True, 'max_trials' print(f'Stopping. Trial number limit reached. num_trial={self.num_trial}, max_trials={self.max_trials}.') if self.verbose else None study.stop()