Ejemplo n.º 1
0
    def execute(self, agent: Agent, state: SimState) -> None:
        if agent.state() is not AgentState.INCUBATION:
            return

        if agent.incubation_days() is state.incubation_period():
            agent.set_state(AgentState.INFECTIVE)
        else:
            agent.update_incubation_days()
Ejemplo n.º 2
0
    def execute(self, agent: Agent, state: SimState) -> None:
        if agent.state() is not AgentState.INFECTIVE:
            return

        if np.random.random() < state.remove_prob():
            agent.set_state(AgentState.REMOVED)
        else:
            agent.update_sick_days()
Ejemplo n.º 3
0
    def execute(self, agent: Agent, state: SimState) -> None:
        """Basically the same method as in the DefaultStatusStrategy, but adding the lethality check.
        :param agent Agent to update
        :param state State the simulation is in"""
        if agent.state() is not AgentState.INFECTIVE:
            return

        if np.random.random() < state.remove_prob():
            if np.random.random() < state.lethality():
                agent.set_state(AgentState.DEAD)
            else:
                agent.set_state(AgentState.IMMUNE)
        else:
            agent.update_sick_days()
Ejemplo n.º 4
0
 def execute(self, agent: Agent, state: SimState) -> None:
     """Updates the agents 'vaccine' before executing other checks"""
     if agent.state() == AgentState.SUSCEPTIBLE and self.days == state.vaccine_time() \
             and np.random.random() < state.vaccine_share():
         agent.set_state(AgentState.IMMUNE)