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

check for increments of 1 #94

Merged
merged 1 commit into from
Sep 30, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def __init__(self, decay_rate=0.999**(1/24)):
"""
self.decay_rate = decay_rate
self.initial_step = None
self._previous_step = 0

def reset(self, current_step=0):
self.initial_step = current_step
Expand All @@ -24,9 +25,11 @@ def _current_efficiency(self, efficiency, current_step):
return efficiency * (self.decay_rate ** (current_step-self.initial_step))

def _update_step(self, current_step):
if self.initial_step is None or current_step <= self.initial_step:
if self.initial_step is None or current_step <= self.initial_step or current_step != self._previous_step + 1:
self.reset(current_step)

self._previous_step = current_step

def transition(self, external_energy_change, efficiency, current_step, **kwargs):
self._update_step(current_step)
current_efficiency = self._current_efficiency(efficiency, current_step)
Expand Down
Loading