gym-examples 3.0.354__py3-none-any.whl → 3.0.355__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.354"
8
+ __version__ = "3.0.355"
@@ -60,7 +60,7 @@ class WSNRoutingEnv(gym.Env):
60
60
  # Create filenames to save statistics for evaluation
61
61
  self.statistics_filename = "results/data/Statistics_filename_" + os.getenv('ALGO_NAME') + ".txt"
62
62
  with open(self.statistics_filename, 'w') as file:
63
- file.write("Episode return, Total of energy consumption, Std of remaining energy, Mean of remaining energy, Network lifetime\n")
63
+ file.write("Episode return, Total of energy consumption, Std of remaining energy, Mean of remaining energy, Network lifetime, network_throughput, energy_efficiency, packet_delivery_ratio, network_lifetime, average_latency\n")
64
64
  # Initialize list of episode metrics
65
65
  self.num_timesteps = num_timesteps # This argument is for the PPO algorithm
66
66
  self.version = version # This argument is for the PPO algorithm
@@ -95,6 +95,12 @@ class WSNRoutingEnv(gym.Env):
95
95
  if self.number_of_steps > 30000: # Change 30000 to a parameter taken from args or kwargs
96
96
  self.episode_returns.append(self.episode_return)
97
97
  observations = self._get_obs()
98
+ metrics = self.get_metrics()
99
+ network_throughput = metrics["network_throughput"]
100
+ energy_efficiency = metrics["energy_efficiency"]
101
+ packet_delivery_ratio = metrics["packet_delivery_ratio"]
102
+ network_lifetime = metrics["network_lifetime"]
103
+ average_latency = metrics["average_latency"]
98
104
  remaining_energy_values = np.array([sensor['remaining_energy'] for sensor in observations])
99
105
  std_remaining_energy = np.std(remaining_energy_values)
100
106
  mean_remaining_energy = np.mean(remaining_energy_values)
@@ -103,7 +109,8 @@ class WSNRoutingEnv(gym.Env):
103
109
 
104
110
  # Append the statistics to the .txt file
105
111
  with open(self.statistics_filename, 'a') as file:
106
- file.write(f"{self.episode_return}, {total_consumption_energy}, {std_remaining_energy}, {mean_remaining_energy}, {self.network_lifetime}\n")
112
+ file.write(f"{self.episode_return}, {total_consumption_energy}, {std_remaining_energy}, {mean_remaining_energy}, {self.network_lifetime},
113
+ {network_throughput}, {energy_efficiency}, {packet_delivery_ratio}, {network_lifetime}, {average_latency}\n")
107
114
 
108
115
  # print("Episode count: ", self.episode_count)
109
116
  # print("Episode return: ", self.episode_return)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gym-examples
3
- Version: 3.0.354
3
+ Version: 3.0.355
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=lYLIhK75Cbobycsj0iM1GJQx4oTfWqlMb_hA_O3GlKU,166
2
+ gym_examples/envs/__init__.py,sha256=lgMe4pyOuUTgTBUddM0iwMlETsYTwFShny6ifm8PGM8,53
3
+ gym_examples/envs/wsn_env.py,sha256=Zujo-Ei4zNuz-8zf0TIPS2vHGDdxXXlWTZanb34ttIo,25945
4
+ gym_examples-3.0.355.dist-info/METADATA,sha256=QQH20cVu7Hs_61WM64tki2qJ68iUQtX8A6vnm4z1wNU,412
5
+ gym_examples-3.0.355.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
6
+ gym_examples-3.0.355.dist-info/top_level.txt,sha256=rJRksoAF32M6lTLBEwYzRdo4PgtejceaNnnZ3HeY_Rk,13
7
+ gym_examples-3.0.355.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- gym_examples/__init__.py,sha256=HVlncGWSmQlSYKkKcDellZ2Eqs0VkaLm62-6zuttvus,166
2
- gym_examples/envs/__init__.py,sha256=lgMe4pyOuUTgTBUddM0iwMlETsYTwFShny6ifm8PGM8,53
3
- gym_examples/envs/wsn_env.py,sha256=Dv9LjdTJHfZ3c4NSIFNq9DePV4hFOkJ7IM9eCAkCpBE,25356
4
- gym_examples-3.0.354.dist-info/METADATA,sha256=a3JJX0Ly-Tj9MCFe6xgWRLKqLSCeuDkUG-9jqoDtkso,412
5
- gym_examples-3.0.354.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
6
- gym_examples-3.0.354.dist-info/top_level.txt,sha256=rJRksoAF32M6lTLBEwYzRdo4PgtejceaNnnZ3HeY_Rk,13
7
- gym_examples-3.0.354.dist-info/RECORD,,