gym-examples 3.0.769__py3-none-any.whl → 3.0.771__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 -3
- {gym_examples-3.0.769.dist-info → gym_examples-3.0.771.dist-info}/METADATA +1 -1
- gym_examples-3.0.771.dist-info/RECORD +7 -0
- gym_examples-3.0.769.dist-info/RECORD +0 -7
- {gym_examples-3.0.769.dist-info → gym_examples-3.0.771.dist-info}/WHEEL +0 -0
- {gym_examples-3.0.769.dist-info → gym_examples-3.0.771.dist-info}/top_level.txt +0 -0
gym_examples/__init__.py
CHANGED
gym_examples/envs/wsn_env.py
CHANGED
@@ -150,7 +150,7 @@ class WSNRoutingEnv(gym.Env):
|
|
150
150
|
self.number_of_steps += 1
|
151
151
|
self.steps += 1
|
152
152
|
# rewards = [-max_reward] * self.n_sensors
|
153
|
-
reward_init = np.array([
|
153
|
+
reward_init = np.array([- max_reward] * input_dim)
|
154
154
|
rewards = [reward_init] * self.n_sensors
|
155
155
|
dones = [False] * self.n_sensors
|
156
156
|
for i, action in enumerate(actions):
|
@@ -219,6 +219,8 @@ class WSNRoutingEnv(gym.Env):
|
|
219
219
|
|
220
220
|
self.number_of_packets[i] = 0 # Reset the number of packets of the sensor i
|
221
221
|
|
222
|
+
# rewards[i] = self.compute_attention_rewards(rewards[i]) # Compute the attention-based reward
|
223
|
+
|
222
224
|
# Integrate the mobility of the sensors
|
223
225
|
# self.integrate_mobility()
|
224
226
|
|
@@ -231,6 +233,7 @@ class WSNRoutingEnv(gym.Env):
|
|
231
233
|
|
232
234
|
# rewards = [reward.item() if isinstance(reward, torch.Tensor) else reward for reward in rewards] # Convert the reward to a float
|
233
235
|
rewards = self.compute_attention_reward(rewards) # Compute the attention-based reward
|
236
|
+
# rewards = np.sum(rewards) # Sum the rewards of all the sensors
|
234
237
|
|
235
238
|
for i in range(self.n_sensors):
|
236
239
|
if not dones[i]:
|
@@ -472,8 +475,7 @@ class WSNRoutingEnv(gym.Env):
|
|
472
475
|
# Compute the attention-based rewards
|
473
476
|
# '''
|
474
477
|
# rewards_i = torch.tensor(reward, dtype=torch.double)
|
475
|
-
#
|
476
|
-
# return net(rewards_i).item()
|
478
|
+
# return net(rewards_i)
|
477
479
|
|
478
480
|
|
479
481
|
def compute_attention_reward(self, rewards):
|
@@ -0,0 +1,7 @@
|
|
1
|
+
gym_examples/__init__.py,sha256=RbdE0YwrLSAqeAvXUmj2eOfSVERmLe_xP34l5_GGTFc,166
|
2
|
+
gym_examples/envs/__init__.py,sha256=lgMe4pyOuUTgTBUddM0iwMlETsYTwFShny6ifm8PGM8,53
|
3
|
+
gym_examples/envs/wsn_env.py,sha256=CEI6uM78EVY5QEXjslxfaTXDP-wTSklrM9yghckQ-vk,26926
|
4
|
+
gym_examples-3.0.771.dist-info/METADATA,sha256=dzdtTI0gYHEF8BR04nWmRW-xtF235JsM9Q7GyIbxj7U,412
|
5
|
+
gym_examples-3.0.771.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
6
|
+
gym_examples-3.0.771.dist-info/top_level.txt,sha256=rJRksoAF32M6lTLBEwYzRdo4PgtejceaNnnZ3HeY_Rk,13
|
7
|
+
gym_examples-3.0.771.dist-info/RECORD,,
|
@@ -1,7 +0,0 @@
|
|
1
|
-
gym_examples/__init__.py,sha256=JrDpTNbLnzE4_62ux2BYcurQHhbfV4ZjpaK9TfNmgvM,166
|
2
|
-
gym_examples/envs/__init__.py,sha256=lgMe4pyOuUTgTBUddM0iwMlETsYTwFShny6ifm8PGM8,53
|
3
|
-
gym_examples/envs/wsn_env.py,sha256=O2DXjVkYubXn5aLNeCf2AwQ1FUZlwp8R2xYCR1MDqCk,26806
|
4
|
-
gym_examples-3.0.769.dist-info/METADATA,sha256=6oumqB5XQ0yhGHDK7G4E5yj2JeK0TxSqFqb3XUsUjHw,412
|
5
|
-
gym_examples-3.0.769.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
6
|
-
gym_examples-3.0.769.dist-info/top_level.txt,sha256=rJRksoAF32M6lTLBEwYzRdo4PgtejceaNnnZ3HeY_Rk,13
|
7
|
-
gym_examples-3.0.769.dist-info/RECORD,,
|
File without changes
|
File without changes
|