gym-examples 2.0.59__py3-none-any.whl → 2.0.61__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 +14 -4
- {gym_examples-2.0.59.dist-info → gym_examples-2.0.61.dist-info}/METADATA +1 -1
- gym_examples-2.0.61.dist-info/RECORD +7 -0
- gym_examples-2.0.59.dist-info/RECORD +0 -7
- {gym_examples-2.0.59.dist-info → gym_examples-2.0.61.dist-info}/WHEEL +0 -0
- {gym_examples-2.0.59.dist-info → gym_examples-2.0.61.dist-info}/top_level.txt +0 -0
gym_examples/__init__.py
CHANGED
gym_examples/envs/wsn_env.py
CHANGED
@@ -67,11 +67,21 @@ class WSNRoutingEnv(gym.Env):
|
|
67
67
|
|
68
68
|
self.reset()
|
69
69
|
|
70
|
-
def reset(self):
|
71
|
-
# print individual rewards
|
72
70
|
print("\n=================================================")
|
73
|
-
print(
|
71
|
+
print("WSN Routing Environment initialized")
|
72
|
+
print(f"consumption_energy: {self.consumption_energy}")
|
73
|
+
print(f"remaining_energy: {self.remaining_energy}")
|
74
|
+
print(f"sensor_positions: {self.sensor_positions}")
|
75
|
+
print(f"distance_to_base: {self.distance_to_base}")
|
76
|
+
print(f"number_of_packets: {self.number_of_packets}")
|
74
77
|
print("==================================================\n")
|
78
|
+
|
79
|
+
|
80
|
+
def reset(self):
|
81
|
+
# print individual rewards
|
82
|
+
# print("\n=================================================")
|
83
|
+
# print(f"Rewards: {self.rewards_individual}")
|
84
|
+
# print("==================================================\n")
|
75
85
|
# Initialize the position of the sensors randomly
|
76
86
|
self.sensor_positions = np.random.rand(self.n_sensors, 2) * (upper_bound - lower_bound) + lower_bound
|
77
87
|
self.distance_to_base = np.linalg.norm(self.sensor_positions - base_station_position, axis=1)
|
@@ -126,7 +136,7 @@ class WSNRoutingEnv(gym.Env):
|
|
126
136
|
|
127
137
|
# rewards = [0.5 * r + 0.5 * (1/self.n_sensors) * (self.network_reward_consumption_energy() + self.network_reward_dispersion_remaining_energy()) for r in rewards]
|
128
138
|
rewards = [0.5 * r + 0.5 * (self.network_reward_consumption_energy() + self.network_reward_dispersion_remaining_energy()) for r in rewards]
|
129
|
-
self.rewards_individual = [{"ind": r, "net_consumption_energy": self.network_reward_consumption_energy(), "net_dispersion_energy": self.network_reward_dispersion_remaining_energy()} for r in self.rewards_individual]
|
139
|
+
self.rewards_individual = [{"ind": r, "net_consumption_energy": self.network_reward_consumption_energy(), "net_dispersion_energy": self.network_reward_dispersion_remaining_energy()} for r in self.rewards_individual if r != 0]
|
130
140
|
for i in range(self.n_sensors):
|
131
141
|
if (self.remaining_energy[i] <= 0) or (self.number_of_packets[i] <= 0):
|
132
142
|
dones[i] = True
|
@@ -0,0 +1,7 @@
|
|
1
|
+
gym_examples/__init__.py,sha256=9euimFjmf1gAXbpVoCgKqFAWktP5CZF6UP3QMekzK94,193
|
2
|
+
gym_examples/envs/__init__.py,sha256=lgMe4pyOuUTgTBUddM0iwMlETsYTwFShny6ifm8PGM8,53
|
3
|
+
gym_examples/envs/wsn_env.py,sha256=QLjn-dt6RSXPPukeICx5rDZoMePaPvRYP8xGIg4jOvc,16407
|
4
|
+
gym_examples-2.0.61.dist-info/METADATA,sha256=7koAmC51NdPOd0jwdT1xAzWe8oijwbq5viDSa7ebFGU,411
|
5
|
+
gym_examples-2.0.61.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
6
|
+
gym_examples-2.0.61.dist-info/top_level.txt,sha256=rJRksoAF32M6lTLBEwYzRdo4PgtejceaNnnZ3HeY_Rk,13
|
7
|
+
gym_examples-2.0.61.dist-info/RECORD,,
|
@@ -1,7 +0,0 @@
|
|
1
|
-
gym_examples/__init__.py,sha256=8Z_ivueILF9vTjF7kQLbPrrIA5-s94fUy-HF4axGjLg,193
|
2
|
-
gym_examples/envs/__init__.py,sha256=lgMe4pyOuUTgTBUddM0iwMlETsYTwFShny6ifm8PGM8,53
|
3
|
-
gym_examples/envs/wsn_env.py,sha256=lPU-0-lR4FbeSkV3UoGzb59RhUhJ8tbsqaeSmlh3Wm0,15873
|
4
|
-
gym_examples-2.0.59.dist-info/METADATA,sha256=54757bIPkFSiCUj4XW7gSUSGZnEaYnLwjqmpm5cYuGc,411
|
5
|
-
gym_examples-2.0.59.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
6
|
-
gym_examples-2.0.59.dist-info/top_level.txt,sha256=rJRksoAF32M6lTLBEwYzRdo4PgtejceaNnnZ3HeY_Rk,13
|
7
|
-
gym_examples-2.0.59.dist-info/RECORD,,
|
File without changes
|
File without changes
|