gym-examples 3.0.261__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 -3
- {gym_examples-3.0.261.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.261.dist-info/RECORD +0 -7
- {gym_examples-3.0.261.dist-info → gym_examples-3.0.263.dist-info}/WHEEL +0 -0
- {gym_examples-3.0.261.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
|
|
@@ -130,7 +131,6 @@ class WSNRoutingEnv(gym.Env):
|
|
130
131
|
|
131
132
|
|
132
133
|
def step(self, actions):
|
133
|
-
print(f"Actions in step of WSNRoutingEnv: {actions} and type {type(actions)}")
|
134
134
|
self.steps += 1
|
135
135
|
# rewards = [-max_reward] * self.n_sensors
|
136
136
|
reward = -max_reward
|
@@ -138,7 +138,9 @@ class WSNRoutingEnv(gym.Env):
|
|
138
138
|
done = False
|
139
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
|
140
140
|
# for i, action in enumerate(actions):
|
141
|
-
|
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)
|
142
144
|
if self.remaining_energy[i] <= 0 or self.number_of_packets[i] <= 0:
|
143
145
|
continue # Skip if sensor has no energy left or no packets to transmit
|
144
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=EYmnHn1aYn3x_bUd8fgo7-mIabHA6MlIYIECdK0RgLo,166
|
2
|
-
gym_examples/envs/__init__.py,sha256=lgMe4pyOuUTgTBUddM0iwMlETsYTwFShny6ifm8PGM8,53
|
3
|
-
gym_examples/envs/wsn_env.py,sha256=2ldLj0D1jkHY93C4m0bfZpRZXxMJN79um7lfDIF_9l8,26569
|
4
|
-
gym_examples-3.0.261.dist-info/METADATA,sha256=hB4fNZreReHqZS9sULIyJYEsPyclC0Afdu6zHI7P5Bk,412
|
5
|
-
gym_examples-3.0.261.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
6
|
-
gym_examples-3.0.261.dist-info/top_level.txt,sha256=rJRksoAF32M6lTLBEwYzRdo4PgtejceaNnnZ3HeY_Rk,13
|
7
|
-
gym_examples-3.0.261.dist-info/RECORD,,
|
File without changes
|
File without changes
|