gym-examples 3.0.115__py3-none-any.whl → 3.0.116__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
@@ -6,4 +6,4 @@ register(
6
6
  max_episode_steps=50,
7
7
  )
8
8
 
9
- __version__ = "3.0.115"
9
+ __version__ = "3.0.116"
@@ -64,7 +64,9 @@ class WSNRoutingEnv(gym.Env):
64
64
  )
65
65
  self.action_space = Tuple(tuple([Discrete(self.n_sensors + 1)] * self.n_agents))
66
66
 
67
- self.reset()
67
+ self.reset()
68
+
69
+ self.episode_count = 0
68
70
 
69
71
  def reset(self):
70
72
  self.sensor_positions = np.random.rand(self.n_sensors, 2) * (upper_bound - lower_bound) + lower_bound
@@ -168,6 +170,8 @@ class WSNRoutingEnv(gym.Env):
168
170
 
169
171
  self.get_metrics()
170
172
 
173
+ # rewards = self.compute_network_rewards()
174
+
171
175
  return self._get_obs(), rewards, dones, {}
172
176
 
173
177
  def _get_obs(self):
@@ -312,7 +316,20 @@ class WSNRoutingEnv(gym.Env):
312
316
 
313
317
  return np.concatenate((rewards_energy, rewards_performance))
314
318
  # return rewards_energy
315
-
319
+
320
+ def compute_network_rewards(self):
321
+
322
+ reward_consumption_energy = self.network_reward_consumption_energy()
323
+ reward_dispersion_remaining_energy = self.network_reward_dispersion_remaining_energy()
324
+ rewards_energy = np.array([reward_consumption_energy, reward_dispersion_remaining_energy])
325
+
326
+ reward_latency = self.compute_reward_latency()
327
+ reward_network_throughput = self.compute_reward_network_throughput()
328
+ reward_packet_delivery_ratio = self.compute_reward_packet_delivery_ratio()
329
+ rewards_performance = np.array([reward_latency, reward_network_throughput, reward_packet_delivery_ratio])
330
+
331
+ return np.concatenate((rewards_energy, rewards_performance))
332
+
316
333
  def network_reward_dispersion_remaining_energy(self):
317
334
  '''
318
335
  Compute the reward based on the standard deviation of the remaining energy at the network level
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gym-examples
3
- Version: 3.0.115
3
+ Version: 3.0.116
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=09z5Ln2_klc9N1PzBH7KMq9f_84BOOXU6jsoFyKP5V8,194
2
+ gym_examples/envs/__init__.py,sha256=lgMe4pyOuUTgTBUddM0iwMlETsYTwFShny6ifm8PGM8,53
3
+ gym_examples/envs/wsn_env.py,sha256=tCuaa3kAtzXd-EhWkRzGbfxw6A_v3jZ0U9OUBk9bcJ8,21567
4
+ gym_examples-3.0.116.dist-info/METADATA,sha256=aLxV_ifcG2NU1Pvt9PodOJz7ozlMEx7uhPagASu683k,412
5
+ gym_examples-3.0.116.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
6
+ gym_examples-3.0.116.dist-info/top_level.txt,sha256=rJRksoAF32M6lTLBEwYzRdo4PgtejceaNnnZ3HeY_Rk,13
7
+ gym_examples-3.0.116.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- gym_examples/__init__.py,sha256=4tutbZYDTaS04kfY-9VcMSXg5aYZvn5jWVUwXk7vzR8,194
2
- gym_examples/envs/__init__.py,sha256=lgMe4pyOuUTgTBUddM0iwMlETsYTwFShny6ifm8PGM8,53
3
- gym_examples/envs/wsn_env.py,sha256=XSRDyoJXewSwDBtHJJHGYarmWDbgX4qlG5HMVTeASTI,20762
4
- gym_examples-3.0.115.dist-info/METADATA,sha256=N8sjWFwvyZ1IYM0Axh4HcwIzJkhzJxsLY4s7-x7z2lY,412
5
- gym_examples-3.0.115.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
6
- gym_examples-3.0.115.dist-info/top_level.txt,sha256=rJRksoAF32M6lTLBEwYzRdo4PgtejceaNnnZ3HeY_Rk,13
7
- gym_examples-3.0.115.dist-info/RECORD,,