def init_agents(self): """ Initialise the n_agents_arrival agents The simulation starts with two agents (with a total population of 40 individuals) settling in proximity to Anakena Beach in the North part of the island in the year t_0 = 800 A.D., following [Bahn2017]. We assume, they erect a settlement nearby within radius moving_radius_arrival """ for i in range(self.n_agents_arrival): # Arrival point is at Anakena Beach x, y = self.map.midpoints_map[self.map.anakena_ind_map] # Create an agent, x,y are at Anakena Beach, population p is the initial population over the initial agents ag = Agent(self, x, y, int(self.p_arrival / self.n_agents_arrival)) ag.cell = self.map.anakena_ind_map ag.cell_all = self.map.anakena_ind # For storage purposes: # Increase agent number in the cell of Anakena Beach by 1 # self.map.agNr_c[ag.cell] += 1 # Increase population size in the cell of Anakena Beach by the agent's population p self.map.pop_cell[ag.cell] += ag.p # increase the running agent indices (including dead agents) self.max_agent_index += 1 # Move the agent to a new location, within the radius specified by moving_radius_arrival around anakena ag.move(self.map.circ_inds_anakena) # Update tree preference and consequently resource requirements ag.update_t_pref() ag.calc_resource_req() # Add agent to schedule (list of agents) self.schedule.append(ag) return
def _play(self, agent: Agent) -> str: move = agent.move(self._field) result = self._field.move(*move, agent) return result