gym-examples 3.0.129__py3-none-any.whl → 3.0.131__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- gym_examples/__init__.py +1 -1
- gym_examples/envs/wsn_env.py +20 -5
- {gym_examples-3.0.129.dist-info → gym_examples-3.0.131.dist-info}/METADATA +1 -1
- gym_examples-3.0.131.dist-info/RECORD +7 -0
- gym_examples-3.0.129.dist-info/RECORD +0 -7
- {gym_examples-3.0.129.dist-info → gym_examples-3.0.131.dist-info}/WHEEL +0 -0
- {gym_examples-3.0.129.dist-info → gym_examples-3.0.131.dist-info}/top_level.txt +0 -0
gym_examples/__init__.py
CHANGED
gym_examples/envs/wsn_env.py
CHANGED
@@ -172,12 +172,27 @@ class WSNRoutingEnv(gym.Env):
|
|
172
172
|
|
173
173
|
return self._get_obs(), rewards, dones, {}
|
174
174
|
|
175
|
+
# def _get_obs(self):
|
176
|
+
# return [{'remaining_energy': np.array([e]),
|
177
|
+
# 'consumption_energy': np.array([initial_energy - e]),
|
178
|
+
# 'sensor_positions': p,
|
179
|
+
# 'number_of_packets': np.array([d])
|
180
|
+
# } for e, p, d in zip(self.remaining_energy, self.sensor_positions, self.number_of_packets)]
|
181
|
+
|
175
182
|
def _get_obs(self):
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
183
|
+
print(f"zip(self.remaining_energy, self.sensor_positions, self.number_of_packets): {zip(self.remaining_energy, self.sensor_positions, self.number_of_packets)}")
|
184
|
+
remaining_energy = np.array([e for e, _, _, _ in zip(self.remaining_energy, self.sensor_positions, self.number_of_packets)])
|
185
|
+
consumption_energy = np.array([initial_energy - e for e, _, _, _ in zip(self.remaining_energy, self.sensor_positions, self.number_of_packets)])
|
186
|
+
sensor_positions = np.stack(self.sensor_positions, axis=0)
|
187
|
+
number_of_packets = np.array([d for _, _, _, d in zip(self.remaining_energy, self.sensor_positions, self.number_of_packets)])
|
188
|
+
|
189
|
+
return {
|
190
|
+
'remaining_energy': remaining_energy,
|
191
|
+
'consumption_energy': consumption_energy,
|
192
|
+
'sensor_positions': sensor_positions,
|
193
|
+
'number_of_packets': number_of_packets
|
194
|
+
}
|
195
|
+
|
181
196
|
|
182
197
|
def _get_observation_space(self):
|
183
198
|
return Dict({
|
@@ -0,0 +1,7 @@
|
|
1
|
+
gym_examples/__init__.py,sha256=ahSriOOSpl8TYtUBU7apEBqIqkv-NYN--SeN8MXBnvQ,194
|
2
|
+
gym_examples/envs/__init__.py,sha256=lgMe4pyOuUTgTBUddM0iwMlETsYTwFShny6ifm8PGM8,53
|
3
|
+
gym_examples/envs/wsn_env.py,sha256=dJoyTUnM4KzwyOY90VbrlxORhtWOuEniQmyFJhJ3EQU,22456
|
4
|
+
gym_examples-3.0.131.dist-info/METADATA,sha256=GAJOuP-KnMkbDrIUjNVCKglTO807gO7lNoAkR1-ZWgg,412
|
5
|
+
gym_examples-3.0.131.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
6
|
+
gym_examples-3.0.131.dist-info/top_level.txt,sha256=rJRksoAF32M6lTLBEwYzRdo4PgtejceaNnnZ3HeY_Rk,13
|
7
|
+
gym_examples-3.0.131.dist-info/RECORD,,
|
@@ -1,7 +0,0 @@
|
|
1
|
-
gym_examples/__init__.py,sha256=f5RfZkZxk0_sPLzl68-buUGDEr0bw8Odn_OhBrqtJMI,194
|
2
|
-
gym_examples/envs/__init__.py,sha256=lgMe4pyOuUTgTBUddM0iwMlETsYTwFShny6ifm8PGM8,53
|
3
|
-
gym_examples/envs/wsn_env.py,sha256=SPuZ6Eezn7LY38r7eGtMAZw6SfbLnBSdbGyLNaSA0D0,21515
|
4
|
-
gym_examples-3.0.129.dist-info/METADATA,sha256=kKkDZbChu1-rph3VjmRNqfLqMhfRP7jQkn-OpZeKxGQ,412
|
5
|
-
gym_examples-3.0.129.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
6
|
-
gym_examples-3.0.129.dist-info/top_level.txt,sha256=rJRksoAF32M6lTLBEwYzRdo4PgtejceaNnnZ3HeY_Rk,13
|
7
|
-
gym_examples-3.0.129.dist-info/RECORD,,
|
File without changes
|
File without changes
|