def set_boundaries(self, world): boundary_list = [] landmark_size = 1 edge = 1 + landmark_size num_landmarks = int(edge * 2 / landmark_size) for x_pos in [-edge, edge]: for i in range(num_landmarks): l = Landmark() l.state.p_pos = np.array([x_pos, -1 + i * landmark_size]) boundary_list.append(l) for y_pos in [-edge, edge]: for i in range(num_landmarks): l = Landmark() l.state.p_pos = np.array([-1 + i * landmark_size, y_pos]) boundary_list.append(l) for i, l in enumerate(boundary_list): l.name = 'boundary %d' % i l.collide = True l.movable = False l.boundary = True l.color = np.array([0.75, 0.75, 0.75]) l.size = landmark_size l.state.p_vel = np.zeros(world.dim_p) return boundary_list
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() # set any world properties first world.dim_c = 3 num_landmarks = 3 world.collaborative = True # 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.size = 0.075 # speaker world.agents[0].movable = False # listener world.agents[1].silent = True # 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.04 # 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 = 2 num_adversaries = 1 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 if i < num_adversaries: agent.adversary = True else: agent.adversary = False # 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 # 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_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() # 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
def make_world(self): world = World() # set any world properties first world.dim_c = 2 #original=10 world.collaborative = True # whether agents share rewards # 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 # 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