gym-examples 3.0.767__py3-none-any.whl → 3.0.768__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 CHANGED
@@ -5,4 +5,4 @@ register(
5
5
  entry_point="gym_examples.envs:WSNRoutingEnv",
6
6
  )
7
7
 
8
- __version__ = "3.0.767"
8
+ __version__ = "3.0.768"
@@ -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([0] * input_dim)
153
+ reward_init = [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):
@@ -159,7 +159,7 @@ class WSNRoutingEnv(gym.Env):
159
159
 
160
160
  if (action == i):
161
161
  continue # Skip if sensor tries to transmit data to itself
162
-
162
+
163
163
  if action == self.n_sensors:
164
164
  if self.distance_to_base[i] > self.coverage_radius:
165
165
  continue # Skip if the distance to the base station is greater than the coverage radius
@@ -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 if isinstance(reward, np.ndarray)]
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) if isinstance(reward, np.ndarray)])
506
506
 
507
507
  return np.sum(final_reward)
508
508
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gym-examples
3
- Version: 3.0.767
3
+ Version: 3.0.768
4
4
  Summary: A custom environment for multi-agent reinforcement learning focused on WSN routing.
5
5
  Home-page: https://github.com/gedji/CODES.git
6
6
  Author: Georges Djimefo
@@ -0,0 +1,7 @@
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,,
@@ -1,7 +0,0 @@
1
- gym_examples/__init__.py,sha256=lI2A534ndKHi9RQYvkCYTX1c8O0mQr5rLLLQuRzu5Qw,166
2
- gym_examples/envs/__init__.py,sha256=lgMe4pyOuUTgTBUddM0iwMlETsYTwFShny6ifm8PGM8,53
3
- gym_examples/envs/wsn_env.py,sha256=QX9nNxbq87fRr0Dtfwe3aPtTmtiCJtNHixJLfycR1mo,26794
4
- gym_examples-3.0.767.dist-info/METADATA,sha256=KSj6oEzWvhbdwcJxk6M1V_OxbwExmam4LyXCHUbrWZ8,412
5
- gym_examples-3.0.767.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
6
- gym_examples-3.0.767.dist-info/top_level.txt,sha256=rJRksoAF32M6lTLBEwYzRdo4PgtejceaNnnZ3HeY_Rk,13
7
- gym_examples-3.0.767.dist-info/RECORD,,