add randomize_starting_position to the rl_config

This commit is contained in:
robcaulk
2022-11-27 21:03:13 +01:00
parent 64d4a52a56
commit 7fd6bc526e
3 changed files with 6 additions and 3 deletions

View File

@@ -122,9 +122,10 @@ class BaseEnvironment(gym.Env):
self._done = False
if self.starting_point is True:
length_of_data = int(self._end_tick/4)
start_tick = random.randint(self.window_size+1, length_of_data)
self._start_tick = start_tick
if self.rl_config.get('randomize_starting_position', False):
length_of_data = int(self._end_tick / 4)
start_tick = random.randint(self.window_size + 1, length_of_data)
self._start_tick = start_tick
self._position_history = (self._start_tick * [None]) + [self._position]
else:
self._position_history = (self.window_size * [None]) + [self._position]