gym-examples 3.0.274__py3-none-any.whl → 3.0.276__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 +9 -9
- {gym_examples-3.0.274.dist-info → gym_examples-3.0.276.dist-info}/METADATA +1 -1
- gym_examples-3.0.276.dist-info/RECORD +7 -0
- gym_examples-3.0.274.dist-info/RECORD +0 -7
- {gym_examples-3.0.274.dist-info → gym_examples-3.0.276.dist-info}/WHEEL +0 -0
- {gym_examples-3.0.274.dist-info → gym_examples-3.0.276.dist-info}/top_level.txt +0 -0
gym_examples/__init__.py
CHANGED
gym_examples/envs/wsn_env.py
CHANGED
@@ -9,6 +9,7 @@ import torch
|
|
9
9
|
import torch.nn as nn
|
10
10
|
import torch.nn.functional as F
|
11
11
|
import os
|
12
|
+
from collections import OrderedDict
|
12
13
|
|
13
14
|
# Define the network parameters for the final reward function
|
14
15
|
input_dim = 4 # length of the individual rewards vector
|
@@ -111,7 +112,7 @@ class WSNRoutingEnv(gym.Env):
|
|
111
112
|
self.episode_count += 1
|
112
113
|
|
113
114
|
self.get_metrics()
|
114
|
-
|
115
|
+
|
115
116
|
return self._get_obs()
|
116
117
|
|
117
118
|
|
@@ -121,7 +122,6 @@ class WSNRoutingEnv(gym.Env):
|
|
121
122
|
# rewards = 0
|
122
123
|
dones = False
|
123
124
|
actions = np.array([self.current_sensor, actions])
|
124
|
-
print(f"\nactions from step in WSNRoutingEnv: {actions}\n")
|
125
125
|
for i, action in [actions]:
|
126
126
|
if self.remaining_energy[i] <= 0 or self.number_of_packets[i] <= 0:
|
127
127
|
continue # Skip if sensor has no energy left or no packets to transmit
|
@@ -231,13 +231,13 @@ class WSNRoutingEnv(gym.Env):
|
|
231
231
|
|
232
232
|
|
233
233
|
def _get_observation_space(self):
|
234
|
-
return Dict(
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
234
|
+
return Dict(OrderedDict([
|
235
|
+
('remaining_energy', Box(low=0, high=initial_energy, shape=(1,), dtype=np.float64)),
|
236
|
+
('consumption_energy', Box(low=0, high=initial_energy, shape=(1,), dtype=np.float64)),
|
237
|
+
('sensor_positions', Box(low=lower_bound, high=upper_bound, shape=(2,), dtype=np.float64)),
|
238
|
+
('number_of_packets', Box(low=0, high=self.n_sensors * initial_number_of_packets + 1, shape=(1,), dtype=int)),
|
239
|
+
('current_sensor', Box(low=0, high=self.n_sensors - 1, shape=(1,), dtype=int))
|
240
|
+
]))
|
241
241
|
|
242
242
|
|
243
243
|
def get_state(self):
|
@@ -0,0 +1,7 @@
|
|
1
|
+
gym_examples/__init__.py,sha256=sxoi8VXpsjUx4-iwiC6bUozanl7r_nO-IAXLaC0_F3Y,166
|
2
|
+
gym_examples/envs/__init__.py,sha256=lgMe4pyOuUTgTBUddM0iwMlETsYTwFShny6ifm8PGM8,53
|
3
|
+
gym_examples/envs/wsn_env.py,sha256=pi4-ErjIpxM1jrWjMr8vbUHmp0YSY9YaGSTXsL2k50I,24121
|
4
|
+
gym_examples-3.0.276.dist-info/METADATA,sha256=nNq__QCASDTY89JfO9-DElxxg2JipY6GnK4fJpLIEj8,412
|
5
|
+
gym_examples-3.0.276.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
6
|
+
gym_examples-3.0.276.dist-info/top_level.txt,sha256=rJRksoAF32M6lTLBEwYzRdo4PgtejceaNnnZ3HeY_Rk,13
|
7
|
+
gym_examples-3.0.276.dist-info/RECORD,,
|
@@ -1,7 +0,0 @@
|
|
1
|
-
gym_examples/__init__.py,sha256=lghJ3o_jHKKCoVsyBYdJfXiok6adkourXQgsWQmAVQ0,166
|
2
|
-
gym_examples/envs/__init__.py,sha256=lgMe4pyOuUTgTBUddM0iwMlETsYTwFShny6ifm8PGM8,53
|
3
|
-
gym_examples/envs/wsn_env.py,sha256=YDIqycbx4vYRP4e9aueEQZJxBOjb3X5V4OpSSFVXBg0,24162
|
4
|
-
gym_examples-3.0.274.dist-info/METADATA,sha256=5snFdPtqiSbvivj5Uem_0QX_t-2_dZPBWOZAhBwiO7s,412
|
5
|
-
gym_examples-3.0.274.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
6
|
-
gym_examples-3.0.274.dist-info/top_level.txt,sha256=rJRksoAF32M6lTLBEwYzRdo4PgtejceaNnnZ3HeY_Rk,13
|
7
|
-
gym_examples-3.0.274.dist-info/RECORD,,
|
File without changes
|
File without changes
|