gym-examples 3.0.210__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 +5 -5
- {gym_examples-3.0.210.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.210.dist-info/RECORD +0 -7
- {gym_examples-3.0.210.dist-info → gym_examples-3.0.211.dist-info}/WHEEL +0 -0
- {gym_examples-3.0.210.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])
|
@@ -210,8 +210,8 @@ class WSNRoutingEnv(gym.Env):
|
|
210
210
|
|
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
|
-
|
214
|
-
rewards = np.mean(self.compute_network_rewards()) # Average the rewards of all agents
|
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
|
215
215
|
# print(f"Step: {self.steps}, Rewards: {rewards}, Done: {dones}")
|
216
216
|
dones = all(dones) # Done if all agents are done
|
217
217
|
|
@@ -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=Nn1UcrZxRInKFf4JCxinIa8PEWS4P7wgPq_OK8roe5o,194
|
2
|
-
gym_examples/envs/__init__.py,sha256=lgMe4pyOuUTgTBUddM0iwMlETsYTwFShny6ifm8PGM8,53
|
3
|
-
gym_examples/envs/wsn_env.py,sha256=wP8oHngOs0pnHplq8Yv8YYJfeA48rQMB3A_EMXVmU2Q,26049
|
4
|
-
gym_examples-3.0.210.dist-info/METADATA,sha256=Chn-C1wtSJ58hCwLG6ZAOZbWZEWzXt4WK4AKGKDi2TE,412
|
5
|
-
gym_examples-3.0.210.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
6
|
-
gym_examples-3.0.210.dist-info/top_level.txt,sha256=rJRksoAF32M6lTLBEwYzRdo4PgtejceaNnnZ3HeY_Rk,13
|
7
|
-
gym_examples-3.0.210.dist-info/RECORD,,
|
File without changes
|
File without changes
|