Skip to content

Instantly share code, notes, and snippets.

@ikatsov
Created February 11, 2020 16:38
Show Gist options
  • Select an option

  • Save ikatsov/299621a7c00a986837a5bd40686f47d1 to your computer and use it in GitHub Desktop.

Select an option

Save ikatsov/299621a7c00a986837a5bd40686f47d1 to your computer and use it in GitHub Desktop.
class SimpleSupplyChain(gym.Env):
def __init__(self, config):
self.reset()
self.action_space = Box(low=0.0, high=20.0) # Continuous space
self.observation_space = Box(low=-10000, high=10000)
def reset(self):
self.supply_chain = SupplyChainEnvironment()
self.state = self.supply_chain.initial_state()
return self.state.to_array()
def step(self, action):
action_obj = Action(self.supply_chain.warehouse_num)
action_obj.production_level = action[0]
action_obj.shippings_to_warehouses = action[1:]
self.state, reward, done = self.supply_chain.step(self.state, action_obj)
return self.state.to_array(), reward, done, {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment