MCPcopy Create free account
hub / github.com/BindsNET/bindsnet / update_index

Method update_index

bindsnet/environment/environment.py:248–261  ·  view source on GitHub ↗

Updates the index to keep track of history. For example: ``history = 4``, ``delta = 3`` will produce ``self.history = {1, 4, 7, 10}`` and ``self.history_index`` will be updated according to ``self.delta`` and will wrap around the history dictionary.

(self)

Source from the content-addressed store, hash-verified

246 self.obs = temp
247
248 def update_index(self) -> None:
249 # language=rst
250 """
251 Updates the index to keep track of history. For example: ``history = 4``,
252 ``delta = 3`` will produce ``self.history = {1, 4, 7, 10}`` and
253 ``self.history_index`` will be updated according to ``self.delta`` and will wrap
254 around the history dictionary.
255 """
256 if self.episode_step_count % self.delta == 0:
257 if self.history_index != max(self.history.keys()):
258 self.history_index += self.delta
259 else:
260 # Wrap around the history.
261 self.history_index = (self.history_index % max(self.history.keys())) + 1

Callers 1

stepMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected