File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -200,12 +200,13 @@ def check_stop_criterion(to: dict) -> float:
200
200
StopCriterionReached: if the max_fevals is reached or time limit is exceeded.
201
201
202
202
Returns:
203
- float: fraction of budget spent.
203
+ float: fraction of budget spent. If both max_fevals and time_limit are set, it returns the fraction of time.
204
204
"""
205
205
if "max_fevals" in to :
206
206
if len (to .unique_results ) >= to .max_fevals :
207
207
raise StopCriterionReached (f"max_fevals ({ to .max_fevals } ) reached" )
208
- return len (to .unique_results ) / to .max_fevals
208
+ if not "time_limit" in to :
209
+ return len (to .unique_results ) / to .max_fevals
209
210
if "time_limit" in to :
210
211
time_spent = (time .perf_counter () - to .start_time ) + (to .simulated_time * 1e-3 ) + to .startup_time
211
212
if time_spent > to .time_limit :
You can’t perform that action at this time.
0 commit comments