gym-examples 3.0.209__py3-none-any.whl → 3.0.211__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 +6 -4
- {gym_examples-3.0.209.dist-info → gym_examples-3.0.211.dist-info}/METADATA +1 -1
- gym_examples-3.0.211.dist-info/RECORD +7 -0
- gym_examples-3.0.209.dist-info/RECORD +0 -7
- {gym_examples-3.0.209.dist-info → gym_examples-3.0.211.dist-info}/WHEEL +0 -0
- {gym_examples-3.0.209.dist-info → gym_examples-3.0.211.dist-info}/top_level.txt +0 -0
gym_examples/__init__.py
CHANGED
gym_examples/envs/wsn_env.py
CHANGED
@@ -130,7 +130,7 @@ class WSNRoutingEnv(gym.Env):
|
|
130
130
|
def step(self, actions):
|
131
131
|
actions = [actions[i] for i in range(self.n_agents)] # We want to go back from the MultiDiscrete action space to a tuple of tuple of Discrete action spaces
|
132
132
|
self.steps += 1
|
133
|
-
rewards = [
|
133
|
+
rewards = [-100] * self.n_sensors
|
134
134
|
dones = [False] * self.n_sensors
|
135
135
|
for i, action in enumerate(actions):
|
136
136
|
if action not in range(self.n_sensors + 1):
|
@@ -163,8 +163,8 @@ class WSNRoutingEnv(gym.Env):
|
|
163
163
|
self.total_latency += self.packet_latency[i] + latency_per_hop
|
164
164
|
self.packet_latency[i] = 0
|
165
165
|
|
166
|
-
rewards[i] = self.compute_individual_rewards(i, action)
|
167
|
-
|
166
|
+
# rewards[i] = self.compute_individual_rewards(i, action)
|
167
|
+
rewards[i] = np.ones(input_dim) * 100 # Reward for transmitting data to the base station
|
168
168
|
dones[i] = True
|
169
169
|
else:
|
170
170
|
distance = np.linalg.norm(self.sensor_positions[i] - self.sensor_positions[action])
|
@@ -211,6 +211,7 @@ class WSNRoutingEnv(gym.Env):
|
|
211
211
|
rewards = [r.item() if isinstance(r, torch.Tensor) else r for r in rewards] # Convert the rewards to a list of floats
|
212
212
|
# rewards = np.sum(rewards) # Sum the rewards of all agents
|
213
213
|
rewards = np.mean(rewards) # Average the rewards of all agents
|
214
|
+
# rewards = np.mean(self.compute_network_rewards()) # Average the rewards of all agents
|
214
215
|
# print(f"Step: {self.steps}, Rewards: {rewards}, Done: {dones}")
|
215
216
|
dones = all(dones) # Done if all agents are done
|
216
217
|
|
@@ -396,7 +397,8 @@ class WSNRoutingEnv(gym.Env):
|
|
396
397
|
reward_packet_delivery_ratio = self.compute_reward_packet_delivery_ratio()
|
397
398
|
rewards_performance = np.array([reward_latency, reward_network_throughput, reward_packet_delivery_ratio])
|
398
399
|
|
399
|
-
return np.concatenate((rewards_energy, rewards_performance))
|
400
|
+
# return np.concatenate((rewards_energy, rewards_performance))
|
401
|
+
return rewards_energy
|
400
402
|
|
401
403
|
def network_reward_dispersion_remaining_energy(self):
|
402
404
|
'''
|
@@ -0,0 +1,7 @@
|
|
1
|
+
gym_examples/__init__.py,sha256=sHByS6d2-26uT2bg-8T_Fr7OAllomtmEs8lwcIUGJKs,194
|
2
|
+
gym_examples/envs/__init__.py,sha256=lgMe4pyOuUTgTBUddM0iwMlETsYTwFShny6ifm8PGM8,53
|
3
|
+
gym_examples/envs/wsn_env.py,sha256=FvQq-Y7S-yOKE1p0fU4bubGP0eWUiciMtsc4kUHmjoo,26057
|
4
|
+
gym_examples-3.0.211.dist-info/METADATA,sha256=FOUYKkcwfztVdHqK-bvY_oRf1BWzMy945Ih8fhnQ2kQ,412
|
5
|
+
gym_examples-3.0.211.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
6
|
+
gym_examples-3.0.211.dist-info/top_level.txt,sha256=rJRksoAF32M6lTLBEwYzRdo4PgtejceaNnnZ3HeY_Rk,13
|
7
|
+
gym_examples-3.0.211.dist-info/RECORD,,
|
@@ -1,7 +0,0 @@
|
|
1
|
-
gym_examples/__init__.py,sha256=W8b-NCyzEIs31EMwPSeDN61nvcQN2IFTagqv0stxTZE,194
|
2
|
-
gym_examples/envs/__init__.py,sha256=lgMe4pyOuUTgTBUddM0iwMlETsYTwFShny6ifm8PGM8,53
|
3
|
-
gym_examples/envs/wsn_env.py,sha256=PFcrAnbBjdhC11_qfnSyAcyXe2IlwdW37Ru0nNXwIYI,25918
|
4
|
-
gym_examples-3.0.209.dist-info/METADATA,sha256=OP2QbV15anG0gxnQEVqdbv01H0JX2d242hp6TsiprAE,412
|
5
|
-
gym_examples-3.0.209.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
6
|
-
gym_examples-3.0.209.dist-info/top_level.txt,sha256=rJRksoAF32M6lTLBEwYzRdo4PgtejceaNnnZ3HeY_Rk,13
|
7
|
-
gym_examples-3.0.209.dist-info/RECORD,,
|
File without changes
|
File without changes
|