gym-examples 3.0.284__py3-none-any.whl → 3.0.285__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 CHANGED
@@ -5,4 +5,4 @@ register(
5
5
  entry_point="gym_examples.envs:WSNRoutingEnv",
6
6
  )
7
7
 
8
- __version__ = "3.0.284"
8
+ __version__ = "3.0.285"
@@ -173,7 +173,7 @@ class WSNRoutingEnv(gym.Env):
173
173
  self.packet_latency[action] += self.packet_latency[i] + latency_per_hop
174
174
  self.packet_latency[i] = 0
175
175
 
176
- rewards = self.compute_individual_rewards(i, action)
176
+ rewards[i] = self.compute_individual_rewards(i, action)
177
177
 
178
178
  # Update the number of packets
179
179
  self.number_of_packets[action] += self.number_of_packets[i]
@@ -181,7 +181,7 @@ class WSNRoutingEnv(gym.Env):
181
181
  self.number_of_packets[i] = 0 # Reset the number of packets of the sensor i
182
182
  # Calculate final reward
183
183
  # rewards[i] = self.compute_attention_rewards(rewards[i])
184
- rewards = np.mean(rewards)
184
+ rewards[i] = np.mean(rewards[i])
185
185
 
186
186
  # Integrate the mobility of the sensors
187
187
  # self.integrate_mobility()
@@ -194,9 +194,12 @@ class WSNRoutingEnv(gym.Env):
194
194
  self.get_metrics()
195
195
 
196
196
  rewards = [reward.item() if isinstance(reward, torch.Tensor) else reward for reward in rewards] # Convert the reward to a float
197
+ rewards = np.mean(rewards) # Average the rewards
198
+
197
199
  for i in range(self.n_sensors):
198
200
  if not dones[i]:
199
201
  dones[i] = self.remaining_energy[i] <= 0 or self.number_of_packets[i] == 0
202
+ dones = np.all(dones)
200
203
 
201
204
  return self._get_obs(), rewards, dones, self.get_metrics()
202
205
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gym-examples
3
- Version: 3.0.284
3
+ Version: 3.0.285
4
4
  Summary: A custom environment for multi-agent reinforcement learning focused on WSN routing.
5
5
  Home-page: https://github.com/gedji/CODES.git
6
6
  Author: Georges Djimefo
@@ -0,0 +1,7 @@
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,,
@@ -1,7 +0,0 @@
1
- gym_examples/__init__.py,sha256=SbYVbDAngXH8S9SM6aQijqGwMUt-FSXYtOV00-_0ahI,166
2
- gym_examples/envs/__init__.py,sha256=lgMe4pyOuUTgTBUddM0iwMlETsYTwFShny6ifm8PGM8,53
3
- gym_examples/envs/wsn_env.py,sha256=VzbARUwPIdS6-RkQND3dxx0lLheFpP6NqaBwT5JY91o,23503
4
- gym_examples-3.0.284.dist-info/METADATA,sha256=U9huJCLpn-NIXHhbpD97MFIY_WpCrOxX7ebSgLBsf_w,412
5
- gym_examples-3.0.284.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
6
- gym_examples-3.0.284.dist-info/top_level.txt,sha256=rJRksoAF32M6lTLBEwYzRdo4PgtejceaNnnZ3HeY_Rk,13
7
- gym_examples-3.0.284.dist-info/RECORD,,