def make_world(self):
     world = World()
     # set any world properties first
     world.dim_c = 2
     num_good_agents = 1
     num_adversaries = 3
     num_agents = num_adversaries + num_good_agents
     num_landmarks = 2
     # add agents
     world.agents = [Agent() for i in range(num_agents)]
     for i, agent in enumerate(world.agents):
         agent.name = 'agent %d' % i
         agent.collide = True
         agent.silent = True
         agent.adversary = True if i < num_adversaries else False
         agent.size = 0.075 if agent.adversary else 0.05
         agent.accel = 3.0 if agent.adversary else 4.0
         #agent.accel = 20.0 if agent.adversary else 25.0
         agent.max_speed = 1.0 if agent.adversary else 1.3
     # add landmarks
     world.landmarks = [Landmark() for i in range(num_landmarks)]
     for i, landmark in enumerate(world.landmarks):
         landmark.name = 'landmark %d' % i
         landmark.collide = True
         landmark.movable = False
         landmark.size = 0.2
         landmark.boundary = False
     # make initial conditions
     self.reset_world(world)
     return world
 def make_world(self):
     world = World()
     # set any world properties first
     world.dim_c = 2
     num_agents = 3
     world.num_agents = num_agents
     num_adversaries = 1
     num_landmarks = num_agents - 1
     # add agents
     world.agents = [Agent() for i in range(num_agents)]
     for i, agent in enumerate(world.agents):
         agent.name = 'agent %d' % i
         agent.collide = False
         agent.silent = True
         agent.adversary = True if i < num_adversaries else False
         agent.size = 0.15
     # add landmarks
     world.landmarks = [Landmark() for i in range(num_landmarks)]
     for i, landmark in enumerate(world.landmarks):
         landmark.name = 'landmark %d' % i
         landmark.collide = False
         landmark.movable = False
         landmark.size = 0.08
     # make initial conditions
     self.reset_world(world)
     return world
Exemple #3
0
 def make_world(self):
     world = World()
     # set any world properties first
     world.cache_dists = True
     world.dim_c = 2
     if self.num_agents is None:
         num_agents = 8
     else:
         num_agents = self.num_agents
     assert num_agents % 4 == 0, "Number of agents should be divided by 4."
     num_collectors = int(num_agents * 3 / 4)
     num_deposits = int(num_agents / 4)
     world.treasure_types = list(range(num_deposits))
     world.treasure_colors = np.array(
         sns.color_palette(n_colors=num_deposits))
     num_treasures = num_collectors
     # add agents
     world.agents = [Agent() for i in range(num_agents)]
     for i, agent in enumerate(world.agents):
         agent.i = i
         agent.name = 'agent %d' % i
         agent.collector = True if i < num_collectors else False
         if agent.collector:
             agent.color = np.array([0.85, 0.85, 0.85])
         else:
             agent.d_i = i - num_collectors
             agent.color = world.treasure_colors[agent.d_i] * 0.35
         agent.collide = True
         agent.silent = True
         agent.ghost = True
         agent.holding = None
         agent.size = 0.05 if agent.collector else 0.075
         agent.accel = 1.5
         agent.initial_mass = 1.0 if agent.collector else 2.25
         agent.max_speed = 1.0
     # add treasures
     world.landmarks = [Landmark() for i in range(num_treasures)]
     for i, landmark in enumerate(world.landmarks):
         landmark.i = i + num_agents
         landmark.name = 'treasure %d' % i
         landmark.respawn_prob = 1.0
         landmark.type = np.random.choice(world.treasure_types)
         landmark.color = world.treasure_colors[landmark.type]
         landmark.alive = True
         landmark.collide = False
         landmark.movable = False
         landmark.size = 0.025
         landmark.boundary = False
     world.walls = []
     # make initial conditions
     self.reset_world(world)
     self.reset_cached_rewards()
     return world
 def make_world(self):
     world = World()
     # set any world properties first
     world.dim_c = 4
     #world.damping = 1
     num_good_agents = 2
     num_adversaries = 4
     num_agents = num_adversaries + num_good_agents
     num_landmarks = 1
     num_food = 2
     num_forests = 2
     # add agents
     world.agents = [Agent() for i in range(num_agents)]
     for i, agent in enumerate(world.agents):
         agent.name = 'agent %d' % i
         agent.collide = True
         agent.leader = True if i == 0 else False
         agent.silent = True if i > 0 else False
         agent.adversary = True if i < num_adversaries else False
         agent.size = 0.075 if agent.adversary else 0.045
         agent.accel = 3.0 if agent.adversary else 4.0
         #agent.accel = 20.0 if agent.adversary else 25.0
         agent.max_speed = 1.0 if agent.adversary else 1.3
     # add landmarks
     world.landmarks = [Landmark() for i in range(num_landmarks)]
     for i, landmark in enumerate(world.landmarks):
         landmark.name = 'landmark %d' % i
         landmark.collide = True
         landmark.movable = False
         landmark.size = 0.2
         landmark.boundary = False
     world.food = [Landmark() for i in range(num_food)]
     for i, landmark in enumerate(world.food):
         landmark.name = 'food %d' % i
         landmark.collide = False
         landmark.movable = False
         landmark.size = 0.03
         landmark.boundary = False
     world.forests = [Landmark() for i in range(num_forests)]
     for i, landmark in enumerate(world.forests):
         landmark.name = 'forest %d' % i
         landmark.collide = False
         landmark.movable = False
         landmark.size = 0.3
         landmark.boundary = False
     world.landmarks += world.food
     world.landmarks += world.forests
     #world.landmarks += self.set_boundaries(world)  # world boundaries now penalized with negative reward
     # make initial conditions
     self.reset_world(world)
     return world
 def make_world(self):
     world = World()
     # add agents
     world.agents = [Agent() for i in range(1)]
     for i, agent in enumerate(world.agents):
         agent.name = 'agent %d' % i
         agent.collide = False
         agent.silent = True
     # add landmarks
     world.landmarks = [Landmark() for i in range(1)]
     for i, landmark in enumerate(world.landmarks):
         landmark.name = 'landmark %d' % i
         landmark.collide = False
         landmark.movable = False
     # make initial conditions
     self.reset_world(world)
     return world
Exemple #6
0
 def make_world(self):
     world = World()
     # set any world properties first
     world.dim_c = 10        
     # add agents
     world.agents = [Agent() for i in range(2)]
     for i, agent in enumerate(world.agents):
         agent.name = 'agent %d' % i
         agent.collide = False
         # agent.u_noise = 1e-1
         # agent.c_noise = 1e-1
     # add landmarks
     world.landmarks = [Landmark() for i in range(3)]
     for i, landmark in enumerate(world.landmarks):
         landmark.name = 'landmark %d' % i
         landmark.collide = False
         landmark.movable = False
     # make initial conditions
     self.reset_world(world)
     return world
 def make_world(self):
     world = World()
     # set any world properties first
     world.dim_c = 5
     if self.num_agents is None:
         num_listeners = 4
         num_speakers = 4
     else:
         assert self.num_agents % 2 == 0, "Number of agents should be divided by 2."
         num_listeners = int(self.num_agents / 2)
         num_speakers = int(self.num_agents / 2)
     num_landmarks = 6
     world.landmark_colors = np.array(
         sns.color_palette(n_colors=num_landmarks))
     world.listeners = []
     for li in range(num_listeners):
         agent = Agent()
         agent.i = li
         agent.name = 'agent %i' % agent.i
         agent.listener = True
         agent.collide = False
         agent.size = 0.075
         agent.silent = True
         agent.accel = 1.5
         agent.initial_mass = 1.0
         agent.max_speed = 1.0
         world.listeners.append(agent)
     world.speakers = []
     for si in range(num_speakers):
         agent = Agent()
         agent.i = si + num_listeners
         agent.name = 'agent %i' % agent.i
         agent.listener = False
         agent.collide = False
         agent.size = 0.075
         agent.movable = False
         agent.accel = 1.5
         agent.initial_mass = 1.0
         agent.max_speed = 1.0
         world.speakers.append(agent)
     world.agents = world.listeners + world.speakers
     # add landmarks
     world.landmarks = [Landmark() for i in range(num_landmarks)]
     for i, landmark in enumerate(world.landmarks):
         landmark.i = i + num_listeners + num_speakers
         landmark.name = 'landmark %d' % i
         landmark.collide = False
         landmark.movable = False
         landmark.size = 0.04
         landmark.color = world.landmark_colors[i]
     # make initial conditions
     self.reset_world(world)
     self.reset_cached_rewards()
     return world