Skip to content

Commit

Permalink
Merge pull request #16 from ActivitySim/veh_allocation_sh_compile_fix
Browse files Browse the repository at this point in the history
Integer encoding vehicle allocation spec
  • Loading branch information
jpn-- authored Jul 18, 2024
2 parents a3da8bd + c3efd7a commit e768c08
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 84 deletions.
152 changes: 76 additions & 76 deletions ext-configs/vehicle_allocation.csv
Original file line number Diff line number Diff line change
Expand Up @@ -5,97 +5,97 @@ util_alt2_unavail,Household does not own vehicle,"veh_num2.isna() | (veh_num2 ==
util_alt3_unavail,Household does not own vehicle,"veh_num3.isna() | (veh_num3 == '')",0,0,coef_unavail,0,0
util_alt4_unavail,Household does not own vehicle,"veh_num4.isna() | (veh_num4 == '')",0,0,0,coef_unavail,0
#,BEV Range,,,,
util_dstgtrng1,Round trip tour distance > BEV range,"@np.where((df.tot_tour_dist > df.Range_1) & (df.fuel_type_1 == 'BEV'), 1, 0)",coef_dstgtrng,0,0,0,0
util_dstgtrng2,Round trip tour distance > BEV range,"@np.where((df.tot_tour_dist > df.Range_2) & (df.fuel_type_2 == 'BEV'), 1, 0)",0,coef_dstgtrng,0,0,0
util_dstgtrng3,Round trip tour distance > BEV range,"@np.where((df.tot_tour_dist > df.Range_3) & (df.fuel_type_3 == 'BEV'), 1, 0)",0,0,coef_dstgtrng,0,0
util_dstgtrng4,Round trip tour distance > BEV range,"@np.where((df.tot_tour_dist > df.Range_4) & (df.fuel_type_4 == 'BEV'), 1, 0)",0,0,0,coef_dstgtrng,0
util_dstgtrng1,Round trip tour distance > BEV range,"@np.where((df.tot_tour_dist > df.Range_1) & (df.fuel_type_1 == 1), 1, 0)",coef_dstgtrng,0,0,0,0
util_dstgtrng2,Round trip tour distance > BEV range,"@np.where((df.tot_tour_dist > df.Range_2) & (df.fuel_type_2 == 1), 1, 0)",0,coef_dstgtrng,0,0,0
util_dstgtrng3,Round trip tour distance > BEV range,"@np.where((df.tot_tour_dist > df.Range_3) & (df.fuel_type_3 == 1), 1, 0)",0,0,coef_dstgtrng,0,0
util_dstgtrng4,Round trip tour distance > BEV range,"@np.where((df.tot_tour_dist > df.Range_4) & (df.fuel_type_4 == 1), 1, 0)",0,0,0,coef_dstgtrng,0
#,Vehicles & Driver interactions,,,,
util_vehltdr_nh,Vehicles < Drivers -- Non-Household Vehicle,"hh_veh_lt_drivers",0,0,0,0,coef_vehltdr_nh
util_vehltdr_nh,Vehicles > Drivers -- Non-Household Vehicle,"hh_veh_gt_drivers",0,0,0,0,coef_vehgtdr_nh
util_vehltdr_van1,Vehicles > Drivers -- Van alt 1,"hh_veh_gt_drivers * (body_type_1 == 'Van')",coef_vehltdr_van,0,0,0,0
util_vehltdr_van2,Vehicles > Drivers -- Van alt 2,"hh_veh_gt_drivers * (body_type_2 == 'Van')",0,coef_vehltdr_van,0,0,0
util_vehltdr_van3,Vehicles > Drivers -- Van alt 3,"hh_veh_gt_drivers * (body_type_3 == 'Van')",0,0,coef_vehltdr_van,0,0
util_vehltdr_van4,Vehicles > Drivers -- Van alt 4,"hh_veh_gt_drivers * (body_type_4 == 'Van')",0,0,0,coef_vehltdr_van,0
util_vehltdr_suv1,Vehicles > Drivers -- SUV alt 1,"hh_veh_gt_drivers * (body_type_1 == 'SUV')",coef_vehltdr_suv,0,0,0,0
util_vehltdr_suv2,Vehicles > Drivers -- SUV alt 2,"hh_veh_gt_drivers * (body_type_2 == 'SUV')",0,coef_vehltdr_suv,0,0,0
util_vehltdr_suv3,Vehicles > Drivers -- SUV alt 3,"hh_veh_gt_drivers * (body_type_3 == 'SUV')",0,0,coef_vehltdr_suv,0,0
util_vehltdr_suv4,Vehicles > Drivers -- SUV alt 4,"hh_veh_gt_drivers * (body_type_4 == 'SUV')",0,0,0,coef_vehltdr_suv,0
util_vehltdr_pu1,Vehicles > Drivers -- Pickup alt 1,"hh_veh_gt_drivers * (body_type_1 == 'Pickup')",coef_vehltdr_pu,0,0,0,0
util_vehltdr_pu2,Vehicles > Drivers -- Pickup alt 2,"hh_veh_gt_drivers * (body_type_2 == 'Pickup')",0,coef_vehltdr_pu,0,0,0
util_vehltdr_pu3,Vehicles > Drivers -- Pickup alt 3,"hh_veh_gt_drivers * (body_type_3 == 'Pickup')",0,0,coef_vehltdr_pu,0,0
util_vehltdr_pu4,Vehicles > Drivers -- Pickup alt 4,"hh_veh_gt_drivers * (body_type_4 == 'Pickup')",0,0,0,coef_vehltdr_pu,0
util_vehltdr_mc1,Vehicles > Drivers -- Motorcycle alt 1,"hh_veh_gt_drivers * (body_type_1 == 'Motorcycle')",coef_vehltdr_mc,0,0,0,0
util_vehltdr_mc2,Vehicles > Drivers -- Motorcycle alt 2,"hh_veh_gt_drivers * (body_type_2 == 'Motorcycle')",0,coef_vehltdr_mc,0,0,0
util_vehltdr_mc3,Vehicles > Drivers -- Motorcycle alt 3,"hh_veh_gt_drivers * (body_type_3 == 'Motorcycle')",0,0,coef_vehltdr_mc,0,0
util_vehltdr_mc4,Vehicles > Drivers -- Motorcycle alt 4,"hh_veh_gt_drivers * (body_type_4 == 'Motorcycle')",0,0,0,coef_vehltdr_mc,0
util_vehltdr_hyb1,Vehicles > Drivers -- Hybrid alt 1,"hh_veh_gt_drivers * (fuel_type_1 == 'Hybrid')",coef_vehltdr_hyb,0,0,0,0
util_vehltdr_hyb2,Vehicles > Drivers -- Hybrid alt 2,"hh_veh_gt_drivers * (fuel_type_2 == 'Hybrid')",0,coef_vehltdr_hyb,0,0,0
util_vehltdr_hyb3,Vehicles > Drivers -- Hybrid alt 3,"hh_veh_gt_drivers * (fuel_type_3 == 'Hybrid')",0,0,coef_vehltdr_hyb,0,0
util_vehltdr_hyb4,Vehicles > Drivers -- Hybrid alt 4,"hh_veh_gt_drivers * (fuel_type_4 == 'Hybrid')",0,0,0,coef_vehltdr_hyb,0
util_vehltdr_ev1,Vehicles > Drivers -- Hybrid alt 1,"hh_veh_gt_drivers * ((fuel_type_1=='PEV') | (fuel_type_1=='BEV'))",coef_vehltdr_ev,0,0,0,0
util_vehltdr_ev2,Vehicles > Drivers -- Hybrid alt 2,"hh_veh_gt_drivers * ((fuel_type_2=='PEV') | (fuel_type_2=='BEV'))",0,coef_vehltdr_ev,0,0,0
util_vehltdr_ev3,Vehicles > Drivers -- Hybrid alt 3,"hh_veh_gt_drivers * ((fuel_type_3=='PEV') | (fuel_type_3=='BEV'))",0,0,coef_vehltdr_ev,0,0
util_vehltdr_ev4,Vehicles > Drivers -- Hybrid alt 4,"hh_veh_gt_drivers * ((fuel_type_4=='PEV') | (fuel_type_4=='BEV'))",0,0,0,coef_vehltdr_ev,0
util_vehltdr_van1,Vehicles > Drivers -- Van alt 1,"hh_veh_gt_drivers * (body_type_1 == 5)",coef_vehltdr_van,0,0,0,0
util_vehltdr_van2,Vehicles > Drivers -- Van alt 2,"hh_veh_gt_drivers * (body_type_2 == 5)",0,coef_vehltdr_van,0,0,0
util_vehltdr_van3,Vehicles > Drivers -- Van alt 3,"hh_veh_gt_drivers * (body_type_3 == 5)",0,0,coef_vehltdr_van,0,0
util_vehltdr_van4,Vehicles > Drivers -- Van alt 4,"hh_veh_gt_drivers * (body_type_4 == 5)",0,0,0,coef_vehltdr_van,0
util_vehltdr_suv1,Vehicles > Drivers -- SUV alt 1,"hh_veh_gt_drivers * (body_type_1 == 4)",coef_vehltdr_suv,0,0,0,0
util_vehltdr_suv2,Vehicles > Drivers -- SUV alt 2,"hh_veh_gt_drivers * (body_type_2 == 4)",0,coef_vehltdr_suv,0,0,0
util_vehltdr_suv3,Vehicles > Drivers -- SUV alt 3,"hh_veh_gt_drivers * (body_type_3 == 4)",0,0,coef_vehltdr_suv,0,0
util_vehltdr_suv4,Vehicles > Drivers -- SUV alt 4,"hh_veh_gt_drivers * (body_type_4 == 4)",0,0,0,coef_vehltdr_suv,0
util_vehltdr_pu1,Vehicles > Drivers -- Pickup alt 1,"hh_veh_gt_drivers * (body_type_1 == 3)",coef_vehltdr_pu,0,0,0,0
util_vehltdr_pu2,Vehicles > Drivers -- Pickup alt 2,"hh_veh_gt_drivers * (body_type_2 == 3)",0,coef_vehltdr_pu,0,0,0
util_vehltdr_pu3,Vehicles > Drivers -- Pickup alt 3,"hh_veh_gt_drivers * (body_type_3 == 3)",0,0,coef_vehltdr_pu,0,0
util_vehltdr_pu4,Vehicles > Drivers -- Pickup alt 4,"hh_veh_gt_drivers * (body_type_4 == 3)",0,0,0,coef_vehltdr_pu,0
util_vehltdr_mc1,Vehicles > Drivers -- Motorcycle alt 1,"hh_veh_gt_drivers * (body_type_1 == 2)",coef_vehltdr_mc,0,0,0,0
util_vehltdr_mc2,Vehicles > Drivers -- Motorcycle alt 2,"hh_veh_gt_drivers * (body_type_2 == 2)",0,coef_vehltdr_mc,0,0,0
util_vehltdr_mc3,Vehicles > Drivers -- Motorcycle alt 3,"hh_veh_gt_drivers * (body_type_3 == 2)",0,0,coef_vehltdr_mc,0,0
util_vehltdr_mc4,Vehicles > Drivers -- Motorcycle alt 4,"hh_veh_gt_drivers * (body_type_4 == 2)",0,0,0,coef_vehltdr_mc,0
util_vehltdr_hyb1,Vehicles > Drivers -- Hybrid alt 1,"hh_veh_gt_drivers * (fuel_type_1 == 4)",coef_vehltdr_hyb,0,0,0,0
util_vehltdr_hyb2,Vehicles > Drivers -- Hybrid alt 2,"hh_veh_gt_drivers * (fuel_type_2 == 4)",0,coef_vehltdr_hyb,0,0,0
util_vehltdr_hyb3,Vehicles > Drivers -- Hybrid alt 3,"hh_veh_gt_drivers * (fuel_type_3 == 4)",0,0,coef_vehltdr_hyb,0,0
util_vehltdr_hyb4,Vehicles > Drivers -- Hybrid alt 4,"hh_veh_gt_drivers * (fuel_type_4 == 4)",0,0,0,coef_vehltdr_hyb,0
util_vehltdr_ev1,Vehicles > Drivers -- EV alt 1,"hh_veh_gt_drivers * ((fuel_type_1==5) | (fuel_type_1==1))",coef_vehltdr_ev,0,0,0,0
util_vehltdr_ev2,Vehicles > Drivers -- EV alt 2,"hh_veh_gt_drivers * ((fuel_type_2==5) | (fuel_type_2==1))",0,coef_vehltdr_ev,0,0,0
util_vehltdr_ev3,Vehicles > Drivers -- EV alt 3,"hh_veh_gt_drivers * ((fuel_type_3==5) | (fuel_type_3==1))",0,0,coef_vehltdr_ev,0,0
util_vehltdr_ev4,Vehicles > Drivers -- EV alt 4,"hh_veh_gt_drivers * ((fuel_type_4==5) | (fuel_type_4==1))",0,0,0,coef_vehltdr_ev,0
util_vehltdr_age1,Vehicles > Drivers -- Age alt 1,"hh_veh_gt_drivers * age_1",coef_vehltdr_age,0,0,0,0
util_vehltdr_age2,Vehicles > Drivers -- Age alt 2,"hh_veh_gt_drivers * age_2",0,coef_vehltdr_age,0,0,0
util_vehltdr_age3,Vehicles > Drivers -- Age alt 3,"hh_veh_gt_drivers * age_3",0,0,coef_vehltdr_age,0,0
util_vehltdr_age4,Vehicles > Drivers -- Age alt 4,"hh_veh_gt_drivers * age_4",0,0,0,coef_vehltdr_age,0
#,Occupancy interactions,,,,
util_maxocc_van1,Maximum Occupancy -- Van alt 1,"@occup * (df.body_type_1 == 'Van')",coef_maxocc_van,0,0,0,0
util_maxocc_van2,Maximum Occupancy -- Van alt 2,"@occup * (df.body_type_2 == 'Van')",0,coef_maxocc_van,0,0,0
util_maxocc_van3,Maximum Occupancy -- Van alt 3,"@occup * (df.body_type_3 == 'Van')",0,0,coef_maxocc_van,0,0
util_maxocc_van4,Maximum Occupancy -- Van alt 4,"@occup * (df.body_type_4 == 'Van')",0,0,0,coef_maxocc_van,0
util_maxocc_suv1,Maximum Occupancy -- SUV alt 1,"@occup * (df.body_type_1 == 'SUV')",coef_maxocc_suv,0,0,0,0
util_maxocc_suv2,Maximum Occupancy -- SUV alt 2,"@occup * (df.body_type_2 == 'SUV')",0,coef_maxocc_suv,0,0,0
util_maxocc_suv3,Maximum Occupancy -- SUV alt 3,"@occup * (df.body_type_3 == 'SUV')",0,0,coef_maxocc_suv,0,0
util_maxocc_suv4,Maximum Occupancy -- SUV alt 4,"@occup * (df.body_type_4 == 'SUV')",0,0,0,coef_maxocc_suv,0
util_maxocc_pu1,Maximum Occupancy -- Pickup alt 1,"@occup * (df.body_type_1 == 'Pickup')",coef_maxocc_pu,0,0,0,0
util_maxocc_pu2,Maximum Occupancy -- Pickup alt 2,"@occup * (df.body_type_2 == 'Pickup')",0,coef_maxocc_pu,0,0,0
util_maxocc_pu3,Maximum Occupancy -- Pickup alt 3,"@occup * (df.body_type_3 == 'Pickup')",0,0,coef_maxocc_pu,0,0
util_maxocc_pu4,Maximum Occupancy -- Pickup alt 4,"@occup * (df.body_type_4 == 'Pickup')",0,0,0,coef_maxocc_pu,0
util_maxocc_mc1,Maximum Occupancy -- Motorcycle alt 1,"@occup * (df.body_type_1 == 'Motorcycle')",coef_maxocc_mc,0,0,0,0
util_maxocc_mc2,Maximum Occupancy -- Motorcycle alt 2,"@occup * (df.body_type_2 == 'Motorcycle')",0,coef_maxocc_mc,0,0,0
util_maxocc_mc3,Maximum Occupancy -- Motorcycle alt 3,"@occup * (df.body_type_3 == 'Motorcycle')",0,0,coef_maxocc_mc,0,0
util_maxocc_mc4,Maximum Occupancy -- Motorcycle alt 4,"@occup * (df.body_type_4 == 'Motorcycle')",0,0,0,coef_maxocc_mc,0
util_maxocc_van1,Maximum Occupancy -- Van alt 1,"@occup * (df.body_type_1 == 5)",coef_maxocc_van,0,0,0,0
util_maxocc_van2,Maximum Occupancy -- Van alt 2,"@occup * (df.body_type_2 == 5)",0,coef_maxocc_van,0,0,0
util_maxocc_van3,Maximum Occupancy -- Van alt 3,"@occup * (df.body_type_3 == 5)",0,0,coef_maxocc_van,0,0
util_maxocc_van4,Maximum Occupancy -- Van alt 4,"@occup * (df.body_type_4 == 5)",0,0,0,coef_maxocc_van,0
util_maxocc_suv1,Maximum Occupancy -- SUV alt 1,"@occup * (df.body_type_1 == 4)",coef_maxocc_suv,0,0,0,0
util_maxocc_suv2,Maximum Occupancy -- SUV alt 2,"@occup * (df.body_type_2 == 4)",0,coef_maxocc_suv,0,0,0
util_maxocc_suv3,Maximum Occupancy -- SUV alt 3,"@occup * (df.body_type_3 == 4)",0,0,coef_maxocc_suv,0,0
util_maxocc_suv4,Maximum Occupancy -- SUV alt 4,"@occup * (df.body_type_4 == 4)",0,0,0,coef_maxocc_suv,0
util_maxocc_pu1,Maximum Occupancy -- Pickup alt 1,"@occup * (df.body_type_1 == 3)",coef_maxocc_pu,0,0,0,0
util_maxocc_pu2,Maximum Occupancy -- Pickup alt 2,"@occup * (df.body_type_2 == 3)",0,coef_maxocc_pu,0,0,0
util_maxocc_pu3,Maximum Occupancy -- Pickup alt 3,"@occup * (df.body_type_3 == 3)",0,0,coef_maxocc_pu,0,0
util_maxocc_pu4,Maximum Occupancy -- Pickup alt 4,"@occup * (df.body_type_4 == 3)",0,0,0,coef_maxocc_pu,0
util_maxocc_mc1,Maximum Occupancy -- Motorcycle alt 1,"@occup * (df.body_type_1 == 2)",coef_maxocc_mc,0,0,0,0
util_maxocc_mc2,Maximum Occupancy -- Motorcycle alt 2,"@occup * (df.body_type_2 == 2)",0,coef_maxocc_mc,0,0,0
util_maxocc_mc3,Maximum Occupancy -- Motorcycle alt 3,"@occup * (df.body_type_3 == 2)",0,0,coef_maxocc_mc,0,0
util_maxocc_mc4,Maximum Occupancy -- Motorcycle alt 4,"@occup * (df.body_type_4 == 2)",0,0,0,coef_maxocc_mc,0
util_maxocc_age1,Maximum Occupancy -- Age alt 1,"@occup * df.age_1",coef_maxocc_age,0,0,0,0
util_maxocc_age2,Maximum Occupancy -- Age alt 2,"@occup * df.age_2",0,coef_maxocc_age,0,0,0
util_maxocc_age3,Maximum Occupancy -- Age alt 3,"@occup * df.age_3",0,0,coef_maxocc_age,0,0
util_maxocc_age4,Maximum Occupancy -- Age alt 4,"@occup * df.age_4",0,0,0,coef_maxocc_age,0
util_maxocc_nh,Maximum Occupancy -- Age alt 1,"@occup",0,0,0,0,util_maxocc_nh
#,Alternative Specific Constants,,,,
util_non_hh,Non-Household Vehicle Constant,"1",0,0,0,0,coef_non_hh
util_van1,Van ASC alt 1,"(body_type_1 == 'Van')",coef_van,0,0,0,0
util_van2,Van ASC alt 2,"(body_type_2 == 'Van')",0,coef_van,0,0,0
util_van3,Van ASC alt 3,"(body_type_3 == 'Van')",0,0,coef_van,0,0
util_van4,Van ASC alt 4,"(body_type_4 == 'Van')",0,0,0,coef_van,0
util_suv1,SUV ASC alt 1,"(body_type_1 == 'SUV')",coef_suv,0,0,0,0
util_suv2,SUV ASC alt 2,"(body_type_2 == 'SUV')",0,coef_suv,0,0,0
util_suv3,SUV ASC alt 3,"(body_type_3 == 'SUV')",0,0,coef_suv,0,0
util_suv4,SUV ASC alt 4,"(body_type_4 == 'SUV')",0,0,0,coef_suv,0
util_pu1,Pickup ASC alt 1,"(body_type_1 == 'Pickup')",coef_pu,0,0,0,0
util_pu2,Pickup ASC alt 2,"(body_type_2 == 'Pickup')",0,coef_pu,0,0,0
util_pu3,Pickup ASC alt 3,"(body_type_3 == 'Pickup')",0,0,coef_pu,0,0
util_pu4,Pickup ASC alt 4,"(body_type_4 == 'Pickup')",0,0,0,coef_pu,0
util_mc1,Motorcycle ASC alt 1,"(body_type_1 == 'Motorcycle')",coef_mc,0,0,0,0
util_mc2,Motorcycle ASC alt 2,"(body_type_2 == 'Motorcycle')",0,coef_mc,0,0,0
util_mc3,Motorcycle ASC alt 3,"(body_type_3 == 'Motorcycle')",0,0,coef_mc,0,0
util_mc4,Motorcycle ASC alt 4,"(body_type_4 == 'Motorcycle')",0,0,0,coef_mc,0
util_dsl1,Diesel ASC alt 1,"(fuel_type_1 == 'Diesel')",coef_dsl,0,0,0,0
util_dsl2,Diesel ASC alt 2,"(fuel_type_2 == 'Diesel')",0,coef_dsl,0,0,0
util_dsl3,Diesel ASC alt 3,"(fuel_type_3 == 'Diesel')",0,0,coef_dsl,0,0
util_dsl4,Diesel ASC alt 4,"(fuel_type_4 == 'Diesel')",0,0,0,coef_dsl,0
util_hyb1,Hybrid ASC alt 1,"(fuel_type_1 == 'Hybrid')",coef_hyb,0,0,0,0
util_hyb2,Hybrid ASC alt 2,"(fuel_type_2 == 'Hybrid')",0,coef_hyb,0,0,0
util_hyb3,Hybrid ASC alt 3,"(fuel_type_3 == 'Hybrid')",0,0,coef_hyb,0,0
util_hyb4,Hybrid ASC alt 4,"(fuel_type_4 == 'Hybrid')",0,0,0,coef_hyb,0
util_pev1,PEV ASC alt 1,"(fuel_type_1 == 'PEV')",coef_pev,0,0,0,0
util_pev2,PEV ASC alt 2,"(fuel_type_2 == 'PEV')",0,coef_pev,0,0,0
util_pev3,PEV ASC alt 3,"(fuel_type_3 == 'PEV')",0,0,coef_pev,0,0
util_pev4,PEV ASC alt 4,"(fuel_type_4 == 'PEV')",0,0,0,coef_pev,0
util_bev1,BEV ASC alt 1,"(fuel_type_1 == 'BEV')",coef_bev,0,0,0,0
util_bev2,BEV ASC alt 2,"(fuel_type_2 == 'BEV')",0,coef_bev,0,0,0
util_bev3,BEV ASC alt 3,"(fuel_type_3 == 'BEV')",0,0,coef_bev,0,0
util_bev4,BEV ASC alt 4,"(fuel_type_4 == 'BEV')",0,0,0,coef_bev,0
util_van1,Van ASC alt 1,"(body_type_1 == 5)",coef_van,0,0,0,0
util_van2,Van ASC alt 2,"(body_type_2 == 5)",0,coef_van,0,0,0
util_van3,Van ASC alt 3,"(body_type_3 == 5)",0,0,coef_van,0,0
util_van4,Van ASC alt 4,"(body_type_4 == 5)",0,0,0,coef_van,0
util_suv1,SUV ASC alt 1,"(body_type_1 == 4)",coef_suv,0,0,0,0
util_suv2,SUV ASC alt 2,"(body_type_2 == 4)",0,coef_suv,0,0,0
util_suv3,SUV ASC alt 3,"(body_type_3 == 4)",0,0,coef_suv,0,0
util_suv4,SUV ASC alt 4,"(body_type_4 == 4)",0,0,0,coef_suv,0
util_pu1,Pickup ASC alt 1,"(body_type_1 == 3)",coef_pu,0,0,0,0
util_pu2,Pickup ASC alt 2,"(body_type_2 == 3)",0,coef_pu,0,0,0
util_pu3,Pickup ASC alt 3,"(body_type_3 == 3)",0,0,coef_pu,0,0
util_pu4,Pickup ASC alt 4,"(body_type_4 == 3)",0,0,0,coef_pu,0
util_mc1,Motorcycle ASC alt 1,"(body_type_1 == 2)",coef_mc,0,0,0,0
util_mc2,Motorcycle ASC alt 2,"(body_type_2 == 2)",0,coef_mc,0,0,0
util_mc3,Motorcycle ASC alt 3,"(body_type_3 == 2)",0,0,coef_mc,0,0
util_mc4,Motorcycle ASC alt 4,"(body_type_4 == 2)",0,0,0,coef_mc,0
util_dsl1,Diesel ASC alt 1,"(fuel_type_1 == 2)",coef_dsl,0,0,0,0
util_dsl2,Diesel ASC alt 2,"(fuel_type_2 == 2)",0,coef_dsl,0,0,0
util_dsl3,Diesel ASC alt 3,"(fuel_type_3 == 2)",0,0,coef_dsl,0,0
util_dsl4,Diesel ASC alt 4,"(fuel_type_4 == 2)",0,0,0,coef_dsl,0
util_hyb1,Hybrid ASC alt 1,"(fuel_type_1 == 4)",coef_hyb,0,0,0,0
util_hyb2,Hybrid ASC alt 2,"(fuel_type_2 == 4)",0,coef_hyb,0,0,0
util_hyb3,Hybrid ASC alt 3,"(fuel_type_3 == 4)",0,0,coef_hyb,0,0
util_hyb4,Hybrid ASC alt 4,"(fuel_type_4 == 4)",0,0,0,coef_hyb,0
util_pev1,PEV ASC alt 1,"(fuel_type_1 == 5)",coef_pev,0,0,0,0
util_pev2,PEV ASC alt 2,"(fuel_type_2 == 5)",0,coef_pev,0,0,0
util_pev3,PEV ASC alt 3,"(fuel_type_3 == 5)",0,0,coef_pev,0,0
util_pev4,PEV ASC alt 4,"(fuel_type_4 == 5)",0,0,0,coef_pev,0
util_bev1,BEV ASC alt 1,"(fuel_type_1 == 1)",coef_bev,0,0,0,0
util_bev2,BEV ASC alt 2,"(fuel_type_2 == 1)",0,coef_bev,0,0,0
util_bev3,BEV ASC alt 3,"(fuel_type_3 == 1)",0,0,coef_bev,0,0
util_bev4,BEV ASC alt 4,"(fuel_type_4 == 1)",0,0,0,coef_bev,0
util_age2_1,Age 1 alt 1,"(age_1 == 2)",coef_age2,0,0,0,0
util_age2_2,Age 1 alt 2,"(age_2 == 2)",0,coef_age2,0,0,0
util_age2_3,Age 1 alt 3,"(age_3 == 2)",0,0,coef_age2,0,0
Expand Down
24 changes: 16 additions & 8 deletions ext-configs/vehicle_allocation_annotate_choosers_preprocessor.csv
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,22 @@ Age of vehicle alternative 1,age_1,"df.veh_num1.astype(str).str.split('_').str[1
Age of vehicle alternative 2,age_2,"df.veh_num2.astype(str).str.split('_').str[1].fillna(0).astype(int)"
Age of vehicle alternative 3,age_3,"df.veh_num3.astype(str).str.split('_').str[1].fillna(0).astype(int)"
Age of vehicle alternative 4,age_4,"df.veh_num4.astype(str).str.split('_').str[1].fillna(0).astype(int)"
body type of vehicle alternative 1,body_type_1,"df.veh_num1.astype(str).str.split('_').str[0]"
body type of vehicle alternative 2,body_type_2,"df.veh_num2.astype(str).str.split('_').str[0]"
body type of vehicle alternative 3,body_type_3,"df.veh_num3.astype(str).str.split('_').str[0]"
body type of vehicle alternative 4,body_type_4,"df.veh_num4.astype(str).str.split('_').str[0]"
fuel type of vehicle alternative 1,fuel_type_1,"df.veh_num1.astype(str).str.split('_').str[2]"
fuel type of vehicle alternative 2,fuel_type_2,"df.veh_num2.astype(str).str.split('_').str[2]"
fuel type of vehicle alternative 3,fuel_type_3,"df.veh_num3.astype(str).str.split('_').str[2]"
fuel type of vehicle alternative 4,fuel_type_4,"df.veh_num4.astype(str).str.split('_').str[2]"
body type of vehicle alternative 1,_str_body_type_1,"df.veh_num1.astype(str).str.split('_').str[0]"
body type of vehicle alternative 2,_str_body_type_2,"df.veh_num2.astype(str).str.split('_').str[0]"
body type of vehicle alternative 3,_str_body_type_3,"df.veh_num3.astype(str).str.split('_').str[0]"
body type of vehicle alternative 4,_str_body_type_4,"df.veh_num4.astype(str).str.split('_').str[0]"
integer encoded body type 1,body_type_1,"_str_body_type_1.map({'Car': 1, 'Motorcycle': 2, 'Pickup': 3, 'SUV': 4, 'Van': 5}).fillna(-1).astype(int)"
integer encoded body type 2,body_type_2,"_str_body_type_2.map({'Car': 1, 'Motorcycle': 2, 'Pickup': 3, 'SUV': 4, 'Van': 5}).fillna(-1).astype(int)"
integer encoded body type 3,body_type_3,"_str_body_type_3.map({'Car': 1, 'Motorcycle': 2, 'Pickup': 3, 'SUV': 4, 'Van': 5}).fillna(-1).astype(int)"
integer encoded body type 4,body_type_4,"_str_body_type_4.map({'Car': 1, 'Motorcycle': 2, 'Pickup': 3, 'SUV': 4, 'Van': 5}).fillna(-1).astype(int)"
fuel type of vehicle alternative 1,_str_fuel_type_1,"df.veh_num1.astype(str).str.split('_').str[2]"
fuel type of vehicle alternative 2,_str_fuel_type_2,"df.veh_num2.astype(str).str.split('_').str[2]"
fuel type of vehicle alternative 3,_str_fuel_type_3,"df.veh_num3.astype(str).str.split('_').str[2]"
fuel type of vehicle alternative 4,_str_fuel_type_4,"df.veh_num4.astype(str).str.split('_').str[2]"
integer encoded fuel type 1,fuel_type_1,"_str_fuel_type_1.map({'BEV': 1, 'Diesel': 2, 'Gas': 3, 'Hybrid': 4, 'PEV': 5}).fillna(-1).astype(int)"
integer encoded fuel type 2,fuel_type_2,"_str_fuel_type_2.map({'BEV': 1, 'Diesel': 2, 'Gas': 3, 'Hybrid': 4, 'PEV': 5}).fillna(-1).astype(int)"
integer encoded fuel type 3,fuel_type_3,"_str_fuel_type_3.map({'BEV': 1, 'Diesel': 2, 'Gas': 3, 'Hybrid': 4, 'PEV': 5}).fillna(-1).astype(int)"
integer encoded fuel type 4,fuel_type_4,"_str_fuel_type_4.map({'BEV': 1, 'Diesel': 2, 'Gas': 3, 'Hybrid': 4, 'PEV': 5}).fillna(-1).astype(int)"
Range of vehicle alternative 1,Range_1,"reindex(vehicles.groupby('vehicle_type')['Range'].mean(), df.veh_num1)"
Range of vehicle alternative 2,Range_2,"reindex(vehicles.groupby('vehicle_type')['Range'].mean(), df.veh_num2)"
Range of vehicle alternative 3,Range_3,"reindex(vehicles.groupby('vehicle_type')['Range'].mean(), df.veh_num3)"
Expand Down

0 comments on commit e768c08

Please sign in to comment.