gym-examples 3.0.285__py3-none-any.whl → 3.0.286__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 +2 -6
- {gym_examples-3.0.285.dist-info → gym_examples-3.0.286.dist-info}/METADATA +1 -1
- gym_examples-3.0.286.dist-info/RECORD +7 -0
- gym_examples-3.0.285.dist-info/RECORD +0 -7
- {gym_examples-3.0.285.dist-info → gym_examples-3.0.286.dist-info}/WHEEL +0 -0
- {gym_examples-3.0.285.dist-info → gym_examples-3.0.286.dist-info}/top_level.txt +0 -0
gym_examples/__init__.py
CHANGED
gym_examples/envs/wsn_env.py
CHANGED
@@ -81,10 +81,7 @@ class WSNRoutingEnv(gym.Env):
|
|
81
81
|
)
|
82
82
|
|
83
83
|
# self.action_space = Tuple(tuple([Discrete(self.n_sensors + 1)] * self.n_agents))
|
84
|
-
|
85
|
-
# self.action_space = MultiDiscrete([self.n_agents, self.n_sensors + 1])
|
86
|
-
# self.action_space = Discrete(self.n_sensors + 1) # +1 for the base station
|
87
|
-
self.action_space = Discrete((self.n_sensors + 1)**self.n_agents)
|
84
|
+
self.action_space = MultiDiscrete([self.n_sensors + 1] * self.n_agents)
|
88
85
|
|
89
86
|
self.reset()
|
90
87
|
|
@@ -120,7 +117,6 @@ class WSNRoutingEnv(gym.Env):
|
|
120
117
|
self.steps += 1
|
121
118
|
rewards = [-max_reward] * self.n_sensors
|
122
119
|
dones = [False] * self.n_sensors
|
123
|
-
actions = self.to_base_n(actions, self.n_sensors + 1)
|
124
120
|
for i, action in enumerate(actions):
|
125
121
|
if self.remaining_energy[i] <= 0 or self.number_of_packets[i] <= 0:
|
126
122
|
continue # Skip if sensor has no energy left or no packets to transmit
|
@@ -195,7 +191,7 @@ class WSNRoutingEnv(gym.Env):
|
|
195
191
|
|
196
192
|
rewards = [reward.item() if isinstance(reward, torch.Tensor) else reward for reward in rewards] # Convert the reward to a float
|
197
193
|
rewards = np.mean(rewards) # Average the rewards
|
198
|
-
|
194
|
+
|
199
195
|
for i in range(self.n_sensors):
|
200
196
|
if not dones[i]:
|
201
197
|
dones[i] = self.remaining_energy[i] <= 0 or self.number_of_packets[i] == 0
|
@@ -0,0 +1,7 @@
|
|
1
|
+
gym_examples/__init__.py,sha256=1GK2OycRc394qAo5oxOKW-VdY8PGCGL8BGGeb7kYZmo,166
|
2
|
+
gym_examples/envs/__init__.py,sha256=lgMe4pyOuUTgTBUddM0iwMlETsYTwFShny6ifm8PGM8,53
|
3
|
+
gym_examples/envs/wsn_env.py,sha256=IxZOztoXNUFBhjzrZ_jw0nRg1EhPtTMYDOj6G2-ZT9U,23292
|
4
|
+
gym_examples-3.0.286.dist-info/METADATA,sha256=Mu-PCSCgadaSrJI2QGlySSqtueil18a73qsvuIwyZxo,412
|
5
|
+
gym_examples-3.0.286.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
6
|
+
gym_examples-3.0.286.dist-info/top_level.txt,sha256=rJRksoAF32M6lTLBEwYzRdo4PgtejceaNnnZ3HeY_Rk,13
|
7
|
+
gym_examples-3.0.286.dist-info/RECORD,,
|
@@ -1,7 +0,0 @@
|
|
1
|
-
gym_examples/__init__.py,sha256=RG4x72mbBXJgNSIrzig4Fq6xeAVsPtwrVaN8fHLoVHc,166
|
2
|
-
gym_examples/envs/__init__.py,sha256=lgMe4pyOuUTgTBUddM0iwMlETsYTwFShny6ifm8PGM8,53
|
3
|
-
gym_examples/envs/wsn_env.py,sha256=7AKFR_Q4I_GADV3Q78g-JYacUSIwRDzjxLRZ5X9lzFc,23610
|
4
|
-
gym_examples-3.0.285.dist-info/METADATA,sha256=fR_FUKKdoAUxYEjQ8KbeVC4quinNkfxfqShtSaWFMlo,412
|
5
|
-
gym_examples-3.0.285.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
6
|
-
gym_examples-3.0.285.dist-info/top_level.txt,sha256=rJRksoAF32M6lTLBEwYzRdo4PgtejceaNnnZ3HeY_Rk,13
|
7
|
-
gym_examples-3.0.285.dist-info/RECORD,,
|
File without changes
|
File without changes
|