Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ESSOptimizer min of empty sequence #1510

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 18 additions & 12 deletions pypesto/optimize/ess/ess.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,19 +487,25 @@ 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.fromiter(
(
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
),
dtype=np.float64,
count=len(x_best_children),
for y_i in x_best_children
),
dtype=np.float64,
count=len(x_best_children),
)
if len(self.local_solutions)
else np.zeros(len(x_best_children))
)
# sort by furthest distance to existing local optima
diversity_order = np.argsort(min_distances)[::-1]
Expand Down
Loading