예제 #1
0
        private List<double> GetUtilityValuesForDwellingType(
     HouseholdPersonComposite composite, SpatialZone curZ)
        {
            Household hhld = composite.getHousehold().CreateNewCopy();
            //String key = hhld.GetNewJointKey(GetDimensionName());
            //string[] curKeys = key.Split(Constants.CONDITIONAL_DELIMITER[0]);
            var currValues = new List<double>(3);
            int myNumOfCars = (int) hhld.GetNumOfCars();
            int dwellType = (int) hhld.GetDwellingType();
            int hhldSize = (int) hhld.GetHhldSize();

            currValues.Add(1);

            int oneCar = Convert.ToInt32(myNumOfCars == 1);
            int twoCars = Convert.ToInt32(myNumOfCars == 2);
            int threePlusCars = Convert.ToInt32(myNumOfCars >= 3);
            int oneAdult = Convert.ToInt32(hhldSize == 3);

            // doubt
            double z_apart = curZ.GetDwellingMarginals().GetValue("1");

            int oneAdultChildren = Convert.ToInt32(hhldSize == 1);
            int twoAdults = Convert.ToInt32(hhldSize == 2);
            int h_twentysix_2Plus = Convert.ToInt32(composite.Count_26 >= 2);
            int h_thirtyone_1 = Convert.ToInt32(composite.Count_31 == 1);
            int twoPlusAdults = Convert.ToInt32(hhldSize == 2 || hhldSize == 4);
            int h_eleven_1Plus = Convert.ToInt32(composite.Count_11 >= 1);
            int h_eighteen_2Plus = Convert.ToInt32(composite.Count_18 >= 2);
            int h_fortyone_1 = Convert.ToInt32(composite.Count_41 == 1);
            int h_fortyone_2Plus = Convert.ToInt32(composite.Count_41 >= 2);
            int h_eighteen_1 = Convert.ToInt32(composite.Count_18 == 1);
            int h_twentysix_1 = Convert.ToInt32(composite.Count_26 == 1);
            int h_fiftyone_1 = Convert.ToInt32(composite.Count_51 == 1);
            int h_thirtyone_2Plus = Convert.ToInt32(composite.Count_31 == 2);
            int h_fiftyfive_2Plus = Convert.ToInt32(composite.Count_55 == 2);
            int h_sixtyfivePlus_1 = Convert.ToInt32(composite.Count_65 == 1);
            int h_male_1 = Convert.ToInt32(composite.Count_male == 1);
            int h_male_2 = Convert.ToInt32(composite.Count_male == 2);
            int h_female_4Plus = Convert.ToInt32(composite.Count_female >= 4);
            int h_male_3 = Convert.ToInt32(composite.Count_male == 3);
            int h_male_4Plus = Convert.ToInt32(composite.Count_male >= 4);
            int h_female_1 = Convert.ToInt32(composite.Count_female == 1);
            int h_fiftyfive_1 = Convert.ToInt32(composite.Count_55 == 1);
            int h_FT_1 = Convert.ToInt32(composite.Count_full_time == 1);
            int h_homeFT_1Plus = Convert.ToInt32(composite.Count_full_time >= 1);
            int h_FT_2 = Convert.ToInt32(composite.Count_full_time == 2);
            int h_FT_3Plus = Convert.ToInt32(composite.Count_full_time >= 3);
            int h_eNE_3 = Convert.ToInt32(composite.Count_unemployed == 3);
            int h_homePT_1Plus = Convert.ToInt32(composite.Count_part_time_home >= 1);
            int h_eNE_1 = Convert.ToInt32(composite.Count_unemployed == 1);
            int h_eNE_2 = Convert.ToInt32(composite.Count_unemployed == 2);
            int h_eNE_4Plus = Convert.ToInt32(composite.Count_unemployed >= 4);
            int h_officeCler_1 = Convert.ToInt32(composite.Count_clerical_manufacturing == 1);
            int h_officeCler_2Plus = Convert.ToInt32(composite.Count_clerical_manufacturing >= 2);
            int h_manConst_1 = Convert.ToInt32(composite.Count_costruction_man == 1);
            int h_manConst_2Plus = Convert.ToInt32(composite.Count_costruction_man >= 2);
            int h_profMan_1 = Convert.ToInt32(composite.Count_professional_man == 1);
            int h_profMan_2Plus = Convert.ToInt32(composite.Count_professional_man >= 2);
            int h_retail_1 = Convert.ToInt32(composite.Count_retail == 1);
            int h_retail_2 = Convert.ToInt32(composite.Count_retail == 2);
            int h_retail_3Plus = Convert.ToInt32(composite.Count_retail >= 3);
            int h_lYes_1 = Convert.ToInt32(composite.Count_driving_license_yes == 1);
            int h_lYes_3 = Convert.ToInt32(composite.Count_driving_license_yes == 3);
            int h_lYes_4Plus = Convert.ToInt32(composite.Count_driving_license_yes >= 4);
            int h_lNo_1 = Convert.ToInt32(composite.Count_driving_license_no == 1);
            int h_lNo_2 = Convert.ToInt32(composite.Count_driving_license_no == 2);

            currValues.Add(Math.Exp(0.772 * 1.00 + -1.06 * oneCar + -2.30 * twoCars + -3.18 * threePlusCars
                + 4.04 * z_apart + -0.312 * oneAdult + 0.180 * oneAdultChildren + -0.375 * twoAdults
                + -0.396 * twoPlusAdults + 0.246 * h_eleven_1Plus + 0.672 * h_eighteen_1 + 1.15 * h_eighteen_2Plus
                + 0.688 * h_twentysix_1 + 1.16 * h_twentysix_2Plus + 0.641 * h_thirtyone_1 + 0.786 * h_thirtyone_2Plus
                + 0.227 * h_fortyone_1 + 0.391 * h_fortyone_2Plus + 0.117 * h_fiftyone_1 + 0.0771 * h_fiftyfive_1
                + -0.109 * h_fiftyfive_2Plus + -0.124 * h_sixtyfivePlus_1 + -0.131 * h_male_1
                + -0.184 * h_male_2 + -0.234 * h_male_3 + -0.227 * h_male_4Plus + 0.0740 * h_female_1
                + -0.269 * h_female_4Plus + -0.212 * h_FT_1 + -0.528 * h_FT_2 + -0.717 * h_FT_3Plus
                + -0.537 * h_homeFT_1Plus + -0.330 * h_homePT_1Plus + -0.560 * h_eNE_1 + -1.21 * h_eNE_2
                + -1.43 * h_eNE_3 + -1.62 * h_eNE_4Plus + -0.541 * h_officeCler_1 + -1.03 * h_officeCler_2Plus
                + -0.293 * h_manConst_1 + -0.618 * h_manConst_2Plus + -0.746 * h_profMan_1
                + -1.60 * h_profMan_2Plus + -0.315 * h_retail_1 + -0.671 * h_retail_2 + -1.21 * h_retail_3Plus
                + 0.168 * h_lYes_1 + -0.324 * h_lYes_3 + -0.675 * h_lYes_4Plus + -0.110 * h_lNo_1
                + -0.140 * h_lNo_2));

            // doubt
            double z_town = curZ.GetDwellingMarginals().GetValue("2");

            int h_zero_1 = Convert.ToInt32(composite.Count_less11 == 1);
            int h_zero_4Plus =Convert.ToInt32(composite.Count_less11 >= 4);
            int h_fiftyone_2Plus = Convert.ToInt32(composite.Count_51 >= 2);
            int h_PT_1 = Convert.ToInt32(composite.Count_part_time == 1);

             currValues.Add(Math.Exp(-1.33 * 1.00 + -0.351 * oneCar + -1.08 * twoCars + -1.93  * threePlusCars
                 + 11.8 * z_town + -0.747 * oneAdult + 0.429 * oneAdultChildren + -0.337  * twoAdults
                 + 0.172 * h_zero_1 + 0.347 * h_zero_4Plus +  0.212 * h_eleven_1Plus + 0.598 * h_eighteen_1
                 + 0.960 * h_eighteen_2Plus + 0.548 * h_twentysix_1 + 1.17 * h_twentysix_2Plus
                 + 0.506 * h_thirtyone_1 + 0.796 * h_thirtyone_2Plus + 0.273 * h_fortyone_1
                 + 0.388 * h_fortyone_2Plus + 0.143 * h_fiftyone_1 + 0.185 * h_fiftyone_2Plus
                 + 0.215 * h_fiftyfive_1 + -0.211 * h_sixtyfivePlus_1 + -0.375 * h_male_1
                 + -0.359 * h_male_2 + -0.392 * h_male_3 + -0.299 * h_male_4Plus
                 + -0.0706 * h_female_1 + 0.0664 * h_FT_1 + -0.161 * h_FT_3Plus + -0.274 * h_homeFT_1Plus
                 + -0.484 * h_eNE_1 + -0.951 * h_eNE_2 + -1.01 * h_eNE_3 + -1.07 * h_eNE_4Plus
                 + -0.100 * h_PT_1 + -0.160 * h_officeCler_1 + -0.564 * h_officeCler_2Plus
                 + -0.259 * h_manConst_1 + -0.511 * h_manConst_2Plus + -0.234 * h_profMan_1
                 + -0.651 * h_profMan_2Plus + -0.0924  * h_retail_1 + -0.310 * h_retail_2 + -0.625 * h_retail_3Plus
                 + 0.225 * h_lYes_1 + -0.395 * h_lYes_3 + -0.787 * h_lYes_4Plus + -0.176 * h_lNo_1
                 + -0.135 * h_lNo_2));

            return currValues;
        }