gym-examples 2.0.61__py3-none-any.whl → 2.0.62__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 +4 -13
- {gym_examples-2.0.61.dist-info → gym_examples-2.0.62.dist-info}/METADATA +1 -1
- gym_examples-2.0.62.dist-info/RECORD +7 -0
- gym_examples-2.0.61.dist-info/RECORD +0 -7
- {gym_examples-2.0.61.dist-info → gym_examples-2.0.62.dist-info}/WHEEL +0 -0
- {gym_examples-2.0.61.dist-info → gym_examples-2.0.62.dist-info}/top_level.txt +0 -0
gym_examples/__init__.py
CHANGED
gym_examples/envs/wsn_env.py
CHANGED
@@ -66,22 +66,13 @@ class WSNRoutingEnv(gym.Env):
|
|
66
66
|
self.action_space = Tuple(tuple([Discrete(self.n_sensors + 1)] * self.n_agents))
|
67
67
|
|
68
68
|
self.reset()
|
69
|
-
|
70
|
-
print("\n=================================================")
|
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}")
|
77
|
-
print("==================================================\n")
|
78
69
|
|
79
70
|
|
80
71
|
def reset(self):
|
81
72
|
# print individual rewards
|
82
|
-
|
83
|
-
|
84
|
-
|
73
|
+
print("\n=================================================")
|
74
|
+
print(f"Rewards: {self.rewards_individual}")
|
75
|
+
print("==================================================\n")
|
85
76
|
# Initialize the position of the sensors randomly
|
86
77
|
self.sensor_positions = np.random.rand(self.n_sensors, 2) * (upper_bound - lower_bound) + lower_bound
|
87
78
|
self.distance_to_base = np.linalg.norm(self.sensor_positions - base_station_position, axis=1)
|
@@ -136,7 +127,7 @@ class WSNRoutingEnv(gym.Env):
|
|
136
127
|
|
137
128
|
# 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]
|
138
129
|
rewards = [0.5 * r + 0.5 * (self.network_reward_consumption_energy() + self.network_reward_dispersion_remaining_energy()) for r in rewards]
|
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
|
+
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) and (self.network_reward_consumption_energy() != 0))]
|
140
131
|
for i in range(self.n_sensors):
|
141
132
|
if (self.remaining_energy[i] <= 0) or (self.number_of_packets[i] <= 0):
|
142
133
|
dones[i] = True
|
@@ -0,0 +1,7 @@
|
|
1
|
+
gym_examples/__init__.py,sha256=UdsOi_uvrx2c0p-hT7p4HgGT7LersLo1EN8BSlPLFYI,193
|
2
|
+
gym_examples/envs/__init__.py,sha256=lgMe4pyOuUTgTBUddM0iwMlETsYTwFShny6ifm8PGM8,53
|
3
|
+
gym_examples/envs/wsn_env.py,sha256=_Ep8jV3UwkXUAF2jcBlJtgjodw2FQmpH1KLGpIcncLY,15949
|
4
|
+
gym_examples-2.0.62.dist-info/METADATA,sha256=d7MCqv53jpHnXR18oCGf4yFag3V_qa7sdosuZwPjWCE,411
|
5
|
+
gym_examples-2.0.62.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
6
|
+
gym_examples-2.0.62.dist-info/top_level.txt,sha256=rJRksoAF32M6lTLBEwYzRdo4PgtejceaNnnZ3HeY_Rk,13
|
7
|
+
gym_examples-2.0.62.dist-info/RECORD,,
|
@@ -1,7 +0,0 @@
|
|
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,,
|
File without changes
|
File without changes
|