mirror of
https://github.com/microsoft/autogen.git
synced 2026-04-20 03:02:16 -04:00
simplify warmstart in blendsearch (#558)
* simplify warmstart in blendsearch * bump version to 1.0.3
This commit is contained in:
@@ -311,25 +311,6 @@ class BlendSearch(Searcher):
|
||||
)
|
||||
self._gs_admissible_min = self._ls_bound_min.copy()
|
||||
self._gs_admissible_max = self._ls_bound_max.copy()
|
||||
# config_signature: tuple -> result: Dict
|
||||
self._result = (
|
||||
{
|
||||
self._ls.config_signature(
|
||||
*self._ls.complete_config(
|
||||
self._evaluated_points[i],
|
||||
self._ls_bound_min,
|
||||
self._ls_bound_max,
|
||||
)
|
||||
): {
|
||||
self._metric: r,
|
||||
self.cost_attr: 1,
|
||||
"config": self._evaluated_points[i],
|
||||
}
|
||||
for i, r in enumerate(self._all_rewards)
|
||||
}
|
||||
if self._evaluated_rewards # store all the evaluated rewards
|
||||
else {}
|
||||
)
|
||||
|
||||
if self._metric_constraints:
|
||||
self._metric_constraint_satisfied = False
|
||||
@@ -340,6 +321,14 @@ class BlendSearch(Searcher):
|
||||
self._metric_constraint_satisfied = True
|
||||
self._metric_constraint_penalty = None
|
||||
self.best_resource = self._ls.min_resource
|
||||
i = 0
|
||||
# config_signature: tuple -> result: Dict
|
||||
self._result = {}
|
||||
while self._evaluated_rewards:
|
||||
# go over the evaluated rewards
|
||||
trial_id = f"trial_for_evaluated_{i}"
|
||||
self.suggest(trial_id)
|
||||
i += 1
|
||||
|
||||
def save(self, checkpoint_path: str):
|
||||
"""save states to a checkpoint path."""
|
||||
@@ -747,8 +736,8 @@ class BlendSearch(Searcher):
|
||||
self._search_thread_pool[0].running += 1
|
||||
self._subspace[trial_id] = space
|
||||
if reward is not None:
|
||||
# result = {self._metric: reward, self.cost_attr: 1, "config": config}
|
||||
result = self._result[config_signature]
|
||||
result = {self._metric: reward, self.cost_attr: 1, "config": config}
|
||||
# result = self._result[config_signature]
|
||||
self.on_trial_complete(trial_id, result)
|
||||
return None
|
||||
if self._use_incumbent_result_in_evaluation:
|
||||
|
||||
@@ -1 +1 @@
|
||||
__version__ = "1.0.2"
|
||||
__version__ = "1.0.3"
|
||||
|
||||
Reference in New Issue
Block a user