Skip to content

Instantly share code, notes, and snippets.

@ikatsov
Created February 11, 2020 15:23
Show Gist options
  • Select an option

  • Save ikatsov/041fdd61f8c6990358848eef474f56c5 to your computer and use it in GitHub Desktop.

Select an option

Save ikatsov/041fdd61f8c6990358848eef474f56c5 to your computer and use it in GitHub Desktop.
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