Skip to content

Commit

Permalink
Add LocalSearch Fix (#1194)
Browse files Browse the repository at this point in the history
* Add fix

* Update Changelog.md

* Add check for None
  • Loading branch information
LukasFehring authored Jan 15, 2025
1 parent b5fdee2 commit 715d857
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- Fix wrong attr query in the target function runner (crash cost) (#1176)
- Fix kwargs for DifferentialEvolution (#1187)
- Fix PiBo implementation (#1076)
- Add fix for local search running forever (#1194)

## Improvements
- Add logger information on handling of stopIteration error (#960)
Expand Down
5 changes: 5 additions & 0 deletions smac/acquisition/maximizer/local_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,11 @@ def _search(

num_iters = 0
while np.any(active):

# If the maximum number of steps is reached, stop the local search
if num_iters is not None and num_iters == self._max_steps:
break

num_iters += 1
# Whether the i-th local search improved. When a new neighborhood is generated, this is used to determine
# whether a step was made (improvement) or not (iterator exhausted)
Expand Down

0 comments on commit 715d857

Please sign in to comment.