Skip to content

Commit

Permalink
Fix condition for stopping optimization trials
Browse files Browse the repository at this point in the history
  • Loading branch information
RichieHakim committed Apr 6, 2024
1 parent 0daff5f commit 2d0bc2c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bnpm/optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 2d0bc2c

Please sign in to comment.