Created
February 11, 2020 16:38
-
-
Save ikatsov/299621a7c00a986837a5bd40686f47d1 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
| 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