Skip to content

Commit dcdee75

Browse files
committed
Reset slow iteration counter when doing soft restarts. See issue 18 for Py-BOBYQA
1 parent ff249b3 commit dcdee75

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

dfols/controller.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,6 @@ def __init__(self, objfun, args, x0, r0, r0_nsamples, xl, xu, npt, rhobeg, rhoen
107107
self.rho = rhobeg
108108
self.rhoend = rhoend
109109
self.diffs = [0.0, 0.0, 0.0]
110-
self.last_iters_step_taken = []
111-
self.last_fopts_step_taken = []
112-
self.num_slow_iters = 0
113110
self.finished_growing = False
114111
self.finished_halfway_growing = False
115112
# For measuing slow iterations
@@ -569,6 +566,11 @@ def soft_restart(self, number_of_samples, nruns_so_far, params, x_in_abs_coords_
569566
self.delta = self.rhobeg
570567
self.rho = self.rhobeg
571568
self.diffs = [0.0, 0.0, 0.0]
569+
570+
# Forget history of slow iterations
571+
self.last_iters_step_taken = []
572+
self.last_fopts_step_taken = []
573+
self.num_slow_iters = 0
572574

573575
all_sq_dist = self.model.distances_to_xopt()[:self.model.npt()]
574576
closest_points = np.argsort(all_sq_dist)

0 commit comments

Comments
 (0)