Created
February 11, 2020 15:23
-
-
Save ikatsov/041fdd61f8c6990358848eef474f56c5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| import gym | |
| from gym.spaces import Discrete, Box | |
| class HiLoPricingEnv(gym.Env): | |
| def __init__(self, config): | |
| self.reset() | |
| self.action_space = Discrete(len(price_grid)) | |
| self.observation_space = Box(0, 10000, shape=(2*T, ), dtype=np.float32) | |
| def reset(self): | |
| self.state = env_intial_state() | |
| self.t = 0 | |
| return self.state | |
| # Returns next state, reward, and end-of-the-episode flag | |
| def step(self, action): | |
| next_state, reward = env_step(self.t, state, action) | |
| self.t += 1 | |
| self.state = next_state | |
| return next_state, reward, self.t == T - 1, {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment