def __init__(self): Simulation.__init__(self) # the neighbors network self.__nwNeighbors = dict() # the record of requests self.__requestsHistory = dict() # the record of interventions self.__interventionsHistory = dict() # the requests made in the current time-step self.__requestsMade = dict() # the interventions made in the current time-step self.__interventionsMade = dict()
def step(self): """ After "deterministic" step, by super class, disturb agent states """ Simulation.step(self) for a in self._agentset.values(): a.disturbState( SP_AGENTSTATE_PERTURBATION ) now = self.getAge() self.__requestsHistory[ now ] = self.__requestsMade self.__interventionsHistory[ now ] = self.__interventionsMade self.__requestsMade = dict() self.__interventionsMade = dict() deltaT = now - SP_ACTION_TIMEOUT if deltaT > 0: del(self.__requestsHistory[ deltaT ]) del(self.__interventionsHistory[ deltaT ])
def addAgent(self, agent): """ Add an agent to the population. """ Simulation.addAgent(self, agent) self.__nwNeighbors[ agent.getId()] = list()