Signal8 3.7__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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: Signal8
3
- Version: 3.7
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
- # goal_a is the actual goal
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.goal_a = world.goals[i]
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.goal_a.state.p_vel = np.zeros(world.dim_p)
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.goal_a.state.p_pos = self._generate_position(np_random, condition)
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.goal_b.state.p_pos if agent.reached_goal else agent.goal_a.state.p_pos
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
- # reached goal state
59
- self.goal_a = None
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
@@ -114,7 +114,7 @@ class SimpleEnv(AECEnv):
114
114
 
115
115
  start_idx = 2 * len(self.world.agents) + 2 * len(self.world.large_obstacles)
116
116
  for i, agent in enumerate(self.world.agents):
117
- state[start_idx + 2*i : start_idx + 2*i+2] = agent.goal_a.state.p_pos
117
+ state[start_idx + 2*i : start_idx + 2*i+2] = agent.goal.state.p_pos
118
118
 
119
119
  return np.concatenate(state, axis=None)
120
120
 
@@ -144,17 +144,6 @@ class SimpleEnv(AECEnv):
144
144
  self.steps = 0
145
145
 
146
146
  self.current_actions = [None] * len(self.world.agents)
147
-
148
- def get_start_state(self):
149
- if not self._reset_called:
150
- raise Exception("Cannot get start state without calling reset() first")
151
-
152
- agent_pos = np.array([agent.state.p_pos for agent in self.world.agents])
153
- goal_pos = np.array([(agent.goal_a.state.p_pos, agent.goal_b.state.p_pos) for agent in self.world.agents])
154
- obs_pos = np.array([obs.state.p_pos for obs in self.world.large_obstacles])
155
-
156
- entities = {'agents': agent_pos, 'goals': goal_pos, 'obstacles': obs_pos}
157
- return entities
158
147
 
159
148
  def _execute_world_step(self):
160
149
  # set action for each agent
@@ -208,15 +197,14 @@ class SimpleEnv(AECEnv):
208
197
 
209
198
  # Check if episode is terminated or truncated
210
199
  def _episode_status(self):
211
- goal_dist_threshold = self.world.agents[0].size + self.world.agents[0].goal_a.size
200
+ goal_dist_threshold = self.world.agents[0].size + self.world.agents[0].goal.size
212
201
  small_obs_threshold = self.world.agents[0].size + self.world.small_obstacles[0].size
213
202
  large_obs_threshold = self.world.agents[0].size + self.world.large_obstacles[0].size
214
203
 
215
204
  small_obstacles = [obs for obs in self.world.small_obstacles]
216
205
  large_obstacles = [obs for obs in self.world.large_obstacles]
217
206
 
218
- goal_a_dist = [np.linalg.norm(agent.state.p_pos - agent.goal_a.state.p_pos) for agent in self.world.agents]
219
- 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]
220
208
  small_obs_dist = [min(np.linalg.norm(agent.state.p_pos - obs.state.p_pos) for obs in small_obstacles)
221
209
  for agent in self.world.agents]
222
210
  large_obs_dist = [min(np.linalg.norm(agent.state.p_pos - obs.state.p_pos) for obs in large_obstacles)
@@ -229,14 +217,9 @@ class SimpleEnv(AECEnv):
229
217
  truncations = [True] * self.num_agents if self.steps >= self.max_cycles else truncations
230
218
 
231
219
  terminations = [False] * self.num_agents
232
- for i, dist in enumerate(goal_a_dist):
220
+ for i, dist in enumerate(goal_dist):
233
221
  if dist <= goal_dist_threshold:
234
- self.world.agents[i].reached_goal = True
235
-
236
- for i, dist in enumerate(goal_b_dist):
237
- if self.world.agents[i].reached_goal:
238
- if dist <= goal_dist_threshold:
239
- terminations[i] = True
222
+ self.terminations[i] = True
240
223
 
241
224
  return {'terminations': terminations, 'truncations': truncations}
242
225
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: Signal8
3
- Version: 3.7
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
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="Signal8",
5
- version="3.7",
5
+ version="3.8",
6
6
  packages=find_packages(),
7
7
  author="Ethan Clark",
8
8
  author_email="eclark715@gmail.com.com",
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes