gym-examples 3.0.662__py3-none-any.whl → 3.0.663__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 +19 -1
- {gym_examples-3.0.662.dist-info → gym_examples-3.0.663.dist-info}/METADATA +1 -1
- gym_examples-3.0.663.dist-info/RECORD +7 -0
- gym_examples-3.0.662.dist-info/RECORD +0 -7
- {gym_examples-3.0.662.dist-info → gym_examples-3.0.663.dist-info}/WHEEL +0 -0
- {gym_examples-3.0.662.dist-info → gym_examples-3.0.663.dist-info}/top_level.txt +0 -0
gym_examples/__init__.py
CHANGED
gym_examples/envs/wsn_env.py
CHANGED
@@ -58,8 +58,9 @@ class WSNRoutingEnv(gym.Env):
|
|
58
58
|
|
59
59
|
ALGO_NAME = "" # Global flag to control the algorithm name
|
60
60
|
gym_examples_current_version = "" # Global flag to control the gym_examples version
|
61
|
+
coefficients = [] # Global flag for the weights of all the agents
|
61
62
|
|
62
|
-
def __init__(self, n_sensors =
|
63
|
+
def __init__(self, n_sensors = 30, coverage_radius=(upper_bound - lower_bound) * 3/20, num_timesteps = None, version = None):
|
63
64
|
|
64
65
|
super(WSNRoutingEnv, self).__init__()
|
65
66
|
# Create filenames to save statistics for evaluation
|
@@ -97,6 +98,8 @@ class WSNRoutingEnv(gym.Env):
|
|
97
98
|
self.reset()
|
98
99
|
|
99
100
|
def reset(self):
|
101
|
+
print("\n============================================")
|
102
|
+
print(f"Episode count: {self.episode_count}")
|
100
103
|
if self.number_of_steps > 30000: # Change 30000 to a parameter taken from args or kwargs
|
101
104
|
self.episode_returns.append(self.episode_return)
|
102
105
|
observations = self._get_obs()
|
@@ -231,6 +234,7 @@ class WSNRoutingEnv(gym.Env):
|
|
231
234
|
dones = bool(np.all(dones))
|
232
235
|
|
233
236
|
self.episode_return += rewards
|
237
|
+
|
234
238
|
return self._get_obs(), rewards, dones, self.get_metrics()
|
235
239
|
|
236
240
|
|
@@ -258,6 +262,20 @@ class WSNRoutingEnv(gym.Env):
|
|
258
262
|
def get_avail_actions(self):
|
259
263
|
return [list(range(self.n_sensors + 1)) for _ in range(self.n_sensors)]
|
260
264
|
|
265
|
+
def build_weigths_agents(self, coefficients):
|
266
|
+
'''
|
267
|
+
We would like to compute the similarity score between the agents and the base station:
|
268
|
+
For this, we consider that each agent is represented by a vector constituted of:
|
269
|
+
- number of packets after the action
|
270
|
+
- remaining energy after the action
|
271
|
+
- distance to the base station
|
272
|
+
The vector of the base station is constituted of:
|
273
|
+
- number of packets after the action: all the times, we consider is equal to 0
|
274
|
+
- remaining energy after the action: all the times, we consider is equal to initial_energy
|
275
|
+
- distance to the base station: all the times, we consider is equal to 0
|
276
|
+
'''
|
277
|
+
vector_referee = [0, 0, 1] # Vector of the base station
|
278
|
+
|
261
279
|
|
262
280
|
def update_sensor_energies(self, i, delta_energy):
|
263
281
|
self.remaining_energy[i] -= delta_energy
|
@@ -0,0 +1,7 @@
|
|
1
|
+
gym_examples/__init__.py,sha256=uPwhsf-8LLMxDV6sxHKfEK3vw-vms1Jo7yVE1OvWPKA,166
|
2
|
+
gym_examples/envs/__init__.py,sha256=lgMe4pyOuUTgTBUddM0iwMlETsYTwFShny6ifm8PGM8,53
|
3
|
+
gym_examples/envs/wsn_env.py,sha256=8vWmqV5HPz33QKeujNtDQRtXJWJv7ZmMuFfkLMegQVw,26264
|
4
|
+
gym_examples-3.0.663.dist-info/METADATA,sha256=9P071D0P-p4a5GkTGC4_GDfNgbtmWNZGu46X3l2VNx8,412
|
5
|
+
gym_examples-3.0.663.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
6
|
+
gym_examples-3.0.663.dist-info/top_level.txt,sha256=rJRksoAF32M6lTLBEwYzRdo4PgtejceaNnnZ3HeY_Rk,13
|
7
|
+
gym_examples-3.0.663.dist-info/RECORD,,
|
@@ -1,7 +0,0 @@
|
|
1
|
-
gym_examples/__init__.py,sha256=C4ZusYlaub4xCgqI-7ThaSoyGMMSTO1oJxBIyMCyTMw,166
|
2
|
-
gym_examples/envs/__init__.py,sha256=lgMe4pyOuUTgTBUddM0iwMlETsYTwFShny6ifm8PGM8,53
|
3
|
-
gym_examples/envs/wsn_env.py,sha256=CELBjrF9LYLOItWv7jr8CoUyH8nWRvrFwxzfVl96Tbs,25280
|
4
|
-
gym_examples-3.0.662.dist-info/METADATA,sha256=VRNcl8g9c_I3hj0-i3QbjSCUQYtmYDzH8m02HrrFxqA,412
|
5
|
-
gym_examples-3.0.662.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
6
|
-
gym_examples-3.0.662.dist-info/top_level.txt,sha256=rJRksoAF32M6lTLBEwYzRdo4PgtejceaNnnZ3HeY_Rk,13
|
7
|
-
gym_examples-3.0.662.dist-info/RECORD,,
|
File without changes
|
File without changes
|