Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -84,20 +84,19 @@ class PricingEnv(gym.Env):
|
|
84 |
self.data = data
|
85 |
self.current_step = 0
|
86 |
self.max_steps = len(data) - 1
|
87 |
-
self.action_space = spaces.Box(low=0, high=100, shape=(1,), dtype=np.float32)
|
88 |
-
self.observation_space = spaces.Box(low=0, high=np.inf, shape=(6,), dtype=np.float32)
|
89 |
|
90 |
def step(self, action):
|
91 |
reward = self._get_reward(action)
|
92 |
self.current_step += 1
|
93 |
done = self.current_step >= self.max_steps
|
94 |
obs = self._get_observation()
|
95 |
-
return obs, reward, done,
|
96 |
|
97 |
-
def reset(self
|
98 |
-
super().reset(seed=seed)
|
99 |
self.current_step = 0
|
100 |
-
return self._get_observation()
|
101 |
|
102 |
def _get_observation(self):
|
103 |
if self.current_step > self.max_steps:
|
|
|
84 |
self.data = data
|
85 |
self.current_step = 0
|
86 |
self.max_steps = len(data) - 1
|
87 |
+
self.action_space = gym.spaces.Box(low=0, high=100, shape=(1,), dtype=np.float32)
|
88 |
+
self.observation_space = gym.spaces.Box(low=0, high=np.inf, shape=(6,), dtype=np.float32)
|
89 |
|
90 |
def step(self, action):
|
91 |
reward = self._get_reward(action)
|
92 |
self.current_step += 1
|
93 |
done = self.current_step >= self.max_steps
|
94 |
obs = self._get_observation()
|
95 |
+
return obs, reward, done, {} # Removed the 'truncated' flag for compatibility
|
96 |
|
97 |
+
def reset(self):
|
|
|
98 |
self.current_step = 0
|
99 |
+
return self._get_observation()
|
100 |
|
101 |
def _get_observation(self):
|
102 |
if self.current_step > self.max_steps:
|