From dec6b6c700341542446a391dea4573c8597f7deb Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Wed, 2 Oct 2024 20:50:22 +0200 Subject: [PATCH] ESSOptimizer: Fix bug in go-beyond Fixes some issues related to copies vs views, that stopped the go-beyond search prematurely. --- pypesto/optimize/ess/ess.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pypesto/optimize/ess/ess.py b/pypesto/optimize/ess/ess.py index c53b56837..a9cad7b36 100644 --- a/pypesto/optimize/ess/ess.py +++ b/pypesto/optimize/ess/ess.py @@ -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 self.fx_best = fx self.x_best_has_changed = True self.history.update( @@ -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() 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