コード例 #1
0
ファイル: ModelDistribution.cs プロジェクト: AnsBal/Simpsynz_
        private List<KeyValPair> ComputeHouseholdTypeCommulative(HouseholdPersonComposite composite)
        {
            double comVal = 0.00;
            var comList = new List<KeyValPair>();
            var valList = GetUtilityValuesForHouseholdType(composite);
            KeyValPair currPair = new KeyValPair();
            double utilSum = (double)valList[0] + (double)valList[1]
                                     + (double)valList[2]
                                     + (double)valList[3]
                                     + (double)valList[4]
                                     + (double)valList[5];
            currPair.Category = "0";//IncomeLevel.SingleAdult.ToString();
            currPair.Value = (double)valList[0] / utilSum;
            comVal = currPair.Value;
            comList.Add(currPair);

            currPair = new KeyValPair();
            currPair.Category = "1";//IncomeLevel.OneAdultOneChild.ToString();
            currPair.Value = comVal + (double)valList[1] / utilSum;
            comVal = currPair.Value;
            comList.Add(currPair);

            currPair = new KeyValPair();
            currPair.Category = "2";//IncomeLevel.Twoadults.ToString();
            currPair.Value = comVal + (double)valList[2] / utilSum;
            comVal = currPair.Value;
            comList.Add(currPair);

            currPair = new KeyValPair();
            currPair.Category = "3";//IncomeLevel.TwoAdultsChildren.ToString();
            currPair.Value = comVal + (double)valList[3] / utilSum;
            comVal = currPair.Value;
            comList.Add(currPair);

            currPair = new KeyValPair();
            currPair.Category = "4";//IncomeLevel.ThreeOrMoreAdults.ToString();
            currPair.Value = comVal + (double)valList[4] / utilSum;
            comList.Add(currPair);

            currPair = new KeyValPair();
            currPair.Category = "5";//IncomeLevel.ThreeOrMoreAdultsChildren.ToString();
            currPair.Value = comVal + (double)valList[5] / utilSum;
            comList.Add(currPair);
            return comList;
        }
コード例 #2
0
ファイル: World.cs プロジェクト: Nasterska/Simpsynz_
        public static void ComputeSectorLevelStatistics(string poplFile, int sectIndx,
                                int dimIndx, int catCnt)
        {
            using (StreamReader currReader = new StreamReader(poplFile))
            using (StreamWriter currOutputFile = new
                StreamWriter(Constants.DATA_DIR
                            + "SectorStatistics" + dimIndx + ".csv"))
            {
                Hashtable currDimension = new Hashtable();

                string currHhld;
                currReader.ReadLine();
                for (int i = 1001; i < 5946; i++)
                {
                    currDimension.Add(i.ToString(), new Hashtable());
                }
                while (!currReader.EndOfStream)
                {
                    currHhld = currReader.ReadLine();
                    string[] currHhldTok = currHhld.Split(',');
                    string currsector = currHhldTok[sectIndx];
                    /*if (currDimension.Contains(currsector))
                    {*/
                    Hashtable currData = (Hashtable)currDimension[currsector];
                    if (currData.Contains(currHhldTok[dimIndx]))
                    {
                        KeyValPair currStat = (KeyValPair)
                            currData[currHhldTok[dimIndx]];
                        currStat.Value++;
                        currData[currHhldTok[dimIndx]] = currStat;
                        currDimension[currsector] = currData;
                    }
                    else
                    {
                        KeyValPair currStat = new KeyValPair();
                        currStat.Category = currHhldTok[dimIndx];
                        currStat.Value = 1;
                        Hashtable currCat = (Hashtable)
                                currDimension[currsector];
                        currCat.Add(currStat.Category, currStat);
                        currDimension[currsector] = currCat;
                    }
                    /*}
                    else
                    {
                        Hashtable currCat = new Hashtable();
                        KeyValPair currStat = new KeyValPair();
                        currStat.category = currHhldTok[dimIndx];
                        currStat.value = 1;
                        currCat.Add(currStat.category, currStat);
                        currDimension.Add(currsector, currCat);
                    }*/
                }
                string firstRow = "Sector";
                for (int i = 0; i < catCnt; i++)
                {
                    firstRow += "," + i.ToString();
                }
                currOutputFile.WriteLine(firstRow);
                foreach (DictionaryEntry ent in currDimension)
                {
                    Hashtable catEnt = (Hashtable)ent.Value;
                    string curString = (string)ent.Key;
                    for (int i = 0; i < catCnt; i++)
                    {
                        if (catEnt.Contains(i.ToString()))
                        {
                            KeyValPair curSt = (KeyValPair)catEnt[i.ToString()];
                            curString += "," +
                                ((int)curSt.Value).ToString();
                        }
                        else
                        {
                            curString += ",0";
                        }
                    }
                    currOutputFile.WriteLine(curString);
                }
            }
        }
コード例 #3
0
ファイル: ModelDistribution.cs プロジェクト: AnsBal/Simpsynz_
        private List<KeyValPair> ComputeEducationCommulative(HouseholdPersonComposite composite,
                                          SpatialZone curZ)
        {
            double comVal = 0.00;
            var comList = new List<KeyValPair>();
            var valList = GetUtilityValuesForEducation(composite, curZ);
            double utilSum = (double)valList[0] + (double)valList[1]
                         + (double)valList[2];
            KeyValPair currPair = new KeyValPair();
            currPair.Category = "0";//NumWithUnivDeg.None.ToString();
            currPair.Value = (double)valList[0] / utilSum;
            comVal = currPair.Value;
            comList.Add(currPair);

            currPair = new KeyValPair();
            currPair.Category = "1";//NumWithUnivDeg.One.ToString();
            currPair.Value = comVal + (double)valList[1] / utilSum;
            comVal = currPair.Value;
            comList.Add(currPair);

            currPair = new KeyValPair();
            currPair.Category = "2";//NumWithUnivDeg.TwoOrMore.ToString();
            currPair.Value = comVal + (double)valList[2] / utilSum;
            comList.Add(currPair);
            return comList;
        }
コード例 #4
0
ファイル: ModelDistribution.cs プロジェクト: AnsBal/Simpsynz_
        private List<KeyValPair> ComputeEmploymentStatusCommulative(Person person)
        {
            double comVal = 0.00;
            var comList = new List<KeyValPair>();
            var valList = GetUtilityValuesForEmploymentStatus(person);
            KeyValPair currPair = new KeyValPair();
            double utilSum = (double)valList[0] + (double)valList[1]
                                     + (double)valList[2]
                                     + (double)valList[3]
                                     + (double)valList[4];
            currPair.Category = "0";//IncomeLevel.Unemployed.ToString();
            currPair.Value = (double)valList[0] / utilSum;
            comVal = currPair.Value;
            comList.Add(currPair);

            currPair = new KeyValPair();
            currPair.Category = "1";//IncomeLevel.FullTime.ToString();
            currPair.Value = comVal + (double)valList[1] / utilSum;
            comVal = currPair.Value;
            comList.Add(currPair);

            currPair = new KeyValPair();
            currPair.Category = "2";//IncomeLevel.FullTimeHome.ToString();
            currPair.Value = comVal + (double)valList[2] / utilSum;
            comVal = currPair.Value;
            comList.Add(currPair);

            currPair = new KeyValPair();
            currPair.Category = "3";//IncomeLevel.PartTime.ToString();
            currPair.Value = comVal + (double)valList[3] / utilSum;
            comVal = currPair.Value;
            comList.Add(currPair);

            currPair = new KeyValPair();
            currPair.Category = "4";//IncomeLevel.PartTimeHome.ToString();
            currPair.Value = comVal + (double)valList[4] / utilSum;
            comList.Add(currPair);

            return comList;
        }
コード例 #5
0
ファイル: ModelDistribution.cs プロジェクト: AnsBal/Simpsynz_
        private List<KeyValPair> ComputeDriverLisenceCommulative(Person person)
        {
            double comVal = 0.00;
            var comList = new List<KeyValPair>();
            var valList = GetUtilityValuesForDriverLicense(person);
            KeyValPair currPair = new KeyValPair();
            double utilSum = (double)valList[0] + (double)valList[1];
            currPair.Category = "0";//IncomeLevel.yes.ToString();
            currPair.Value = (double)valList[0] / utilSum;
            comVal = currPair.Value;
            comList.Add(currPair);

            currPair = new KeyValPair();
            currPair.Category = "1";//IncomeLevel.no.ToString();
            currPair.Value = comVal + (double)valList[1] / utilSum;
            comVal = currPair.Value;
            comList.Add(currPair);

            return comList;
        }
コード例 #6
0
ファイル: ModelDistribution.cs プロジェクト: AnsBal/Simpsynz_
        private List<KeyValPair> ComputeDwellingTypeCommulative(
            HouseholdPersonComposite composite, SpatialZone curZ)
        {
            double comVal = 0.00;
            var comList = new List<KeyValPair>();
            var valList = GetUtilityValuesForDwellingType(composite, curZ);
            KeyValPair currPair = new KeyValPair();
            double utilSum = (double)valList[0] + (double)valList[1]
                                     + (double)valList[2];
            currPair.Category = "0";//IncomeLevel.House.ToString();
            currPair.Value = (double)valList[0] / utilSum;
            comVal = currPair.Value;
            comList.Add(currPair);

            currPair = new KeyValPair();
            currPair.Category = "1";//IncomeLevel.Apartment.ToString();
            currPair.Value = comVal + (double)valList[1] / utilSum;
            comVal = currPair.Value;
            comList.Add(currPair);

            currPair = new KeyValPair();
            currPair.Category = "2";//IncomeLevel.Townhouse.ToString();
            currPair.Value = comVal + (double)valList[2] / utilSum;
            comVal = currPair.Value;
            comList.Add(currPair);

            return comList;
        }
コード例 #7
0
ファイル: ModelDistribution.cs プロジェクト: AnsBal/Simpsynz_
        private List<KeyValPair> ComputePublicTransitPassCommulative(HouseholdPersonComposite composite)
        {
            double comVal = 0.00;
            var comList = new List<KeyValPair>();
            var valList = GetUtilityValuesForPublicTransitPass(composite);
            KeyValPair currPair = new KeyValPair();
            double utilSum = (double)valList[0] + (double)valList[1]
                                     + (double)valList[2]
                                     + (double)valList[3]
                                     + (double)valList[4]
                                     + (double)valList[5];
            currPair.Category = "0";//IncomeLevel.None.ToString();
            currPair.Value = (double)valList[0] / utilSum;
            comVal = currPair.Value;
            comList.Add(currPair);

            currPair = new KeyValPair();
            currPair.Category = "1";//IncomeLevel.MetroPass.ToString();
            currPair.Value = comVal + (double)valList[1] / utilSum;
            comVal = currPair.Value;
            comList.Add(currPair);

            currPair = new KeyValPair();
            currPair.Category = "2";//IncomeLevel.GOTransitPass.ToString();
            currPair.Value = comVal + (double)valList[2] / utilSum;
            comVal = currPair.Value;
            comList.Add(currPair);

            currPair = new KeyValPair();
            currPair.Category = "3";//IncomeLevel.ComboOrDualPass.ToString();
            currPair.Value = comVal + (double)valList[3] / utilSum;
            comVal = currPair.Value;
            comList.Add(currPair);

            currPair = new KeyValPair();
            currPair.Category = "4";//IncomeLevel.OtherAgencyPass.ToString();
            currPair.Value = comVal + (double)valList[4] / utilSum;
            comList.Add(currPair);

            currPair = new KeyValPair();
            currPair.Category = "5";//IncomeLevel.Unknown.ToString();
            currPair.Value = comVal + (double)valList[5] / utilSum;
            comList.Add(currPair);

            return comList;
        }
コード例 #8
0
ファイル: ModelDistribution.cs プロジェクト: AnsBal/Simpsynz_
        private List<KeyValPair> ComputeCarCommulative(HouseholdPersonComposite composite,
                                          SpatialZone curZ)
        {
            double comVal = 0.00;
            var comList = new List<KeyValPair>();
            var valList = GetUtilityValuesForCar(composite, curZ);
            double utilSum = (double)valList[0] + (double)valList[1]
                         + (double)valList[2] + (double)valList[3];
            KeyValPair currPair = new KeyValPair();
            currPair.Category = "0";//No Car
            currPair.Value = (double)valList[0] / utilSum;
            comVal = currPair.Value;
            comList.Add(currPair);

            currPair = new KeyValPair();
            currPair.Category = "1";//1 Car
            currPair.Value = comVal + (double)valList[1] / utilSum;
            comVal = currPair.Value;
            comList.Add(currPair);

            currPair = new KeyValPair();
            currPair.Category = "2"; //2 Cars
            currPair.Value = comVal + (double)valList[2] / utilSum;
            comVal = currPair.Value;
            comList.Add(currPair);

            currPair = new KeyValPair();
            currPair.Category = "3"; //3 or more Cars
            currPair.Value = comVal + (double)valList[3] / utilSum;
            comList.Add(currPair);

            return comList;
        }
コード例 #9
0
ファイル: ModelDistribution.cs プロジェクト: AnsBal/Simpsynz_
        private List<KeyValPair> ComputeAgeCommulative(Person person)
        {
            double comVal = 0.00;
            var comList = new List<KeyValPair>();
            var valList = GetUtilityValuesForAge(person);
            KeyValPair currPair = new KeyValPair();
            double utilSum = (double)valList[0] + (double)valList[1]
                                     + (double)valList[2]
                                     + (double)valList[3]
                                     + (double)valList[4]
                                     + (double)valList[5]
                                     + (double)valList[6]
                                     + (double)valList[7]
                                     + (double)valList[8]
                                     + (double)valList[9]
                                     + (double)valList[10];
            currPair.Category = "0";//IncomeLevel.LessThanEleven.ToString();
            currPair.Value = (double)valList[0] / utilSum;
            comVal = currPair.Value;
            comList.Add(currPair);

            currPair = new KeyValPair();
            currPair.Category = "1";//IncomeLevel.ElevenToThirteen.ToString();
            currPair.Value = comVal + (double)valList[1] / utilSum;
            comVal = currPair.Value;
            comList.Add(currPair);

            currPair = new KeyValPair();
            currPair.Category = "2";//IncomeLevel.FourteenToFifteen.ToString();
            currPair.Value = comVal + (double)valList[2] / utilSum;
            comVal = currPair.Value;
            comList.Add(currPair);

            currPair = new KeyValPair();
            currPair.Category = "3";//IncomeLevel.SixteenToSeventeen.ToString();
            currPair.Value = comVal + (double)valList[3] / utilSum;
            comVal = currPair.Value;
            comList.Add(currPair);

            currPair = new KeyValPair();
            currPair.Category = "4";//IncomeLevel.EighteenToTwentyFive.ToString();
            currPair.Value = comVal + (double)valList[4] / utilSum;
            comList.Add(currPair);

            currPair = new KeyValPair();
            currPair.Category = "5";//IncomeLevel.TwentySixToThirty.ToString();
            currPair.Value = comVal + (double)valList[5] / utilSum;
            comList.Add(currPair);

            currPair = new KeyValPair();
            currPair.Category = "6";//IncomeLevel.ThirtyOneToForty.ToString();
            currPair.Value = comVal + (double)valList[6] / utilSum;
            comList.Add(currPair);

            currPair = new KeyValPair();
            currPair.Category = "7";//IncomeLevel.FortyOneToFifty.ToString();
            currPair.Value = comVal + (double)valList[7] / utilSum;
            comList.Add(currPair);

            currPair = new KeyValPair();
            currPair.Category = "8";//IncomeLevel.FiftyOneToFiftyFour.ToString();
            currPair.Value = comVal + (double)valList[8] / utilSum;
            comList.Add(currPair);

            currPair = new KeyValPair();
            currPair.Category = "9";//IncomeLevel.FiftyfiveToSixtyFour.ToString();
            currPair.Value = comVal + (double)valList[9] / utilSum;
            comList.Add(currPair);

            currPair = new KeyValPair();
            currPair.Category = "10";//IncomeLevel.MoreThanSixtyFive.ToString();
            currPair.Value = comVal + (double)valList[10] / utilSum;
            comList.Add(currPair);

            return comList;
        }
コード例 #10
0
ファイル: ModelDistribution.cs プロジェクト: AnsBal/Simpsynz_
        private List<KeyValPair> ComputeOccupationCommulative(Person person, SpatialZone curZ)
        {
            double comVal = 0.00;
            var comList = new List<KeyValPair>();
            var valList = GetUtilityValuesForOccupation(person, curZ);
            KeyValPair currPair = new KeyValPair();
            double utilSum = (double)valList[0] + (double)valList[1]
                                     + (double)valList[2]
                                     + (double)valList[3]
                                     + (double)valList[4];
            currPair.Category = "0";//IncomeLevel.GeneralOffice.ToString();
            currPair.Value = (double)valList[0] / utilSum;
            comVal = currPair.Value;
            comList.Add(currPair);

            currPair = new KeyValPair();
            currPair.Category = "1";//IncomeLevel.ClericalManufacturing.ToString();
            currPair.Value = comVal + (double)valList[1] / utilSum;
            comVal = currPair.Value;
            comList.Add(currPair);

            currPair = new KeyValPair();
            currPair.Category = "2";//IncomeLevel.Construction.ToString();
            currPair.Value = comVal + (double)valList[2] / utilSum;
            comVal = currPair.Value;
            comList.Add(currPair);

            currPair = new KeyValPair();
            currPair.Category = "3";//IncomeLevel.TradesProfessional.ToString();
            currPair.Value = comVal + (double)valList[3] / utilSum;
            comVal = currPair.Value;
            comList.Add(currPair);

            currPair = new KeyValPair();
            currPair.Category = "4";//IncomeLevel.Management.ToString();
            currPair.Value = comVal + (double)valList[4] / utilSum;
            comList.Add(currPair);

            return comList;
        }
コード例 #11
0
ファイル: ModelDistribution.cs プロジェクト: AnsBal/Simpsynz_
        private List<KeyValPair> ComputeNumberOfVehiclesCommulative(
            HouseholdPersonComposite composite, SpatialZone curZ)
        {
            double comVal = 0.00;
            var comList = new List<KeyValPair>();
            var valList = GetUtilityValuesForNumberOfVehicles(composite, curZ);
            KeyValPair currPair = new KeyValPair();
            double utilSum = (double)valList[0] + (double)valList[1]
                                     + (double)valList[2]
                                     + (double)valList[3];
            currPair.Category = "0";//IncomeLevel.None.ToString();
            currPair.Value = (double)valList[0] / utilSum;
            comVal = currPair.Value;
            comList.Add(currPair);

            currPair = new KeyValPair();
            currPair.Category = "1";//IncomeLevel.One.ToString();
            currPair.Value = comVal + (double)valList[1] / utilSum;
            comVal = currPair.Value;
            comList.Add(currPair);

            currPair = new KeyValPair();
            currPair.Category = "2";//IncomeLevel.Two.ToString();
            currPair.Value = comVal + (double)valList[2] / utilSum;
            comVal = currPair.Value;
            comList.Add(currPair);

            currPair = new KeyValPair();
            currPair.Category = "3";//IncomeLevel.Three.ToString();
            currPair.Value = comVal + (double)valList[3] / utilSum;
            comVal = currPair.Value;
            comList.Add(currPair);

            return comList;
        }
コード例 #12
0
ファイル: ModelDistribution.cs プロジェクト: AnsBal/Simpsynz_
        private List<KeyValPair> ComputeIncomeCommulative(HouseholdPersonComposite composite,
                                          SpatialZone curZ)
        {
            double comVal = 0.00;
            var comList = new List<KeyValPair>();
            var valList = GetUtilityValuesForIncome(composite, curZ);
            KeyValPair currPair = new KeyValPair();
            double utilSum = (double)valList[0] + (double)valList[1]
                                     + (double)valList[2]
                                     + (double)valList[3]
                                     + (double)valList[4];
            currPair.Category = "0";//IncomeLevel.ThirtyOrLess.ToString();
            currPair.Value = (double)valList[0] / utilSum;
            comVal = currPair.Value;
            comList.Add(currPair);

            currPair = new KeyValPair();
            currPair.Category = "1";//IncomeLevel.ThirtyToSevetyFive.ToString();
            currPair.Value = comVal + (double)valList[1] / utilSum;
            comVal = currPair.Value;
            comList.Add(currPair);

            currPair = new KeyValPair();
            currPair.Category = "2";//IncomeLevel.SeventyFiveToOneTwentyFive.ToString();
            currPair.Value = comVal + (double)valList[2] / utilSum;
            comVal = currPair.Value;
            comList.Add( currPair);

            currPair = new KeyValPair();
            currPair.Category = "3";//IncomeLevel.OneTwentyFiveToTwoHundred.ToString();
            currPair.Value = comVal + (double)valList[3] / utilSum;
            comVal = currPair.Value;
            comList.Add(currPair);

            currPair = new KeyValPair();
            currPair.Category = "4";//IncomeLevel.TwohundredOrMore.ToString();
            currPair.Value = comVal + (double)valList[4] / utilSum;
            comList.Add(currPair);
            return comList;
        }
コード例 #13
0
        private void WriteNextConditional(string currStr)
        {
            string[] currVal = currStr.Split(Constants.COLUMN_DELIMETER[0]);

            for(int i = 0; i < currVal.Length; i++)
            {
                var currDimColl = CondCollection[DimenionNames[i][0]];
                string currCondNm = currVal[i] +
                    Constants.CATEGORY_DELIMITER;
                for(int j = 0; j < currVal.Length; j++)
                {
                    if(i != j)
                    {
                        currCondNm = currCondNm + currVal[j]
                            + Constants.CONDITIONAL_DELIMITER;
                    }
                }
                currCondNm = currCondNm.Substring(0, currCondNm.Length - 1);
                KeyValPair currentValue;
                if(currDimColl.TryGetValue(currCondNm, out currentValue))
                {
                    currentValue.Value++;
                    currDimColl[currCondNm] = currentValue;
                }
                else
                {
                    KeyValPair curPair = new KeyValPair();
                    curPair.Value = 1;
                    curPair.Category = currCondNm;
                    currDimColl.Add(currCondNm, curPair);
                }
            }
        }
コード例 #14
0
        private void CreateCategoryCombinations(int idx)
        {
            int dimCnt = 1;
            string curDimNm = DimenionNames[idx][0];
            foreach(var curDim in DimenionNames)
            {
                dimCnt *= ((curDim).Count - 1);
            }

            string[] combStr = new string[dimCnt];
            int offset = 0;
            for(int i = 1; i < DimenionNames[idx].Count;
                i++)
            {
                for(int j = 0; j <
                    dimCnt / (DimenionNames[idx].Count - 1)
                    ; j++)
                {
                    combStr[j + offset] =
                        DimenionNames[idx][i]
                        + Constants.CATEGORY_DELIMITER;
                }
                offset += dimCnt /
                    (DimenionNames[idx].Count - 1);
            }

            offset = dimCnt /
                    (DimenionNames[idx].Count - 1);

            for(int i = 0; i < DimenionNames.Count; i++)
            {
                if(i != idx)
                {
                    AppendDimensions(combStr, i, offset);
                    offset /= (DimenionNames[i].Count - 1);
                }
            }

            var currDimColl = CondCollection[DimenionNames[idx][0]];

            foreach(string curStr in combStr)
            {
                KeyValPair currKey = new KeyValPair();
                currKey.Category = curStr.Substring(0, curStr.Length - 1);
                currKey.Value = 0;
                currDimColl.Add(currKey.Category, currKey);
            }
        }
コード例 #15
0
        private List<KeyValPair> ComputeDwellingCommulative(string procdKey,
                                  SpatialZone curZ)
        {
            double comVal = 0.00;
            var comList = new List<KeyValPair>();
            var valList = GetUtilityValuesForDwelling(procdKey, curZ);
            double utilSum = (double)valList[0] + (double)valList[1]
                         + (double)valList[2] + (double)valList[3];
            KeyValPair currPair = new KeyValPair();
            currPair.Category = "0";//Seperate
            currPair.Value = (double)valList[0] / utilSum;
            comVal = currPair.Value;
            comList.Add(currPair);

            currPair = new KeyValPair();
            currPair.Category = "1";//Semi detached
            currPair.Value = comVal + (double)valList[1] / utilSum;
            comVal = currPair.Value;
            comList.Add(currPair);

            currPair = new KeyValPair();
            currPair.Category = "2"; //Attached
            currPair.Value = comVal + (double)valList[2] / utilSum;
            comVal = currPair.Value;
            comList.Add(currPair);

            currPair = new KeyValPair();
            currPair.Category = "3"; //Apartment
            currPair.Value = comVal + (double)valList[3] / utilSum;

            comList.Add(currPair);

            return comList;
        }