Skip to content

Commit

Permalink
ESSOptimizer: Fix priority for local search startpoints (ICB-DCM#1503)
Browse files Browse the repository at this point in the history
Fixes a bug in ESSOptimizer that lead to incorrect priorities for the selection of candidate solutions for local searches.
A numpy array was incorrectly initialized from a generator, which led to the `balance` hyperparameter being practically ignored, and candidate solutions being ranked only by objective function value.
  • Loading branch information
dweindl authored Nov 5, 2024
1 parent a82e637 commit c8640ff
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions pypesto/optimize/ess/ess.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,14 +487,19 @@ def _do_local_search(
quality_order = np.argsort(fx_best_children)
# compute minimal distance between the best children and all local
# optima found so far
min_distances = np.array(
np.min(
np.linalg.norm(
y_i - optimizer_result.x[optimizer_result.free_indices]
min_distances = np.fromiter(
(
min(
np.linalg.norm(
y_i
- optimizer_result.x[optimizer_result.free_indices]
)
for optimizer_result in self.local_solutions
)
for optimizer_result in self.local_solutions
)
for y_i in x_best_children
for y_i in x_best_children
),
dtype=np.float64,
count=len(x_best_children),
)
# sort by furthest distance to existing local optima
diversity_order = np.argsort(min_distances)[::-1]
Expand Down

0 comments on commit c8640ff

Please sign in to comment.