gym-examples 2.0.70__py3-none-any.whl → 2.0.72__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__ = "2.0.70"
9
+ __version__ = "2.0.72"
@@ -109,11 +109,11 @@ class WSNRoutingEnv(gym.Env):
109
109
  # Calculate the energy consumption and remaining for transmitting data to the base station
110
110
  transmission_energy = self.transmission_energy(self.number_of_packets[i], self.distance_to_base[i])
111
111
  self.update_sensor_energies(i, transmission_energy)
112
- if np.sum(self.consumption_energy) != 0:
113
- print("\n=================================================")
114
- print(f"Sensor {i} transmits {self.number_of_packets[i]} packets to the base station.")
115
- print(f"Consumption energy: {np.sum(self.consumption_energy)}")
116
- print("=================================================\n")
112
+ # if np.sum(self.consumption_energy) != 0:
113
+ # print("\n=================================================")
114
+ # print(f"Sensor {i} transmits {self.number_of_packets[i]} packets to the base station.")
115
+ # print(f"Consumption energy: {np.sum(self.consumption_energy)}")
116
+ # print("=================================================\n")
117
117
  rewards[i] = self.compute_individual_rewards(i, action)
118
118
  dones[i] = True
119
119
  else:
@@ -122,11 +122,11 @@ class WSNRoutingEnv(gym.Env):
122
122
  reception_energy = self.reception_energy(self.number_of_packets[i])
123
123
  self.update_sensor_energies(i, transmission_energy)
124
124
  self.update_sensor_energies(action, reception_energy)
125
- if np.sum(self.consumption_energy) != 0:
126
- print("\n=================================================")
127
- print(f"Sensor {i} transmits {self.number_of_packets[i]} packets to sensor {action}.")
128
- print(f"Consumption energy: {np.sum(self.consumption_energy)}")
129
- print("=================================================\n")
125
+ # if np.sum(self.consumption_energy) != 0:
126
+ # print("\n=================================================")
127
+ # print(f"Sensor {i} transmits {self.number_of_packets[i]} packets to sensor {action}.")
128
+ # print(f"Consumption energy: {np.sum(self.consumption_energy)}")
129
+ # print("=================================================\n")
130
130
  # Compute individual rewards
131
131
  rewards[i] = self.compute_individual_rewards(i, action)
132
132
  # Update the number of packets
@@ -144,6 +144,12 @@ class WSNRoutingEnv(gym.Env):
144
144
 
145
145
  # Call methods once and store results to avoid repeated calculations
146
146
  network_consumption_energy = self.network_reward_consumption_energy()
147
+ if np.sum(self.consumption_energy) != 0:
148
+ print("\n=================================================")
149
+ print(f"Total consumption energy: {np.sum(self.consumption_energy)}")
150
+ print(f"Network consumption energy: {network_consumption_energy}")
151
+ print(f"Network dispersion energy: {self.network_reward_dispersion_remaining_energy()}")
152
+ print("=================================================\n")
147
153
  network_dispersion_energy = self.network_reward_dispersion_remaining_energy()
148
154
  # Only proceed if network consumption energy is not zero to avoid unnecessary list comprehension
149
155
  if network_consumption_energy != 0:
@@ -311,11 +317,14 @@ class WSNRoutingEnv(gym.Env):
311
317
  Compute the reward based on the total energy consumption (transmission, reception) at the network level
312
318
  '''
313
319
  total_energy = np.sum(self.consumption_energy)
314
-
320
+ print(f"Inside network_reward_consumption_energy, total energy: {total_energy}")
315
321
  # Normalize the total energy consumption
316
322
  max_transmission_energy = self.transmission_energy(self.n_sensors * initial_number_of_packets, self.coverage_radius)
323
+ print(f"Inside network_reward_consumption_energy, max transmission energy: {max_transmission_energy}")
317
324
  max_reception_energy = self.reception_energy(self.n_sensors * initial_number_of_packets)
325
+ print(f"Inside network_reward_consumption_energy, max reception energy: {max_reception_energy}")
318
326
  normalized_total_energy = total_energy / (max_transmission_energy + max_reception_energy)
327
+ print(f"Inside network_reward_consumption_energy, normalized total energy: {normalized_total_energy}")
319
328
 
320
329
  return np.clip(1 - normalized_total_energy, 0, 1)
321
330
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gym-examples
3
- Version: 2.0.70
3
+ Version: 2.0.72
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=rTuZiKxgQrl6_lA1u6-ac60xg1CRFlJOlEX6GKSvEfk,193
2
+ gym_examples/envs/__init__.py,sha256=lgMe4pyOuUTgTBUddM0iwMlETsYTwFShny6ifm8PGM8,53
3
+ gym_examples/envs/wsn_env.py,sha256=SorBJOVj9Jz4x-VosrChGaaesorWcd7K-qJvwhIZFAA,18553
4
+ gym_examples-2.0.72.dist-info/METADATA,sha256=6_b2HqQbQ_FccJaGcgcsDI2Z9LOFbPmuAdfXhRiBs3Q,411
5
+ gym_examples-2.0.72.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
6
+ gym_examples-2.0.72.dist-info/top_level.txt,sha256=rJRksoAF32M6lTLBEwYzRdo4PgtejceaNnnZ3HeY_Rk,13
7
+ gym_examples-2.0.72.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- gym_examples/__init__.py,sha256=6ay3I0_SdFHnmn_ZtXQ5k0r1G8Bq9XWuIkTK8N0plXM,193
2
- gym_examples/envs/__init__.py,sha256=lgMe4pyOuUTgTBUddM0iwMlETsYTwFShny6ifm8PGM8,53
3
- gym_examples/envs/wsn_env.py,sha256=9cSg_if18TCyN7V64knBYuUR4eE_vZvkXkx6eJgHq2w,17652
4
- gym_examples-2.0.70.dist-info/METADATA,sha256=p40rl2X2d3JPkvQ8sn3liJ95bfSYp_JC1DhjFUa-Zrk,411
5
- gym_examples-2.0.70.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
6
- gym_examples-2.0.70.dist-info/top_level.txt,sha256=rJRksoAF32M6lTLBEwYzRdo4PgtejceaNnnZ3HeY_Rk,13
7
- gym_examples-2.0.70.dist-info/RECORD,,