Skip to content

Commit 4f857db

Browse files
authored
Merge pull request #359 from pdb5627/issue357-avoid-retrying-same-solns
Avoid retrying the same solutions
2 parents 93906ff + 0c9ee78 commit 4f857db

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

mpisppy/cylinders/xhatshufflelooper_bounder.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ def _vb(msg):
139139
# update the caches
140140
self.opt._put_nonant_cache(self.localnonants)
141141
self.opt._restore_nonants()
142+
143+
scenario_cycler.begin_epoch()
142144

143145
next_scendict = scenario_cycler.get_next()
144146
if next_scendict is not None:
@@ -147,8 +149,6 @@ def _vb(msg):
147149
if update:
148150
_vb(f" Updating best to {next_scendict}")
149151
scenario_cycler.best = next_scendict
150-
else:
151-
scenario_cycler.begin_epoch()
152152

153153
#_vb(f" scenario_cycler._scenarios_this_epoch {scenario_cycler._scenarios_this_epoch}")
154154

@@ -174,6 +174,7 @@ def __init__(self, shuffled_scenarios,nonleaves,reverse,iter_step):
174174
self._shuffled_scenarios = shuffled_scenarios
175175
self._num_scenarios = len(shuffled_scenarios)
176176

177+
self._cycle_idx = 0
177178
self._begin_normal_epoch()
178179

179180
self._best = None
@@ -249,7 +250,6 @@ def _begin_normal_epoch(self):
249250
self._reversed = False
250251
self._shuffled_snames = [s[1] for s in self._shuffled_scenarios]
251252
self._original_order = [s[0] for s in self._shuffled_scenarios]
252-
self._cycle_idx = 0
253253
self._cur_ROOTscen = self._shuffled_snames[0]
254254
self.create_nodescen_dict()
255255

@@ -259,7 +259,6 @@ def _begin_reverse_epoch(self):
259259
self._reversed = True
260260
self._shuffled_snames = [s[1] for s in reversed(self._shuffled_scenarios)]
261261
self._original_order = [s[0] for s in reversed(self._shuffled_scenarios)]
262-
self._cycle_idx = 0
263262
self._cur_ROOTscen = self._shuffled_snames[0]
264263
self.create_nodescen_dict()
265264

0 commit comments

Comments
 (0)