gym-examples 3.0.354__py3-none-any.whl → 3.0.356__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 +1 -1
- gym_examples/envs/wsn_env.py +8 -2
- {gym_examples-3.0.354.dist-info → gym_examples-3.0.356.dist-info}/METADATA +1 -1
- gym_examples-3.0.356.dist-info/RECORD +7 -0
- gym_examples-3.0.354.dist-info/RECORD +0 -7
- {gym_examples-3.0.354.dist-info → gym_examples-3.0.356.dist-info}/WHEEL +0 -0
- {gym_examples-3.0.354.dist-info → gym_examples-3.0.356.dist-info}/top_level.txt +0 -0
gym_examples/__init__.py
CHANGED
gym_examples/envs/wsn_env.py
CHANGED
@@ -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,7 @@ 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}, {network_throughput}, {energy_efficiency}, {packet_delivery_ratio}, {network_lifetime}, {average_latency}\n")
|
107
113
|
|
108
114
|
# print("Episode count: ", self.episode_count)
|
109
115
|
# print("Episode return: ", self.episode_return)
|
@@ -0,0 +1,7 @@
|
|
1
|
+
gym_examples/__init__.py,sha256=nG5XO2k9pP4DQdhdE05jdDB_4m57HxxQ0CluMxvaYcM,166
|
2
|
+
gym_examples/envs/__init__.py,sha256=lgMe4pyOuUTgTBUddM0iwMlETsYTwFShny6ifm8PGM8,53
|
3
|
+
gym_examples/envs/wsn_env.py,sha256=_YAVJN7aMo2h7Ip8YNO3R1zfpu-gtNcGUFZA-U-JZXs,25916
|
4
|
+
gym_examples-3.0.356.dist-info/METADATA,sha256=1glHY7wqMtCFngBszL1bjwml99EEJ17bkvtXrMUCYW4,412
|
5
|
+
gym_examples-3.0.356.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
6
|
+
gym_examples-3.0.356.dist-info/top_level.txt,sha256=rJRksoAF32M6lTLBEwYzRdo4PgtejceaNnnZ3HeY_Rk,13
|
7
|
+
gym_examples-3.0.356.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,,
|
File without changes
|
File without changes
|