예제 #1
0
        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));
                }
            }
        }
예제 #2
0
        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++;
        }
예제 #3
0
 protected LocalArea(string name, string fullName, string areaType, PopulationDynamics <T> environment)
     : base(name, fullName, areaType)
 {
     Environment = environment;
 }