Exemple #1
0
        public ArrayList GetHouseholdPoolForClonning(string fileName)
        {
            ArrayList currArrayList = new ArrayList();
            ArrayList currPool = new ArrayList();
            using (var currReader = new InputDataReader(Constants.DATA_DIR + "Household\\SyntheticHhld.csv"))
            {
                RandomNumberGen currRand = new RandomNumberGen();
                while (currReader.LoadZonalPopulationPoolByType
                    (currPool, "3") == true)
                {
                    if (currArrayList.Count > 60000)
                    {
                        return currArrayList;
                    }

                    if (currPool.Count > 0)
                    {
                        int numB = (int)Math.Ceiling((currPool.Count * 0.1));
                        ArrayList curDrw = currRand.GetNNumbersInRange(
                                                0, currPool.Count - 1, (numB));
                        if (curDrw.Count > 0)
                        {
                            for (int i = 0; i < numB; i++)
                            {
                                currArrayList.Add(currPool[(int)curDrw[i]]);
                            }
                        }
                    }
                    currPool.Clear();
                }
            }
            return currArrayList;
        }