@@ -139,7 +139,7 @@ def execute_experiment(filepath: str, profiling: bool = False) -> tuple[dict, di
139139 assert cutoff_type == "fevals" or cutoff_type == "time" , f"cutoff_type must be 'fevals' or 'time', is { cutoff_type } "
140140 curve_segment_factor : float = experiment .get ("curve_segment_factor" , 0.05 )
141141 assert isinstance (curve_segment_factor , float ), f"curve_segment_factor is not float, { type (curve_segment_factor )} "
142- strategies = get_strategies (experiment )
142+ strategies : list [ dict ] = get_strategies (experiment )
143143
144144 # add the kernel directory to the path to import the module, relative to the experiment file
145145 kernels_path = experiment_folderpath / Path (experiment ["kernels_path" ])
@@ -179,20 +179,22 @@ def execute_experiment(filepath: str, profiling: bool = False) -> tuple[dict, di
179179 strategy_name : str = strategy ["name" ]
180180 strategy_display_name : str = strategy ["display_name" ]
181181 stochastic = strategy ["stochastic" ]
182+ cutoff_margin = strategy .get (
183+ "cutoff_margin" , 1.1
184+ ) # +10% margin, to make sure cutoff_point is reached by compensating for potential non-valid evaluations # noqa: E501
182185 print (f" | - | using strategy '{ strategy ['display_name' ]} '" )
183186
184187 # setup the results description
185188 if "options" not in strategy :
186189 strategy ["options" ] = dict ()
187- cutoff_margin = 1.1 # +10% margin, to make sure cutoff_point is reached by compensating for potential non-valid evaluations # noqa: E501
188-
189- # TODO make sure this works correctly
190- # if cutoff_type == 'time':
191- # strategy['options']['time_limit'] = cutoff_point_time * cutoff_margin
192- # else:
193- strategy ["options" ]["max_fevals" ] = min (
194- int (ceil (cutoff_point_fevals * cutoff_margin )), searchspace_stats .size
195- )
190+
191+ # set when to stop
192+ if cutoff_type == "time" :
193+ strategy ["options" ]["time_limit" ] = cutoff_point_time * cutoff_margin
194+ else :
195+ strategy ["options" ]["max_fevals" ] = min (
196+ int (ceil (cutoff_point_fevals * cutoff_margin )), searchspace_stats .size
197+ )
196198 results_description = ResultsDescription (
197199 experiment_folder_id ,
198200 kernel_name ,
0 commit comments