gym-examples 3.0.262__py3-none-any.whl → 3.0.263__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 +5 -2
- {gym_examples-3.0.262.dist-info → gym_examples-3.0.263.dist-info}/METADATA +1 -1
- gym_examples-3.0.263.dist-info/RECORD +7 -0
- gym_examples-3.0.262.dist-info/RECORD +0 -7
- {gym_examples-3.0.262.dist-info → gym_examples-3.0.263.dist-info}/WHEEL +0 -0
- {gym_examples-3.0.262.dist-info → gym_examples-3.0.263.dist-info}/top_level.txt +0 -0
gym_examples/__init__.py
CHANGED
gym_examples/envs/wsn_env.py
CHANGED
@@ -82,7 +82,8 @@ class WSNRoutingEnv(gym.Env):
|
|
82
82
|
|
83
83
|
# self.action_space = Tuple(tuple([Discrete(self.n_sensors + 1)] * self.n_agents))
|
84
84
|
# self.action_space = MultiDiscrete([self.n_sensors + 1] * self.n_agents)
|
85
|
-
self.action_space = MultiDiscrete([self.n_agents, self.n_sensors + 1])
|
85
|
+
# self.action_space = MultiDiscrete([self.n_agents, self.n_sensors + 1])
|
86
|
+
self.action_space = Discrete(self.n_agents * (self.n_sensors + 1))
|
86
87
|
|
87
88
|
self.reset()
|
88
89
|
|
@@ -137,7 +138,9 @@ class WSNRoutingEnv(gym.Env):
|
|
137
138
|
done = False
|
138
139
|
# actions = [actions[i] for i in range(self.n_agents)] # We want to go back from the MultiDiscrete action space to a tuple of tuple of Discrete action spaces
|
139
140
|
# for i, action in enumerate(actions):
|
140
|
-
|
141
|
+
selected_sensor = actions // (self.n_sensors + 1)
|
142
|
+
target = actions % (self.n_sensors + 1)
|
143
|
+
for i, action in [np.array([selected_sensor, target])]: # This loop is for the PPO algorithm: actions is a numpy array of shape (1, 2)
|
141
144
|
if self.remaining_energy[i] <= 0 or self.number_of_packets[i] <= 0:
|
142
145
|
continue # Skip if sensor has no energy left or no packets to transmit
|
143
146
|
|
@@ -0,0 +1,7 @@
|
|
1
|
+
gym_examples/__init__.py,sha256=V-lDBqJirIbwK5vx8WNT5JyIwiwk22PGBiYSvm6JPo8,166
|
2
|
+
gym_examples/envs/__init__.py,sha256=lgMe4pyOuUTgTBUddM0iwMlETsYTwFShny6ifm8PGM8,53
|
3
|
+
gym_examples/envs/wsn_env.py,sha256=Ee3PTxhwKw2igwK5z465IdgK3mP0ParioXCni6BqXiE,26695
|
4
|
+
gym_examples-3.0.263.dist-info/METADATA,sha256=rpRe1k5FCesyS6hKApj_Z-_sQAjJ01WM90Mzk_a5XPs,412
|
5
|
+
gym_examples-3.0.263.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
6
|
+
gym_examples-3.0.263.dist-info/top_level.txt,sha256=rJRksoAF32M6lTLBEwYzRdo4PgtejceaNnnZ3HeY_Rk,13
|
7
|
+
gym_examples-3.0.263.dist-info/RECORD,,
|
@@ -1,7 +0,0 @@
|
|
1
|
-
gym_examples/__init__.py,sha256=CYfXHf7cNLnC7-qIfJQRpOs1xZSNHDP-MXO0DIQF2r0,166
|
2
|
-
gym_examples/envs/__init__.py,sha256=lgMe4pyOuUTgTBUddM0iwMlETsYTwFShny6ifm8PGM8,53
|
3
|
-
gym_examples/envs/wsn_env.py,sha256=i2aXordG52k5GhxIYQ1AVP2EiBzHtFMHUqwjAmdhWBQ,26481
|
4
|
-
gym_examples-3.0.262.dist-info/METADATA,sha256=nUKnPlBtDhKZCsEpJqp8sdmStdg6ePbgbKlglo7RMck,412
|
5
|
-
gym_examples-3.0.262.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
6
|
-
gym_examples-3.0.262.dist-info/top_level.txt,sha256=rJRksoAF32M6lTLBEwYzRdo4PgtejceaNnnZ3HeY_Rk,13
|
7
|
-
gym_examples-3.0.262.dist-info/RECORD,,
|
File without changes
|
File without changes
|