Exemple #1
0
    def make_world(self):
        world = World()

        #Setting World Properties
        world.dim_c = 5
        num_listeners = 1  # Number of listeners= Number of agents
        num_speakers = 4  # Number of speakers= Number of advisors
        num_landmarks = 1  # Number of landmarks= Number of goals

        world.landmark_colors = np.array(
            sns.color_palette(n_colors=num_landmarks))

        #Creation of listeners
        world.listeners = []
        for listener in range(num_listeners):
            agent = Agent()
            agent.i = listener
            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)

        #Creation of speakers
        world.speakers = []
        for speaker in range(num_speakers):
            agent = Agent()
            agent.i = speaker + 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)

        #The World is collectively made up of listeners and speakers
        world.agents = world.listeners + world.speakers

        #Creation of 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]
        #Set initial conditions
        self.reset_world(world)
        self.reset_cached_rewards()
        return world
Exemple #2
0
 def make_world(self):
     world = World()
     # set any world properties first
     world.dim_c = 5
     num_listeners = 4
     num_speakers = 4
     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
Exemple #3
0
    def make_world(self):
        world = World()

        # set any world properties first
        num_humans = 2
        num_zombies = 5
        num_agents = num_humans + num_zombies

        # add agents
        agents = []
        # add humans' team
        for i in range(num_humans):
            agent = Agent()
            agent.collide = True
            agent.team = 0
            agent.name = 'human %d' % i
            agent.size = 0.05
            agent.accel = 4.0
            agent.max_speed = 1.3
            agent.health_decay = 0.99

            # weapons
            agent.armed = True
            agent.arms_reload_time = 0.2
            agent.arms_pallet_count = 2
            agent.arms_pallet_damage = 0.2
            agent.arms_pallet_range = 3
            agent.arms_pallet_spread = 3 / 360.0 * 2 * np.pi

            agents.append(agent)
        # add zombies' team
        for i in range(num_zombies):
            agent = Agent()
            agent.collide = True
            agent.team = 1
            agent.name = 'zombie %d' % i
            agent.size = 0.05
            agent.accel = 3.0
            agent.max_speed = 1.0
            agents.append(agent)
        world.agents = agents

        # make initial conditions
        self.reset_world(world)

        return world
Exemple #4
0
 def _create_agent_base(self, ind):
     agent = Agent()
     agent.i = ind
     agent.name = 'agent %i' % agent.i
     agent.collide = False
     agent.size = 0.075
     agent.accel = 1.5
     agent.initial_mass = 1.0
     agent.max_speed = 1.0
     return agent
Exemple #5
0
    def make_world(self):
        world = World()

        # set any world properties first
        num_humans = 2
        num_zombies = 5
        num_agents = num_humans + num_zombies

        # add agents
        agents = []
        # add humans' team
        for i in range(num_humans):
            agent = Agent()
            agent.collide = True
            agent.team = 0
            agent.name = 'human %d' % i
            agent.size = 0.05
            agent.accel = 4.0
            agent.max_speed = 1.3
            agent.health_decay = 0.99
            agents.append(agent)
        # add zombies' team
        for i in range(num_zombies):
            agent = Agent()
            agent.collide = True
            agent.team = 1
            agent.name = 'zombie %d' % i
            agent.size = 0.05
            agent.accel = 3.0
            agent.max_speed = 1.0
            agents.append(agent)
        world.agents = agents

        # make initial conditions
        self.reset_world(world)

        return world