Created
August 25, 2020 16:20
-
-
Save Danaze/a772c36246d410a11331d56901597c63 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) | |
discretized.append(new_obs) | |
return tuple(discretized) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment