Skip to content

Commit

Permalink
Make sure One Shot Optimizer always returns the same suggestion (#759)
Browse files Browse the repository at this point in the history
Make sure the `OneShotOptimizer.suggest()` call always returns the same
configuration.

Changes related to `MockEnv` determinism moved to #769 

Closes #755

---------

Co-authored-by: Brian Kroth <bpkroth@users.noreply.github.com>
  • Loading branch information
motus and bpkroth authored Jul 3, 2024
1 parent cef476c commit 62d7efb
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion mlos_bench/mlos_bench/optimizers/one_shot_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

class OneShotOptimizer(MockOptimizer):
"""
Mock optimizer that proposes a single configuration and returns.
No-op optimizer that proposes a single configuration and returns.
Explicit configs (partial or full) are possible using configuration files.
"""

Expand All @@ -33,6 +33,14 @@ def __init__(self,
_LOG.info("Run a single iteration for: %s", self._tunables)
self._max_iter = 1 # Always run for just one iteration.

def suggest(self) -> TunableGroups:
"""
Always produce the same (initial) suggestion.
"""
tunables = super().suggest()
self._start_with_defaults = True
return tunables

@property
def supports_preload(self) -> bool:
return False

0 comments on commit 62d7efb

Please sign in to comment.