Skip to content

Commit

Permalink
Merge pull request #359 from pdb5627/issue357-avoid-retrying-same-solns
Browse files Browse the repository at this point in the history
Avoid retrying the same solutions
  • Loading branch information
bknueven authored Jan 3, 2024
2 parents 93906ff + 0c9ee78 commit 4f857db
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions mpisppy/cylinders/xhatshufflelooper_bounder.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ def _vb(msg):
# update the caches
self.opt._put_nonant_cache(self.localnonants)
self.opt._restore_nonants()

scenario_cycler.begin_epoch()

next_scendict = scenario_cycler.get_next()
if next_scendict is not None:
Expand All @@ -147,8 +149,6 @@ def _vb(msg):
if update:
_vb(f" Updating best to {next_scendict}")
scenario_cycler.best = next_scendict
else:
scenario_cycler.begin_epoch()

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

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

self._cycle_idx = 0
self._begin_normal_epoch()

self._best = None
Expand Down Expand Up @@ -249,7 +250,6 @@ def _begin_normal_epoch(self):
self._reversed = False
self._shuffled_snames = [s[1] for s in self._shuffled_scenarios]
self._original_order = [s[0] for s in self._shuffled_scenarios]
self._cycle_idx = 0
self._cur_ROOTscen = self._shuffled_snames[0]
self.create_nodescen_dict()

Expand All @@ -259,7 +259,6 @@ def _begin_reverse_epoch(self):
self._reversed = True
self._shuffled_snames = [s[1] for s in reversed(self._shuffled_scenarios)]
self._original_order = [s[0] for s in reversed(self._shuffled_scenarios)]
self._cycle_idx = 0
self._cur_ROOTscen = self._shuffled_snames[0]
self.create_nodescen_dict()

Expand Down

0 comments on commit 4f857db

Please sign in to comment.