gym-examples 3.0.26__py3-none-any.whl → 3.0.28__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.26"
9
+ __version__ = "3.0.28"
@@ -69,21 +69,30 @@ class WSNRoutingEnv(gym.Env):
69
69
 
70
70
 
71
71
  def reset(self):
72
- if self.episode_count % 50 == 0 and self.episode_count > 0:
73
- print(f"\n========================================")
74
- print(f"Episode {self.episode_count} with previous number of steps = {self.steps}")
75
- print(f"Network throughput = {self.network_throughput}")
76
- print(f"Energy efficiency = {self.energy_efficiency}")
77
- print(f"Packet delivery ratio = {self.packet_delivery_ratio}")
78
- print(f"Network lifetime = {self.network_lifetime}")
79
- print(f"Average latency = {self.average_latency}")
80
- print(f"First node dead time = {self.first_node_dead_time}")
81
- print(f"========================================\n")
72
+ # if self.episode_count > 1:
73
+ # self.get_metrics()
74
+ # # Save the metrics to a CSV file
75
+ # with open('metrics.csv', mode='a') as file:
76
+ # writer = csv.writer(file)
77
+ # if self.episode_count == 2:
78
+ # writer.writerow(['Episode', 'Network throughput', 'Energy efficiency', 'Packet delivery ratio', 'Network lifetime', 'Average latency', 'First node dead time'])
79
+ # 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
80
+ # if self.episode_count % 50 == 0 and self.episode_count > 0:
81
+ # print(f"\n========================================")
82
+ # print(f"Episode {self.episode_count} with previous number of steps = {self.steps}")
83
+ # print(f"Network throughput = {self.network_throughput}")
84
+ # print(f"Energy efficiency = {self.energy_efficiency}")
85
+ # print(f"Packet delivery ratio = {self.packet_delivery_ratio}")
86
+ # print(f"Network lifetime = {self.network_lifetime}")
87
+ # print(f"Average latency = {self.average_latency}")
88
+ # print(f"First node dead time = {self.first_node_dead_time}")
89
+ # print(f"========================================\n")
82
90
  self.sensor_positions = np.random.rand(self.n_sensors, 2) * (upper_bound - lower_bound) + lower_bound
83
91
  self.distance_to_base = np.linalg.norm(self.sensor_positions - base_station_position, axis=1)
84
92
  self.remaining_energy = np.ones(self.n_sensors) * initial_energy
85
93
  self.number_of_packets = np.ones(self.n_sensors, dtype=int) * initial_number_of_packets # number of packets to transmit
86
94
  self.episode_count += 1
95
+ print(f"Episode = {self.episode_count}")
87
96
 
88
97
  self.packets_delivered = 0
89
98
  self.total_energy_consumed = 0
@@ -103,6 +112,7 @@ class WSNRoutingEnv(gym.Env):
103
112
 
104
113
  def step(self, actions):
105
114
  self.steps += 1
115
+ print(f"Step = {self.steps}")
106
116
  rewards = [0] * self.n_sensors
107
117
  dones = [False] * self.n_sensors
108
118
  # if self.episode_count >= 599:
@@ -185,8 +195,6 @@ class WSNRoutingEnv(gym.Env):
185
195
  if self.first_node_dead_time is None and np.any(self.remaining_energy <= 0):
186
196
  self.first_node_dead_time = self.steps
187
197
 
188
- self.get_metrics()
189
-
190
198
  return self._get_obs(), rewards, dones, {}
191
199
 
192
200
  def _get_obs(self):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gym-examples
3
- Version: 3.0.26
3
+ Version: 3.0.28
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=cV7VZCHK-HyU1olBmWIL6QuUos4gA5dKdALWflNMmgg,193
2
+ gym_examples/envs/__init__.py,sha256=lgMe4pyOuUTgTBUddM0iwMlETsYTwFShny6ifm8PGM8,53
3
+ gym_examples/envs/wsn_env.py,sha256=mPeQ5Dwhg2uQEZrBOQliDN-Lng2DTlIRbWDss9Fip04,19571
4
+ gym_examples-3.0.28.dist-info/METADATA,sha256=FiGGJ4VDZudykxepmHcAedzcmzGJ1CqernPoFn1p55k,411
5
+ gym_examples-3.0.28.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
6
+ gym_examples-3.0.28.dist-info/top_level.txt,sha256=rJRksoAF32M6lTLBEwYzRdo4PgtejceaNnnZ3HeY_Rk,13
7
+ gym_examples-3.0.28.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- gym_examples/__init__.py,sha256=K471ehho4y7qEgnc9j_rAzmoo2sI4qIgtHp0t7iBNKk,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.26.dist-info/METADATA,sha256=5KonNMujlMgDk_giR9OlfI2MDZwxP4Tb74UlUEaoMl0,411
5
- gym_examples-3.0.26.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
6
- gym_examples-3.0.26.dist-info/top_level.txt,sha256=rJRksoAF32M6lTLBEwYzRdo4PgtejceaNnnZ3HeY_Rk,13
7
- gym_examples-3.0.26.dist-info/RECORD,,