Signal8 3.6__tar.gz → 3.8__tar.gz
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.
Potentially problematic release.
This version of Signal8 might be problematic. Click here for more details.
- {Signal8-3.6 → Signal8-3.8}/PKG-INFO +1 -1
- {Signal8-3.6 → Signal8-3.8}/Signal8/Signal8.py +5 -16
- {Signal8-3.6 → Signal8-3.8}/Signal8/utils/core.py +2 -5
- {Signal8-3.6 → Signal8-3.8}/Signal8/utils/simple_env.py +10 -24
- {Signal8-3.6 → Signal8-3.8}/Signal8.egg-info/PKG-INFO +1 -1
- {Signal8-3.6 → Signal8-3.8}/Signal8.egg-info/SOURCES.txt +1 -0
- {Signal8-3.6 → Signal8-3.8}/setup.py +1 -1
- {Signal8-3.6 → Signal8-3.8}/LICENSE +0 -0
- {Signal8-3.6 → Signal8-3.8}/README.md +0 -0
- {Signal8-3.6 → Signal8-3.8}/Signal8/__init__.py +0 -0
- {Signal8-3.6 → Signal8-3.8}/Signal8/main.py +0 -0
- {Signal8-3.6 → Signal8-3.8}/Signal8/utils/__init__.py +0 -0
- {Signal8-3.6 → Signal8-3.8}/Signal8/utils/problems.py +0 -0
- {Signal8-3.6 → Signal8-3.8}/Signal8/utils/scenario.py +0 -0
- {Signal8-3.6 → Signal8-3.8}/Signal8/utils/test_dynamic_obs.py +0 -0
- {Signal8-3.6 → Signal8-3.8}/Signal8.egg-info/dependency_links.txt +0 -0
- {Signal8-3.6 → Signal8-3.8}/Signal8.egg-info/top_level.txt +0 -0
- {Signal8-3.6 → Signal8-3.8}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: Signal8
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.8
|
|
4
4
|
Summary: A multi-agent environment inspired by the Lewis Signaling Game, featuring eight unique problem configurations with both static and dynamic obstacles.
|
|
5
5
|
Home-page: https://github.com/ethanmclark1/signal8
|
|
6
6
|
Author: Ethan Clark
|
|
@@ -50,18 +50,10 @@ class Scenario(BaseScenario):
|
|
|
50
50
|
agent.color = np.array([1, 0.95, 0.8])
|
|
51
51
|
world.agents.append(agent)
|
|
52
52
|
|
|
53
|
-
# Agents has two goals (i.e., actual goal and start position)
|
|
54
|
-
# This is to ensure agent returns safely to start position after reaching goal
|
|
55
|
-
for i in range(num_agents*2):
|
|
56
53
|
goal = Goal()
|
|
57
54
|
goal.name = f"goal_{i}"
|
|
58
55
|
goal.collide = False
|
|
59
|
-
|
|
60
|
-
if i < num_agents:
|
|
61
|
-
goal.color = np.array([0.835, 0.90, 0.831])
|
|
62
|
-
# goal_b is the start position to return to after reaching goal
|
|
63
|
-
else:
|
|
64
|
-
goal.color = np.array([0.85, 0.90, 0.99])
|
|
56
|
+
goal.color = np.array([0.835, 0.90, 0.831])
|
|
65
57
|
world.goals.append(goal)
|
|
66
58
|
|
|
67
59
|
# Large obstacles can only be observed by aerial agent
|
|
@@ -118,12 +110,10 @@ class Scenario(BaseScenario):
|
|
|
118
110
|
y_constraints = [constr[1] for constr in world.instance_constr]
|
|
119
111
|
|
|
120
112
|
for i, agent in enumerate(world.agents):
|
|
121
|
-
agent.
|
|
122
|
-
agent.goal_b = world.goals[len(world.goals) - 1 - i]
|
|
113
|
+
agent.goal = world.goals[i]
|
|
123
114
|
|
|
124
115
|
agent.state.p_vel = np.zeros(world.dim_p)
|
|
125
|
-
agent.
|
|
126
|
-
agent.goal_b.state.p_vel = np.zeros(world.dim_p)
|
|
116
|
+
agent.goal.state.p_vel = np.zeros(world.dim_p)
|
|
127
117
|
|
|
128
118
|
if world.problem_instance == 'corners':
|
|
129
119
|
condition = partial(
|
|
@@ -140,8 +130,7 @@ class Scenario(BaseScenario):
|
|
|
140
130
|
)
|
|
141
131
|
|
|
142
132
|
agent.state.p_pos = self._generate_position(np_random, condition)
|
|
143
|
-
agent.
|
|
144
|
-
agent.goal_b.state.p_pos = copy.copy(agent.state.p_pos)
|
|
133
|
+
agent.goal.state.p_pos = self._generate_position(np_random, condition)
|
|
145
134
|
|
|
146
135
|
# Reset all large obstacles to a position that does not intersect with the agents
|
|
147
136
|
def _reset_large_obstacles(self, world, np_random, paths):
|
|
@@ -236,7 +225,7 @@ class Scenario(BaseScenario):
|
|
|
236
225
|
if dist <= max_observable_dist:
|
|
237
226
|
observed_obstacles[i] = relative_pos
|
|
238
227
|
|
|
239
|
-
goal_pos = agent.
|
|
228
|
+
goal_pos = agent.goal.state.p_pos
|
|
240
229
|
relative_goal_pos = goal_pos - agent_pos
|
|
241
230
|
goal_dist = np.linalg.norm(relative_goal_pos)
|
|
242
231
|
if goal_dist <= max_observable_dist:
|
|
@@ -55,11 +55,8 @@ class Agent(Entity): # properties of agent entities
|
|
|
55
55
|
super().__init__()
|
|
56
56
|
# agents are movable by default
|
|
57
57
|
self.movable = True
|
|
58
|
-
#
|
|
59
|
-
self.
|
|
60
|
-
self.reached_goal = False
|
|
61
|
-
# reached start state after reaching goal
|
|
62
|
-
self.goal_b = None
|
|
58
|
+
# goal entity
|
|
59
|
+
self.goal = None
|
|
63
60
|
# state
|
|
64
61
|
self.state = AgentState()
|
|
65
62
|
# action
|
|
@@ -74,8 +74,8 @@ class SimpleEnv(AECEnv):
|
|
|
74
74
|
dtype=np.float32,
|
|
75
75
|
)
|
|
76
76
|
|
|
77
|
-
# state space is used by aerial agent
|
|
78
|
-
state_dim = len(world.agents) * 2 + len(world.large_obstacles) * 2
|
|
77
|
+
# state space is used by aerial agent; it encodes the positions of all agents, obstacles, and goals
|
|
78
|
+
state_dim = len(world.agents) * 2 + len(world.large_obstacles) * 2 + len(world.agents) * 2
|
|
79
79
|
self.state_space = spaces.Box(
|
|
80
80
|
low=-np.float32(1),
|
|
81
81
|
high=+np.float32(1),
|
|
@@ -108,10 +108,13 @@ class SimpleEnv(AECEnv):
|
|
|
108
108
|
for i, agent in enumerate(self.world.agents):
|
|
109
109
|
state[2*i : 2*i+2] = agent.state.p_pos
|
|
110
110
|
|
|
111
|
-
# Calculate the starting index for the obstacles in the state array
|
|
112
111
|
start_idx = 2 * len(self.world.agents)
|
|
113
112
|
for i, obstacle in enumerate(self.world.large_obstacles):
|
|
114
113
|
state[start_idx + 2*i : start_idx + 2*i+2] = obstacle.state.p_pos
|
|
114
|
+
|
|
115
|
+
start_idx = 2 * len(self.world.agents) + 2 * len(self.world.large_obstacles)
|
|
116
|
+
for i, agent in enumerate(self.world.agents):
|
|
117
|
+
state[start_idx + 2*i : start_idx + 2*i+2] = agent.goal.state.p_pos
|
|
115
118
|
|
|
116
119
|
return np.concatenate(state, axis=None)
|
|
117
120
|
|
|
@@ -141,17 +144,6 @@ class SimpleEnv(AECEnv):
|
|
|
141
144
|
self.steps = 0
|
|
142
145
|
|
|
143
146
|
self.current_actions = [None] * len(self.world.agents)
|
|
144
|
-
|
|
145
|
-
def get_start_state(self):
|
|
146
|
-
if not self._reset_called:
|
|
147
|
-
raise Exception("Cannot get start state without calling reset() first")
|
|
148
|
-
|
|
149
|
-
agent_pos = np.array([agent.state.p_pos for agent in self.world.agents])
|
|
150
|
-
goal_pos = np.array([(agent.goal_a.state.p_pos, agent.goal_b.state.p_pos) for agent in self.world.agents])
|
|
151
|
-
obs_pos = np.array([obs.state.p_pos for obs in self.world.large_obstacles])
|
|
152
|
-
|
|
153
|
-
entities = {'agents': agent_pos, 'goals': goal_pos, 'obstacles': obs_pos}
|
|
154
|
-
return entities
|
|
155
147
|
|
|
156
148
|
def _execute_world_step(self):
|
|
157
149
|
# set action for each agent
|
|
@@ -205,15 +197,14 @@ class SimpleEnv(AECEnv):
|
|
|
205
197
|
|
|
206
198
|
# Check if episode is terminated or truncated
|
|
207
199
|
def _episode_status(self):
|
|
208
|
-
goal_dist_threshold = self.world.agents[0].size + self.world.agents[0].
|
|
200
|
+
goal_dist_threshold = self.world.agents[0].size + self.world.agents[0].goal.size
|
|
209
201
|
small_obs_threshold = self.world.agents[0].size + self.world.small_obstacles[0].size
|
|
210
202
|
large_obs_threshold = self.world.agents[0].size + self.world.large_obstacles[0].size
|
|
211
203
|
|
|
212
204
|
small_obstacles = [obs for obs in self.world.small_obstacles]
|
|
213
205
|
large_obstacles = [obs for obs in self.world.large_obstacles]
|
|
214
206
|
|
|
215
|
-
|
|
216
|
-
goal_b_dist = [np.linalg.norm(agent.state.p_pos - agent.goal_b.state.p_pos) for agent in self.world.agents]
|
|
207
|
+
goal_dist = [np.linalg.norm(agent.state.p_pos - agent.goal.state.p_pos) for agent in self.world.agents]
|
|
217
208
|
small_obs_dist = [min(np.linalg.norm(agent.state.p_pos - obs.state.p_pos) for obs in small_obstacles)
|
|
218
209
|
for agent in self.world.agents]
|
|
219
210
|
large_obs_dist = [min(np.linalg.norm(agent.state.p_pos - obs.state.p_pos) for obs in large_obstacles)
|
|
@@ -226,14 +217,9 @@ class SimpleEnv(AECEnv):
|
|
|
226
217
|
truncations = [True] * self.num_agents if self.steps >= self.max_cycles else truncations
|
|
227
218
|
|
|
228
219
|
terminations = [False] * self.num_agents
|
|
229
|
-
for i, dist in enumerate(
|
|
220
|
+
for i, dist in enumerate(goal_dist):
|
|
230
221
|
if dist <= goal_dist_threshold:
|
|
231
|
-
self.
|
|
232
|
-
|
|
233
|
-
for i, dist in enumerate(goal_b_dist):
|
|
234
|
-
if self.world.agents[i].reached_goal:
|
|
235
|
-
if dist <= goal_dist_threshold:
|
|
236
|
-
terminations[i] = True
|
|
222
|
+
self.terminations[i] = True
|
|
237
223
|
|
|
238
224
|
return {'terminations': terminations, 'truncations': truncations}
|
|
239
225
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: Signal8
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.8
|
|
4
4
|
Summary: A multi-agent environment inspired by the Lewis Signaling Game, featuring eight unique problem configurations with both static and dynamic obstacles.
|
|
5
5
|
Home-page: https://github.com/ethanmclark1/signal8
|
|
6
6
|
Author: Ethan Clark
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|