Skip to content

Commit

Permalink
Make scheduler public
Browse files Browse the repository at this point in the history
  • Loading branch information
btjanaka committed Nov 22, 2024
1 parent 401551b commit a210298
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions package/samplers/cmamae/sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ def __init__(
# Number of solutions generated in each batch from pyribs.
self._batch_size = n_emitters * emitter_batch_size

self._scheduler = Scheduler(
# Public to allow access for, e.g., visualization.
self.scheduler = Scheduler(
archive,
emitters,
result_archive=result_archive,
Expand Down Expand Up @@ -161,7 +162,7 @@ def sample_relative(
self._validate_param_names(search_space.keys())

# Note: Batch optimization means we need to enqueue trials.
solutions = self._scheduler.ask()
solutions = self.scheduler.ask()
next_params = self._convert_to_optuna_params(solutions[0])
for solution in solutions[1:]:
params = self._convert_to_optuna_params(solution)
Expand Down Expand Up @@ -196,7 +197,7 @@ def after_trial(

# Tell the batch results to external sampler once the batch is ready.
values_to_tell = np.asarray(self._values_to_tell)[np.argsort(self._stored_trial_numbers)]
self._scheduler.tell(objective=values_to_tell[:, 0], measures=values_to_tell[:, 1:])
self.scheduler.tell(objective=values_to_tell[:, 0], measures=values_to_tell[:, 1:])

# Empty the results.
self._values_to_tell = []
Expand Down

0 comments on commit a210298

Please sign in to comment.