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

ESSOptimizer: Fix bug in go-beyond #1480

Merged
merged 1 commit into from
Oct 8, 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
6 changes: 3 additions & 3 deletions pypesto/optimize/ess/ess.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ def _do_local_search(
def _maybe_update_global_best(self, x, fx):
"""Update the global best value if the provided value is better."""
if fx < self.fx_best:
self.x_best = x[:]
self.x_best[:] = x
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how is this related to the go-beyond algorithm?

Copy link
Member Author

@dweindl dweindl Oct 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not. But it's another potential (non-)copying issue.

self.fx_best = fx
self.x_best_has_changed = True
self.history.update(
Expand All @@ -583,9 +583,9 @@ def _go_beyond(self, x_best_children, fx_best_children):
continue

# offspring is better than parent
x_parent = self.refset.x[i]
x_parent = self.refset.x[i].copy()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do i see correctly that the problem was that x_parent/child are edited further below and thus edit the reset itself?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem was not so much editing the refset per se, but that in the second inner iteration, x_parent would become identical to x_child.

fx_parent = self.refset.fx[i]
x_child = x_best_children[i]
x_child = x_best_children[i].copy()
fx_child = fx_best_children[i]
improvement = 1
# Multiplier used in determining the hyper-rectangle from which to
Expand Down