Beispiel #1
0
    def onStartTimeStep(self, interactions_filename, events_filename,
                        current_time_step):
        self.current_time_step = current_time_step

        for agent in self.agents_obj.agents.values():
            agent.new_time_step()

        for location in self.locations_obj.locations.values():
            location.new_time_step()

        #Add Interactions to agents
        if interactions_filename != None:
            ReadFile.ReadInteractions(interactions_filename, self.config_obj,
                                      self.agents_obj)

        #Add events to locations
        if events_filename != None:
            ReadFile.ReadEvents(events_filename, self.config_obj,
                                self.locations_obj)

        #Enact policies by updating agent and location states.
        for policy in self.policy_list:
            policy.enact_policy(self.current_time_step,
                                self.agents_obj.agents.values(),
                                self.locations_obj.locations.values(),
                                self.model)

        if events_filename != None:
            #Update event info to agents from location
            for location in self.locations_obj.locations.values():
                if not location.lock_down_state:
                    for event_info in location.events:
                        self.model.update_event_infection(
                            event_info, location, self.agents_obj,
                            self.current_time_step, self.event_restriction_fn)