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 IterateOneDay() { var populationToSimulate = PopulationDynamics.EnumeratePopulation(); ApplyInterventions(); TakeCensus(populationToSimulate); UpdateContexts(RootContext); IterateAgentBehaviour(populationToSimulate); _transitionsToApply.Clear(); SimulateInfections(); IterateWithinHostMultiStateModel(populationToSimulate); foreach (var transit in _transitionsToApply) { ApplyTransitionToPerson(transit.Item1, transit.Item2); } DayCompleted(); Day++; }
protected LocalArea(string name, string fullName, string areaType, PopulationDynamics <T> environment) : base(name, fullName, areaType) { Environment = environment; }