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

SacessOptimizer, ESSOptimizer: Bound-normalize parameters for proximity check #1462

Merged
merged 1 commit into from
Sep 16, 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
17 changes: 16 additions & 1 deletion pypesto/optimize/ess/refset.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,29 @@ def prune_too_close(self):

Assumes RefSet is sorted.
"""
# Compare [PenasGon2007]
# Note that the main text states that distance between the two points
# is normalized to the bounds of the search space. However,
# Algorithm 1, line 9 normalizes to x_j instead. The accompanying
# code does normalize to max(abs(x_i), abs(x_j)).
# Normalizing to the bounds of the search space seems more reasonable.
# Otherwise, for a parameter with bounds [lb, ub],
# where (ub-lb)/ub < proximity_threshold, we would never find an
# admissible point.
x = self.x
ub, lb = self.evaluator.problem.ub, self.evaluator.problem.lb

def normalize(x):
"""Normalize parameter vector to the bounds of the search space."""
return (x - lb) / (ub - lb)

for i in range(self.dim):
for j in range(i + 1, self.dim):
# check proximity
# zero-division may occur here
with np.errstate(divide="ignore", invalid="ignore"):
while (
np.max(np.abs((x[i] - x[j]) / x[j]))
np.max(np.abs(normalize(x[i]) - normalize(x[j])))
<= self.proximity_threshold
):
# too close. replace x_j.
Expand Down
Loading