def setup_agents(self):
        map_with_agents = self.get_map_with_agents()

        for i in range(self.num_agents):
            agent_id = 'agent-' + str(i)
            spawn_point = self.spawn_point()
            rotation = self.spawn_rotation()
            grid = util.return_view(map_with_agents, spawn_point,
                                    HARVEST_VIEW_SIZE, HARVEST_VIEW_SIZE)
            agent = HarvestAgent(agent_id, spawn_point, rotation, grid)
            self.agents[agent_id] = agent
    def setup_agents(self):
        map_with_agents = self.get_map_with_agents()

        for i in range(self.num_agents):
            agent_id = "agent-" + str(i)
            spawn_point = self.spawn_point()
            rotation = self.spawn_rotation()
            grid = map_with_agents
            agent = HarvestAgent(agent_id,
                                 spawn_point,
                                 rotation,
                                 grid,
                                 view_len=HARVEST_VIEW_SIZE)
            self.agents[agent_id] = agent
    def setup_agents(self):
        map_with_agents = self.get_map_with_agents()

        for i in range(self.num_agents):
            agent_id = 'agent-' + str(i)
            spawn_point = self.spawn_point()
            rotation = self.spawn_rotation()
            grid = map_with_agents
            if self.ir_param_list is None:
                agent_params = None
            else:
                agent_params = self.ir_param_list[i]
            if agent_params is None:
                agent = HarvestAgent(agent_id,
                                     spawn_point,
                                     rotation,
                                     grid,
                                     self.num_agents,
                                     hit_penalty=self.hit_penalty,
                                     fire_cost=self.fire_cost)
            elif agent_params[0].lower() == "ineq":
                agent = HarvestAgent(agent_id,
                                     spawn_point,
                                     rotation,
                                     grid,
                                     self.num_agents,
                                     intrinsic_rew_type="ineq",
                                     ineq_alpha=agent_params[1],
                                     ineq_beta=agent_params[2],
                                     rew_scale=agent_params[3],
                                     hit_penalty=self.hit_penalty,
                                     fire_cost=self.fire_cost)
            elif agent_params[0].lower() == "altruism":
                agent = HarvestAgent(agent_id,
                                     spawn_point,
                                     rotation,
                                     grid,
                                     self.num_agents,
                                     intrinsic_rew_type="altruism",
                                     w_self=agent_params[1],
                                     w_others=agent_params[2],
                                     rew_scale=agent_params[3],
                                     hit_penalty=self.hit_penalty,
                                     fire_cost=self.fire_cost)
            elif agent_params[0].lower() == "svo":
                agent = HarvestAgent(agent_id,
                                     spawn_point,
                                     rotation,
                                     grid,
                                     self.num_agents,
                                     intrinsic_rew_type="svo",
                                     svo_angle=agent_params[1],
                                     svo_weight=agent_params[2],
                                     rew_scale=agent_params[3],
                                     hit_penalty=self.hit_penalty,
                                     fire_cost=self.fire_cost)
            elif agent_params[0].lower() == "gini":
                agent = HarvestAgent(
                    agent_id,
                    spawn_point,
                    rotation,
                    grid,
                    self.num_agents,
                    intrinsic_rew_type="gini",
                    gini_weight=agent_params[1],
                    # svo_weight=agent_params[2],
                    rew_scale=agent_params[2],
                    hit_penalty=self.hit_penalty,
                    fire_cost=self.fire_cost)
            elif agent_params[0].lower() == "vengeance":
                agent = HarvestAgent(agent_id,
                                     spawn_point,
                                     rotation,
                                     grid,
                                     self.num_agents,
                                     intrinsic_rew_type="vengeance",
                                     vengeance_threshold=agent_params[1],
                                     vengeance_rew=agent_params[2],
                                     rew_scale=agent_params[3],
                                     hit_penalty=self.hit_penalty,
                                     fire_cost=self.fire_cost)
            # agent = HarvestAgent(agent_id, spawn_point, rotation, grid)

            # grid = util.return_view(map_with_agents, spawn_point,
            #                         HARVEST_VIEW_SIZE, HARVEST_VIEW_SIZE)
            # agent = HarvestAgent(agent_id, spawn_point, rotation, grid)
            self.agents[agent_id] = agent
예제 #4
0
 def observation_space(num_agents, num_symbols):
     return HarvestAgent.observation_space(num_agents, num_symbols)
예제 #5
0
 def action_space(num_agents, num_symbols):
     return HarvestAgent.action_space(num_agents, num_symbols)