예제 #1
0
        public static List<Adolescent> AdolescentList(CoreAMS.Enums.HealthState healthState, int count, string locationProbabilitiesFile)
        {
            List<Adolescent> adolescents = new List<Adolescent>();

            for (int i = 0; i < count; ++i)
                adolescents.Add(new Adolescent(GlobalAgentDescriptorTable.GetNewId, healthState, locationProbabilitiesFile));

            return adolescents;
        }
예제 #2
0
        public static List <Child> ChildList(CoreAMS.Enums.HealthState healthState, int count, string locationProbabilitiesFile)
        {
            List <Child> childrens = new List <Child>();

            for (int i = 0; i < count; ++i)
            {
                childrens.Add(new Child(GlobalAgentDescriptorTable.GetNewId, healthState, locationProbabilitiesFile));
            }

            return(childrens);
        }
예제 #3
0
        public static List <Youngster> YoungsterList(CoreAMS.Enums.HealthState healthState, int count, string locationProbabilitiesFile)
        {
            List <Youngster> youngsters = new List <Youngster>();

            for (int i = 0; i < count; ++i)
            {
                youngsters.Add(new Youngster(GlobalAgentDescriptorTable.GetNewId, healthState, locationProbabilitiesFile));
            }

            return(youngsters);
        }
예제 #4
0
        public Child(int Id, CoreAMS.Enums.HealthState healthState, string locationProbabilitiesDir)
            : base(Id, healthState, locationProbabilitiesDir + "/LPChild.csv")
        {
            //int st = 10;
            //int et = 13;
            //Hospital h1 = new Hospital(0.6, 1000.0);

            //var key = new LocationProbabilitiesKey() {
            //    startTime = st,
            //    endTime = et,
            //    container = h1
            //};
            //double pr = locationProbabilities[key];
        }
예제 #5
0
파일: Person.cs 프로젝트: kutemba0580/MAS
        private int infectedOtherAgentTime = 1; // частота заражения других людей (например, заражать кого-либо каждый час)

        // создаётся агент, которому задаются ID, состояние здоровья
        public Person(int Id, CoreAMS.Enums.HealthState healthState, string locationProbabilitiesFile)
        {
            this.Id          = Id;
            this.healthState = healthState;
            this.state       = Enums.AgentState.Stop;

            // в зависимости от начального состояния агента мы устанавливаем время, когда агент
            // перейдет в следующее состояние
            switch (healthState)
            {
            case Enums.HealthState.Infectious:
                changeTime = infectiousTime;
                break;

            case Enums.HealthState.Exposed:
                changeTime = exposedTime;
                break;

            case Enums.HealthState.Recovered:
                changeTime = recoveredTime;
                break;
            }

            string[] rowValues = null;
            string[] rows      = File.ReadAllLines(locationProbabilitiesFile);
            for (int i = 0; i < rows.Length; i++)
            {
                if (!String.IsNullOrEmpty(rows[i]))
                {
                    rowValues = rows[i].Split(',');
                    LocationProbabilitiesKey key = new LocationProbabilitiesKey()
                    {
                        startTime     = Int32.Parse(rowValues[0]),
                        endTime       = Int32.Parse(rowValues[1]),
                        containerType = (Enums.ContainerType)Int32.Parse(rowValues[2])
                    };
                    this.locationProbabilities.Add(key, (double)Decimal.Parse(rowValues[3], CultureInfo.InvariantCulture));
                }
            }
        }
예제 #6
0
파일: Adult.cs 프로젝트: kutemba0580/MAS
 public Adult(int Id, CoreAMS.Enums.HealthState healthState, string locationProbabilitiesDir)
     : base(Id, healthState, locationProbabilitiesDir + "/Adult.csv")
 {
 }
예제 #7
0
파일: Person.cs 프로젝트: kutemba0580/MAS
 protected void SetHealthState(CoreAMS.Enums.HealthState healthState)
 {
     this.healthState = healthState;
 }
예제 #8
0
 public Youngster(int Id, CoreAMS.Enums.HealthState healthState, string locationProbabilitiesDir)
     : base(Id, healthState, locationProbabilitiesDir + "/Youngster.csv")
 {
 }