@@ -98,6 +98,7 @@ def __init__(
9898 self .scaling = scaling
9999 self .snap = snap
100100 self .return_invalid = return_invalid
101+ self .unique_results = dict ()
101102 self .results = []
102103 self .budget_spent_fraction = 0.0
103104 self .invalid_return_value = invalid_value
@@ -147,7 +148,7 @@ def _run_configs(self, xs, check_restrictions=True):
147148 final_results = [] # List returned to the user
148149
149150 # Loop over all configurations. For each configurations there are four cases:
150- # 1. The configuration is valid , we can skip it
151+ # 1. The configuration is invalid , we can skip it
151152 # 2. The configuration is in `unique_results`, we can get it from there
152153 # 3. The configuration is in `pending_indices_by_key`, it is duplicate in `xs`
153154 # 4. The configuration must be evaluated by the runner.
@@ -163,8 +164,8 @@ def _run_configs(self, xs, check_restrictions=True):
163164 final_results .append (result )
164165
165166 # 2. Attempt to retrieve from `unique_results`
166- elif key in self .tuning_options . unique_results :
167- result = dict (self .tuning_options . unique_results [key ])
167+ elif key in self .unique_results :
168+ result = dict (self .unique_results [key ])
168169 final_results .append (result )
169170
170171 # 3. We have already seen this config in the current batch
@@ -197,8 +198,12 @@ def _run_configs(self, xs, check_restrictions=True):
197198 result ["benchmark_time" ] = 0
198199
199200 # Put result in `unique_results`
200- self .tuning_options .unique_results [key ] = result
201- self .results .append (result )
201+ self .unique_results [key ] = result
202+
203+ for result in final_results :
204+ # Skip if None. Result is missing if runner exhausted the budget
205+ if result is not None :
206+ self .results .append (result )
202207
203208 # upon returning from this function control will be given back to the strategy, so reset the start time
204209 self .runner .last_strategy_start_time = perf_counter ()
@@ -243,6 +248,12 @@ def eval(self, x, check_restrictions=True):
243248
244249 def __call__ (self , x , check_restrictions = True ):
245250 return self .eval (x , check_restrictions = check_restrictions )
251+
252+ def get_results (self ):
253+ return self .results
254+
255+ def get_num_unique_results (self ):
256+ return len (self .unique_results )
246257
247258 def get_start_pos (self ):
248259 """Get starting position for optimization."""
0 commit comments