gym-examples 3.0.27__py3-none-any.whl → 3.0.29__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
@@ -6,4 +6,4 @@ register(
6
6
  max_episode_steps=50,
7
7
  )
8
8
 
9
- __version__ = "3.0.27"
9
+ __version__ = "3.0.29"
@@ -69,6 +69,14 @@ class WSNRoutingEnv(gym.Env):
69
69
 
70
70
 
71
71
  def reset(self):
72
+ # Save the metrics to a CSV file
73
+ if self.episode_count > 0:
74
+ with open('metrics.csv', mode='a') as file:
75
+ writer = csv.writer(file)
76
+ if self.episode_count == 1:
77
+ writer.writerow(['Episode', 'Network throughput', 'Energy efficiency', 'Packet delivery ratio', 'Network lifetime', 'Average latency', 'First node dead time'])
78
+ writer.writerow([self.episode_count - 1, self.network_throughput, self.energy_efficiency, self.packet_delivery_ratio, self.network_lifetime, self.average_latency, self.first_node_dead_time])
79
+
72
80
  if self.episode_count % 50 == 0 and self.episode_count > 0:
73
81
  print(f"\n========================================")
74
82
  print(f"Episode {self.episode_count} with previous number of steps = {self.steps}")
@@ -185,8 +193,6 @@ class WSNRoutingEnv(gym.Env):
185
193
  if self.first_node_dead_time is None and np.any(self.remaining_energy <= 0):
186
194
  self.first_node_dead_time = self.steps
187
195
 
188
- self.get_metrics()
189
-
190
196
  return self._get_obs(), rewards, dones, {}
191
197
 
192
198
  def _get_obs(self):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gym-examples
3
- Version: 3.0.27
3
+ Version: 3.0.29
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=kjxQh1V3vNafWtrGjEAWspS0vT9jGH8kmGmDnPcUxpk,193
2
+ gym_examples/envs/__init__.py,sha256=lgMe4pyOuUTgTBUddM0iwMlETsYTwFShny6ifm8PGM8,53
3
+ gym_examples/envs/wsn_env.py,sha256=oFnj-yRCNBywQGr8hJ06KJ5JTmhb-upzX3B3_CwlAUw,19422
4
+ gym_examples-3.0.29.dist-info/METADATA,sha256=YPpF8dCRhKJRhsnbBv5Bl8UY037kVd3PFXxapuBmf6M,411
5
+ gym_examples-3.0.29.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
6
+ gym_examples-3.0.29.dist-info/top_level.txt,sha256=rJRksoAF32M6lTLBEwYzRdo4PgtejceaNnnZ3HeY_Rk,13
7
+ gym_examples-3.0.29.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- gym_examples/__init__.py,sha256=iQUO128Pct53rdKFCXIughPkeMtPVpY8k73pKsDoY5E,193
2
- gym_examples/envs/__init__.py,sha256=lgMe4pyOuUTgTBUddM0iwMlETsYTwFShny6ifm8PGM8,53
3
- gym_examples/envs/wsn_env.py,sha256=giPHWM3rvSAhodinIb2QW-l7cMOCXE7aEAQorgFZcEQ,18830
4
- gym_examples-3.0.27.dist-info/METADATA,sha256=dAJdSReULaWV5Mpzebz8x_q9C4cs0AzMJjqUU27WHck,411
5
- gym_examples-3.0.27.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
6
- gym_examples-3.0.27.dist-info/top_level.txt,sha256=rJRksoAF32M6lTLBEwYzRdo4PgtejceaNnnZ3HeY_Rk,13
7
- gym_examples-3.0.27.dist-info/RECORD,,