Skip to content

Instantly share code, notes, and snippets.

Created Aug 25, 2020
What would you like to do?
def discretize_state(self, obs):
discretized = list()
for i in range(len(obs)):
scaling = (obs[i] + abs(self.lower_bounds[i])) / (self.upper_bounds[i] - self.lower_bounds[i])
new_obs = int(round((self.buckets[i] - 1) * scaling))
new_obs = min(self.buckets[i] - 1, max(0, new_obs))
return tuple(discretized)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment