Signal8 2.1__tar.gz → 2.3__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: 2.1
3
+ Version: 2.3
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
@@ -17,6 +17,9 @@ from gymnasium.utils import EzPickle
17
17
  class raw_env(SimpleEnv, EzPickle):
18
18
  def __init__(self, num_agents=1, render_mode=None):
19
19
 
20
+ if num_agents > 2:
21
+ raise ValueError("Signal8 currently can only support up to 2 agents.")
22
+
20
23
  scenario = Scenario()
21
24
  world = scenario.make_world(num_agents)
22
25
 
@@ -75,7 +78,7 @@ class Scenario(BaseScenario):
75
78
  for the precision farming case (i.e., crop that wasn't selected as goal becomes an obstacle)
76
79
  """
77
80
  def _reset_agents_and_goals(self, world, np_random):
78
- temp_goal_constr = list(copy.copy(world.goal_constr))
81
+ temp_goal_constr = copy.copy(world.goal_constr)
79
82
  for i, agent in enumerate(world.agents):
80
83
  agent.color = np.array([1, 0.95, 0.8])
81
84
  agent.state.p_vel = np.zeros(world.dim_p)
@@ -87,8 +90,7 @@ class Scenario(BaseScenario):
87
90
  agent.goal_a.state.p_vel = np.zeros(world.dim_p)
88
91
  goal_constr = random.choice(temp_goal_constr)
89
92
  agent.goal_a.state.p_pos = np_random.uniform(*zip(*goal_constr))
90
- if world.problem_name.startswith('precision_farming'):
91
- temp_goal_constr.remove(goal_constr)
93
+ temp_goal_constr.remove(goal_constr)
92
94
 
93
95
  agent.goal_b = world.goals[len(world.goals) - 1 - i]
94
96
  agent.goal_b.color = np.array([0.85, 0.90, 0.99])
@@ -128,9 +130,10 @@ class Scenario(BaseScenario):
128
130
 
129
131
  # Reset position of obstacles
130
132
  def _reset_obstacles(self, world, np_random, leftover_entities):
131
- temp_static_obs_constr = list(copy.copy(world.static_obstacle_constr))
132
- temp_static_obs_constr += leftover_entities
133
- temp_dynamic_obs_constr = list(copy.copy(world.dynamic_obstacle_constr))
133
+ temp_static_obs_constr = copy.copy(world.static_obstacle_constr)
134
+ if world.problem_name.startswith('precision_farming'):
135
+ temp_static_obs_constr += leftover_entities
136
+ temp_dynamic_obs_constr = copy.copy(world.dynamic_obstacle_constr)
134
137
 
135
138
  num_dynamic_obs = len(temp_dynamic_obs_constr)
136
139
  self._match_obstacles_to_problem(world, len(temp_static_obs_constr))
@@ -159,8 +162,7 @@ class Scenario(BaseScenario):
159
162
  self._set_problem_scenario(world, np_random, problem_name)
160
163
  leftover_entities = self._reset_agents_and_goals(world, np_random)
161
164
  self._reset_obstacles(world, np_random, leftover_entities)
162
- if problem_name is not None:
163
- self._start_scripted_obstacles(world)
165
+ self._start_scripted_obstacles(world)
164
166
 
165
167
  # Reward given by agents to agents for reaching their respective goals
166
168
  def reward(self, agent, world):
@@ -220,7 +222,7 @@ class Scenario(BaseScenario):
220
222
  elif problem_name == 'disaster_response_3':
221
223
  obs.size += 0.0125
222
224
  elif problem_name.startswith('precision_farming'):
223
- obs_num = int(problem_name.split('_')[-1])
225
+ obs_num = int(obs.name.split('_')[-1])
224
226
  scenario_num = int(problem_name.split('_')[-1])
225
227
  action = self.npc[obs_num].get_scripted_action(obs, scenario_num)
226
228
 
@@ -1,6 +1,6 @@
1
1
  import Signal8
2
2
 
3
- env = Signal8.env()
3
+ env = Signal8.env(num_agents=2)
4
4
  env.reset(options={"problem_name": "disaster_response_0"})
5
5
  observation, _, terminations, truncations, _ = env.last()
6
6
  entities = env.unwrapped.get_start_state()
@@ -0,0 +1,130 @@
1
+ problems = {
2
+ 'disaster_response_0': {
3
+ 'start': [((-0.05, 0.05), (-1, -0.90))],
4
+ 'goal': [
5
+ ((-0.85, -0.75), (0.90, 1)),
6
+ ((-1, -0.9), (-0.65, -0.55))
7
+ ],
8
+ 'static_obs': [
9
+ ((-1, -0.3), (0.30, 0.50)),
10
+ ((0.15, 0.40), (0.60, 1)),
11
+ ((-0.85, -0.75), (0.05, 0.15))
12
+ ],
13
+ 'dynamic_obs': [((0.95, 1), (0.95, 1))]
14
+ },
15
+ 'disaster_response_1': {
16
+ 'start': [((-0.05, 0.05), (-1, -0.90))],
17
+ 'goal': [
18
+ ((0.90, 1), (-0.05, 0.05)),
19
+ ((-1, -0.90), (-0.05, 0.05))
20
+ ],
21
+ 'static_obs': [
22
+ ((-0.25, 0), (-0.3, 0.65)),
23
+ ((0.25, 0.45), (0.5, 1)),
24
+ ((0.75, 0.85), (-0.75, -0.30))
25
+ ],
26
+ 'dynamic_obs': [((-0.6, -0.45), (0.95, 1))]
27
+ },
28
+ 'disaster_response_2': {
29
+ 'start': [((-0.05, 0.05), (-1, -0.90))],
30
+ 'goal': [
31
+ ((-0.05, 0.05), (0, 0.10)),
32
+ ((-1, -0.9), (0.05, 0.15))
33
+ ],
34
+ 'static_obs': [
35
+ ((-1, -0.25), (-0.75, -0.55)),
36
+ ((0.25, 0.65), (-0.85, -0.15)),
37
+ ((0, 0.20), (0.75, 1))
38
+ ],
39
+ 'dynamic_obs': [((-0.15, 0), (0.90, 1))]
40
+ },
41
+ 'disaster_response_3': {
42
+ 'start': [((-0.05, 0.05), (-1, -0.90))],
43
+ 'goal': [
44
+ ((0.90, 1), (0.90, 1)),
45
+ ((0.90, 1), (-0.05, 0.05))
46
+ ],
47
+ 'static_obs': [
48
+ ((-0.025, 0.125), (0.5, 1)),
49
+ ((-1, -0.35), (0.5, 0.75)),
50
+ ((0.1, 1), (-0.70, -0.35))
51
+ ],
52
+ 'dynamic_obs': [((-1, -0.70), (0.80, 0.875))]
53
+ },
54
+ 'precision_farming_0': {
55
+ 'start': [((0.80, 1), (0.80, 1))],
56
+ 'goal': [
57
+ ((-0.95, -0.70), (0.525, 0.90)),
58
+ ((-0.625, -0.475), (0.525, 0.90)),
59
+ ((-0.95, -0.70), (-0.15, 0.225)),
60
+ ((-0.625, -0.475), (-0.15, 0.225)),
61
+ ((-0.95, -0.70), (-0.825, -0.45)),
62
+ ((-0.625, -0.475), (-0.825, -0.45))
63
+ ],
64
+ 'static_obs': [
65
+ ((-0.85, -0.5), (0.275, 0.475)),
66
+ ((-0.85, -0.5), (-0.40, -0.20)),
67
+ ((0.30, 0.50), (-0.90, -0.65))
68
+ ],
69
+ 'dynamic_obs': [((0.80, 1), (-1, -0.80))]
70
+ },
71
+ 'precision_farming_1': {
72
+ 'start': [((-1, -0.80), (-1, -0.80))],
73
+ 'goal': [
74
+ ((-0.95, -0.575), (0.65, 0.90)),
75
+ ((-0.95, -0.575), (0.20, 0.45)),
76
+ ((-0.275, 0.10), (0.65, 0.90)),
77
+ ((-0.275, 0.10), (0.20, 0.45)),
78
+ ((0.40, 0.775), (0.65, 0.90)),
79
+ ((0.40, 0.775), (0.20, 0.45)),
80
+ ],
81
+ 'static_obs': [
82
+ ((-0.525, -0.325), (0.20, 0.90)),
83
+ ((0.15, 0.35), (0.20, 0.90)),
84
+ ((-1, -0.825), (-0.15, 0.15)),
85
+ ],
86
+ 'dynamic_obs': [((0.80, 1), (-1, -0.80))]
87
+ },
88
+ 'precision_farming_2': {
89
+ 'start': [((-1, -0.80), (-0.20, 0))],
90
+ 'goal': [
91
+ ((-0.1875, 0.1875), (0.65, 0.90)),
92
+ ((-0.1875, 0.1875), (0.325, 0.575)),
93
+ ((-0.1875, 0.1875), (0, 0.25)),
94
+ ((-0.1875, 0.1875), (-0.325, -0.075)),
95
+ ((-0.1875, 0.1875), (-0.65, -0.40)),
96
+ ((-0.1875, 0.1875), (-0.975, -0.725)),
97
+ ],
98
+ 'static_obs': [
99
+ ((-0.45, -0.25), (0.125, 0.85)),
100
+ ((-0.45, -0.25), (-0.85, -0.125)),
101
+ ((0.25, 0.45), (0.125, 0.85)),
102
+ ((0.25, 0.45), (-0.85, -0.125)),
103
+ ((-0.56875, -0.21875), (0.875, 1)),
104
+ ],
105
+ 'dynamic_obs': [((-1, -0.80), (0, 0.20))]
106
+ },
107
+ 'precision_farming_3': {
108
+ 'start': [((-0.10, 0.10), (0.80, 1))],
109
+ 'goal': [
110
+ ((-0.80, -0.425), (-0.20, 0)),
111
+ ((-0.1875, 0.1875), (-0.20, 0)),
112
+ ((0.425, 0.80), (-0.20, 0)),
113
+ ((-0.80, -0.425), (-0.925, -0.725)),
114
+ ((-0.1875, 0.1875), (-0.925, -0.725)),
115
+ ((0.425, 0.80), (-0.925, -0.725)),
116
+ ],
117
+ 'static_obs': [
118
+ ((-0.85, 0.85), (-0.65, -0.275)),
119
+ ((0.10, 0.30), (0.80, 1)),
120
+ ],
121
+ 'dynamic_obs': [((-0.30, -0.10), (0.80, 1))]
122
+ },
123
+ }
124
+
125
+ def get_problem_list():
126
+ return list(problems.keys())
127
+
128
+ def get_problem(scenario_name):
129
+ problem = problems[scenario_name]
130
+ return problem
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: Signal8
3
- Version: 2.1
3
+ Version: 2.3
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="2.1",
5
+ version="2.3",
6
6
  packages=find_packages(),
7
7
  author="Ethan Clark",
8
8
  author_email="eclark715@gmail.com.com",
@@ -1,114 +0,0 @@
1
- problems = {
2
- 'disaster_response_0': {
3
- 'start': (((-0.05, 0.05), (-1, -0.90)),),
4
- 'goal': (((-0.85, -0.75), (0.90, 1)),),
5
- 'static_obs': (
6
- ((-1, -0.3), (0.30, 0.50)),
7
- ((0.15, 0.40), (0.60, 1)),
8
- ((-0.85, -0.75), (0.05, 0.15))
9
- ),
10
- 'dynamic_obs': (((0.95, 1), (0.95, 1)),)
11
- },
12
- 'disaster_response_1': {
13
- 'start': (((-0.05, 0.05), (-1, -0.90)),),
14
- 'goal': (((0.90, 1), (-0.05, 0.05)),),
15
- 'static_obs': (
16
- ((-0.25, 0), (-0.3, 0.65)),
17
- ((0.25, 0.45), (0.5, 1)),
18
- ((0.75, 0.85), (-0.75, -0.30))
19
- ),
20
- 'dynamic_obs': (((-0.6, -0.45), (0.95, 1)),)
21
- },
22
- 'disaster_response_2': {
23
- 'start': (((-0.05, 0.05), (-1, -0.90)),),
24
- 'goal': (((-0.05, 0.05), (0, 0.10)),),
25
- 'static_obs': (
26
- ((-1, -0.25), (-0.75, -0.55)),
27
- ((0.25, 0.65), (-0.85, -0.15)),
28
- ((0, 0.20), (0.75, 1))
29
- ),
30
- 'dynamic_obs': (((-0.15, 0), (0.90, 1)),)
31
- },
32
- 'disaster_response_3': {
33
- 'start': (((-0.05, 0.05), (-1, -0.90)),),
34
- 'goal': (((0.90, 1), (0.90, 1)),),
35
- 'static_obs': (
36
- ((-0.025, 0.125), (0.5, 1)),
37
- ((-1, -0.35), (0.5, 0.75)),
38
- ((0.1, 1), (-0.70, -0.35))
39
- ),
40
- 'dynamic_obs': (((-1, -0.70), (0.80, 0.875)),)
41
- },
42
- 'precision_farming_0': {
43
- 'start': (((0.80, 1), (0.80, 1)),),
44
- 'goal': (((-0.95, -0.70), (0.525, 0.90)),
45
- ((-0.625, -0.475), (0.525, 0.90)),
46
- ((-0.95, -0.70), (-0.15, 0.225)),
47
- ((-0.625, -0.475), (-0.15, 0.225)),
48
- ((-0.95, -0.70), (-0.825, -0.45)),
49
- ((-0.625, -0.475), (-0.825, -0.45)),
50
- ),
51
- 'static_obs': (
52
- ((-0.85, -0.5), (0.275, 0.475)),
53
- ((-0.85, -0.5), (-0.40, -0.20)),
54
- ((0.30, 0.50), (-0.90, -0.65)),
55
- ),
56
- 'dynamic_obs': (((0.80, 1), (-1, -0.80)),)
57
- },
58
- 'precision_farming_1': {
59
- 'start': (((-1, -0.80), (-1, -0.80)),),
60
- 'goal': (((-0.95, -0.575), (0.65, 0.90)),
61
- ((-0.95, -0.575), (0.20, 0.45)),
62
- ((-0.275, 0.10), (0.65, 0.90)),
63
- ((-0.275, 0.10), (0.20, 0.45)),
64
- ((0.40, 0.775), (0.65, 0.90)),
65
- ((0.40, 0.775), (0.20, 0.45)),
66
- ),
67
- 'static_obs': (
68
- ((-0.525, -0.325), (0.20, 0.90)),
69
- ((0.15, 0.35), (0.20, 0.90)),
70
- ((-1, -0.825), (-0.15, 0.15)),
71
- ),
72
- 'dynamic_obs': (((0.80, 1), (-1, -0.80)),)
73
- },
74
- 'precision_farming_2': {
75
- 'start': (((-1, -0.80), (-0.20, 0)),),
76
- 'goal': (((-0.1875, 0.1875), (0.65, 0.90)),
77
- ((-0.1875, 0.1875), (0.325, 0.575)),
78
- ((-0.1875, 0.1875), (0, 0.25)),
79
- ((-0.1875, 0.1875), (-0.325, -0.075)),
80
- ((-0.1875, 0.1875), (-0.65, -0.40)),
81
- ((-0.1875, 0.1875), (-0.975, -0.725)),
82
- ),
83
- 'static_obs': (
84
- ((-0.45, -0.25), (0.125, 0.85)),
85
- ((-0.45, -0.25), (-0.85, -0.125)),
86
- ((0.25, 0.45), (0.125, 0.85)),
87
- ((0.25, 0.45), (-0.85, -0.125)),
88
- ((-0.56875, -0.21875), (0.875, 1)),
89
- ),
90
- 'dynamic_obs': (((-1, -0.80), (0, 0.20)),)
91
- },
92
- 'precision_farming_3': {
93
- 'start': (((-0.10, 0.10), (0.80, 1)),),
94
- 'goal': (((-0.80, -0.425), (-0.20, 0)),
95
- ((-0.1875, 0.1875), (-0.20, 0)),
96
- ((0.425, 0.80), (-0.20, 0)),
97
- ((-0.80, -0.425), (-0.925, -0.725)),
98
- ((-0.1875, 0.1875), (-0.925, -0.725)),
99
- ((0.425, 0.80), (-0.925, -0.725)),
100
- ),
101
- 'static_obs': (
102
- ((-0.85, 0.85), (-0.65, -0.275)),
103
- ((0.10, 0.30), (0.80, 1)),
104
- ),
105
- 'dynamic_obs': (((-0.30, -0.10), (0.80, 1)),)
106
- },
107
- }
108
-
109
- def get_problem_list():
110
- return list(problems.keys())
111
-
112
- def get_problem(scenario_name):
113
- problem = problems[scenario_name]
114
- return problem
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