gym-examples 3.0.381__py3-none-any.whl → 3.0.383__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.381"
8
+ __version__ = "3.0.383"
@@ -28,22 +28,6 @@ latency_per_hop = 1 # latency per hop in seconds
28
28
  base_back_up_dir = "results/data/"
29
29
  max_reward = 1 # maximum reward value when the sensors sent data to the base station. The opposite value is when the sensors perform an unauthorized action
30
30
 
31
- # Define the final reward function using an attention mechanism
32
- # class CustomizedLinear(nn.Module):
33
- # def __init__(self, input_dim, output_dim):
34
- # super(CustomizedLinear, self).__init__()
35
- # self.weight = nn.Parameter(torch.rand(output_dim, input_dim))
36
- # self.bias = None # No bias term
37
-
38
- # def forward(self, x):
39
- # # Normalize cols to ensure that if sum(x1) < sum(x2) ==> sum(Ax1 + 0) < sum(Ax2 + 0): proof in the paper
40
- # col_sums = self.weight.sum(dim=0, keepdim=True)
41
- # normalized_weight = self.weight / col_sums
42
-
43
- # # Output
44
- # y = torch.matmul(x, normalized_weight.t())
45
- # return y
46
-
47
31
  class Attention(nn.Module):
48
32
  def __init__(self, input_dim, output_dim):
49
33
  super(Attention, self).__init__() # Call the initializer of the parent class (nn.Module)
@@ -60,7 +44,7 @@ class Attention(nn.Module):
60
44
  if x.dim() == 1:
61
45
  x = x.unsqueeze(0) # Shape: [1, input_dim]
62
46
  # x = F.relu(self.linear1(x)) # Pass the input through a linear layer and a ReLU activation function
63
- x = F.Softplus(self.linear1(x)) # Pass the input through a linear layer and a ReLU activation function
47
+ x = F.softplus(self.linear1(x)) # Pass the input through a linear layer and a ReLU activation function
64
48
  attention_weights = F.softmax(x, dim=1) # Apply the softmax function to get the attention weights. Initially F.softmax(x, dim=0)
65
49
  x = attention_weights * x # Multiply the input by the attention weights
66
50
  x = self.linear2(x) # Pass the result through another linear layer
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gym-examples
3
- Version: 3.0.381
3
+ Version: 3.0.383
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=9JNxChP5-zu_f0CLKGmYoE_kTUGsC89a2m6XaaukIBI,166
2
+ gym_examples/envs/__init__.py,sha256=lgMe4pyOuUTgTBUddM0iwMlETsYTwFShny6ifm8PGM8,53
3
+ gym_examples/envs/wsn_env.py,sha256=gBivBdA4h4aG10PimVWmc43FMkfFZYP1Pup2NXFtOck,26284
4
+ gym_examples-3.0.383.dist-info/METADATA,sha256=7Qr7kqhoG5TVJe0UGIIb3k_oeLv7NWj4-qol22KJoyg,412
5
+ gym_examples-3.0.383.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
6
+ gym_examples-3.0.383.dist-info/top_level.txt,sha256=rJRksoAF32M6lTLBEwYzRdo4PgtejceaNnnZ3HeY_Rk,13
7
+ gym_examples-3.0.383.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- gym_examples/__init__.py,sha256=-xF9v1R8lVyLNVmg8tKb1ZoPyow-1QIZ84QtzXD78rU,166
2
- gym_examples/envs/__init__.py,sha256=lgMe4pyOuUTgTBUddM0iwMlETsYTwFShny6ifm8PGM8,53
3
- gym_examples/envs/wsn_env.py,sha256=kbGt7hOHZIGso4NIyd0cm8TSbFx0RazDsXN8lAD5c6U,26990
4
- gym_examples-3.0.381.dist-info/METADATA,sha256=snKPXRfg3uUbz2zqWT1c6-GBVPPh7VDOomY2laV1HRs,412
5
- gym_examples-3.0.381.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
6
- gym_examples-3.0.381.dist-info/top_level.txt,sha256=rJRksoAF32M6lTLBEwYzRdo4PgtejceaNnnZ3HeY_Rk,13
7
- gym_examples-3.0.381.dist-info/RECORD,,