gym-examples 3.0.262__py3-none-any.whl → 3.0.263__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.262"
8
+ __version__ = "3.0.263"
@@ -82,7 +82,8 @@ class WSNRoutingEnv(gym.Env):
82
82
 
83
83
  # self.action_space = Tuple(tuple([Discrete(self.n_sensors + 1)] * self.n_agents))
84
84
  # self.action_space = MultiDiscrete([self.n_sensors + 1] * self.n_agents)
85
- self.action_space = MultiDiscrete([self.n_agents, self.n_sensors + 1])
85
+ # self.action_space = MultiDiscrete([self.n_agents, self.n_sensors + 1])
86
+ self.action_space = Discrete(self.n_agents * (self.n_sensors + 1))
86
87
 
87
88
  self.reset()
88
89
 
@@ -137,7 +138,9 @@ class WSNRoutingEnv(gym.Env):
137
138
  done = False
138
139
  # 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
139
140
  # for i, action in enumerate(actions):
140
- for i, action in [actions]: # This loop is for the PPO algorithm: actions is a numpy array of shape (1, 2)
141
+ selected_sensor = actions // (self.n_sensors + 1)
142
+ target = actions % (self.n_sensors + 1)
143
+ for i, action in [np.array([selected_sensor, target])]: # This loop is for the PPO algorithm: actions is a numpy array of shape (1, 2)
141
144
  if self.remaining_energy[i] <= 0 or self.number_of_packets[i] <= 0:
142
145
  continue # Skip if sensor has no energy left or no packets to transmit
143
146
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gym-examples
3
- Version: 3.0.262
3
+ Version: 3.0.263
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=V-lDBqJirIbwK5vx8WNT5JyIwiwk22PGBiYSvm6JPo8,166
2
+ gym_examples/envs/__init__.py,sha256=lgMe4pyOuUTgTBUddM0iwMlETsYTwFShny6ifm8PGM8,53
3
+ gym_examples/envs/wsn_env.py,sha256=Ee3PTxhwKw2igwK5z465IdgK3mP0ParioXCni6BqXiE,26695
4
+ gym_examples-3.0.263.dist-info/METADATA,sha256=rpRe1k5FCesyS6hKApj_Z-_sQAjJ01WM90Mzk_a5XPs,412
5
+ gym_examples-3.0.263.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
6
+ gym_examples-3.0.263.dist-info/top_level.txt,sha256=rJRksoAF32M6lTLBEwYzRdo4PgtejceaNnnZ3HeY_Rk,13
7
+ gym_examples-3.0.263.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- gym_examples/__init__.py,sha256=CYfXHf7cNLnC7-qIfJQRpOs1xZSNHDP-MXO0DIQF2r0,166
2
- gym_examples/envs/__init__.py,sha256=lgMe4pyOuUTgTBUddM0iwMlETsYTwFShny6ifm8PGM8,53
3
- gym_examples/envs/wsn_env.py,sha256=i2aXordG52k5GhxIYQ1AVP2EiBzHtFMHUqwjAmdhWBQ,26481
4
- gym_examples-3.0.262.dist-info/METADATA,sha256=nUKnPlBtDhKZCsEpJqp8sdmStdg6ePbgbKlglo7RMck,412
5
- gym_examples-3.0.262.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
6
- gym_examples-3.0.262.dist-info/top_level.txt,sha256=rJRksoAF32M6lTLBEwYzRdo4PgtejceaNnnZ3HeY_Rk,13
7
- gym_examples-3.0.262.dist-info/RECORD,,