gym-examples 3.0.768__py3-none-any.whl → 3.0.769__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 +3 -3
- {gym_examples-3.0.768.dist-info → gym_examples-3.0.769.dist-info}/METADATA +1 -1
- gym_examples-3.0.769.dist-info/RECORD +7 -0
- gym_examples-3.0.768.dist-info/RECORD +0 -7
- {gym_examples-3.0.768.dist-info → gym_examples-3.0.769.dist-info}/WHEEL +0 -0
- {gym_examples-3.0.768.dist-info → gym_examples-3.0.769.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 = [0] * input_dim
|
153
|
+
reward_init = np.array([0] * 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):
|
@@ -492,7 +492,7 @@ class WSNRoutingEnv(gym.Env):
|
|
492
492
|
query_vector = np.array([max_reward] * d) # Basically, the target is the base station
|
493
493
|
|
494
494
|
# Similarities between the query vector and the rewards
|
495
|
-
similarities = [np.dot(query_vector, reward) for reward in rewards
|
495
|
+
similarities = [np.dot(query_vector, reward) for reward in rewards]
|
496
496
|
|
497
497
|
# Similarities scaling
|
498
498
|
similarities = [similarity / np.sqrt(d) for similarity in similarities]
|
@@ -502,7 +502,7 @@ class WSNRoutingEnv(gym.Env):
|
|
502
502
|
attention_weights = [np.exp(similarity) / denominator for similarity in similarities]
|
503
503
|
|
504
504
|
# Weighted sum of the rewards
|
505
|
-
final_reward = sum([attention_weight * reward for attention_weight, reward in zip(attention_weights, rewards)
|
505
|
+
final_reward = sum([attention_weight * reward for attention_weight, reward in zip(attention_weights, rewards)])
|
506
506
|
|
507
507
|
return np.sum(final_reward)
|
508
508
|
|
@@ -0,0 +1,7 @@
|
|
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,,
|
@@ -1,7 +0,0 @@
|
|
1
|
-
gym_examples/__init__.py,sha256=ErBo6hRVSUgQvxu0zaJqLRmZM9LTYXQ_1HIgV4bg01o,166
|
2
|
-
gym_examples/envs/__init__.py,sha256=lgMe4pyOuUTgTBUddM0iwMlETsYTwFShny6ifm8PGM8,53
|
3
|
-
gym_examples/envs/wsn_env.py,sha256=baJSRHpxNnasenWc-lGGjeHvXkJQaSLSpr_pSP9SrmQ,26864
|
4
|
-
gym_examples-3.0.768.dist-info/METADATA,sha256=U9TYdpAF3BmSEktZwNYaDSjCV3bjKezIUbAMsQBgfGs,412
|
5
|
-
gym_examples-3.0.768.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
6
|
-
gym_examples-3.0.768.dist-info/top_level.txt,sha256=rJRksoAF32M6lTLBEwYzRdo4PgtejceaNnnZ3HeY_Rk,13
|
7
|
-
gym_examples-3.0.768.dist-info/RECORD,,
|
File without changes
|
File without changes
|