private void SimulateInfections() { foreach (var agent in PopulationDynamics.GetInfectiousAgents()) { var encounters = PopulationDynamics.GetEncounters(agent, RandomProvider); foreach (var contact in encounters) { if (contact.Agent == agent) { continue; // can't infect yourself } if (contact.Agent.TransitionReserved) { continue; } if (!contact.Agent.CurrentState.IsSusceptible) { continue; } var transition = MultiStateModel.DetermineAgentInteractionTransition(agent, contact, RandomProvider); if (transition == null) { continue; } contact.Agent.TransitionReserved = true; _transitionsToApply.Add(new Tuple <TAgent, Transition <TAgent> >(contact.Agent, transition)); } } }
private void ModelMultiStateModelOnAgent(TAgent agent) { if (agent.TransitionReserved) { return; // This agent already had it's one transition for the day } var transition = MultiStateModel.DetermineWithinHostStateTransitions(agent, RandomProvider, _shuffleTransitions); if (transition == null) { return; } agent.TransitionReserved = true; _transitionsToApply.Add(new Tuple <TAgent, Transition <TAgent> >(agent, transition)); }
public void Initialize(MultiStateModel <TAgent> multiStateModel) { MultiStateModel = multiStateModel; }