-
Notifications
You must be signed in to change notification settings - Fork 23
ABM3 Intra-Household AV Allocation and Taxi/TNC Routing Models #366
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 21 commits
935665f
9b63b44
53f6955
0629a2c
25583ad
f2c9127
304e02b
fd9174f
67261c7
5b256ee
f4827e1
ca813ec
dfab2b1
18ae057
44e37b8
8fbf7b7
ee5c11d
46fc057
ec134ec
7215a49
e7418ae
14dff05
253dbf4
8322dc2
60dd25c
38eaae2
2d1b8f1
7895862
2d0e28c
1bb7ab9
389cc41
d031883
039d5cf
7605180
7cd7742
6a6e1fa
6943ed9
62e8620
249a439
9d3fabb
a8cbc89
1c15591
e161bf5
2a12758
10ca494
7322af7
3b96120
5cac8ce
1a49739
25ba925
837367a
dc75ea7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| Label,Description,Expression,stay_with_person,go_to_parking,go_home,service_next_trip_1,service_next_trip_2,service_next_trip_3 | ||
| util_dummy_1,Dummy variable 1,1,1,1,1,1,1,1 | ||
| # stay with person utils,,,,,,,, | ||
| util_stay_with_person_avail,Whether auto can park at destination,parkingConstrained,coef_unavailable,,,,, | ||
| util_cost_of_parking,Cost of parking at destination,parkingCost,coef_cost,,,,, | ||
| util_time_stay,Stay- Need car soon,"@np.where(df.duration_hrs < df.AV_maxDuration, (-1)*(df.AV_maxBenefit + (df.duration_hrs*df.slope)), 0)",coef_ivt,,,,, | ||
| # go to parking utils,,,,,,,, | ||
| util_time_go_to_parking,Remote- Need car soon,"@np.where(df.duration_hrs < df.AV_maxDuration, (-1)*(df.AV_maxBenefit + (df.duration_hrs*df.slope)), 0)",,coef_ivt,,,, | ||
| util_remote_cost,Remote park - Cost of parking until departure,duration_hrs * RemoteParkingCostPerHour * 100,,coef_cost,,,, | ||
| util_remote_ivt,in vehicle time to remote parking location,@v_to_parking_skim['SOV_TR_H_TIME'],,coef_ivt,,,, | ||
| util_remote_rel,reliability vehicle location to remote parking location,"@v_to_parking_skim['SOV_TR_H_REL'] * 14 / np.maximum(0.1, v_to_parking_skim['SOV_TR_H_DIST'])",,coef_ivt,,,, | ||
| util_remote_auto_cost,auto operating cost from vehicle location to remote parking location,@(v_to_parking_skim['SOV_TR_H_DIST'] * costPerMile * autoCostPerMileFactorAV) + v_to_parking_skim['SOV_TR_H_TOLLCOST'],,coef_cost,,,, | ||
| # go home utils,,,,,,,, | ||
| util_home_ivt,in vehicle time to go home,@v_to_home_skim['SOV_TR_H_TIME'],,,coef_ivt,,, | ||
| util_home_rel,reliability vehicle location to home,"@v_to_home_skim['SOV_TR_H_REL'] * 14 / np.maximum(0.1, v_to_home_skim['SOV_TR_H_DIST'])",,,coef_ivt,,, | ||
| util_home_auto_cost,auto operating cost from vehicle location to home,@(v_to_home_skim['SOV_TR_H_DIST'] * costPerMile * autoCostPerMileFactorAV) + v_to_home_skim['SOV_TR_H_TOLLCOST'],,,coef_cost,,, | ||
| # service next trip util 1,,,,,,,, | ||
| util_next_trip_available,Unavailable if no next trip,next_trip_id_1 == -1,,,,coef_unavailable,, | ||
| util_next1_ivt,in vehicle time to next trip 1 origin,v_to_trip_orig1_time,,,,coef_ivt,, | ||
| util_next1_rel,reliability vehicle location to next trip 1 origin,"@df.v_to_trip_orig1_rel * 14 / np.maximum(0.1, df.v_to_trip_orig1_dist)",,,,coef_ivt,, | ||
| util_next1_auto_cost,auto operating cost from vehicle location to next trip 1 origin,@(df.v_to_trip_orig1_dist * costPerMile * autoCostPerMileFactorAV) + df.v_to_trip_orig1_toll,,,,coef_cost,, | ||
| # service next trip util 2,,,,,,,, | ||
| util_next_trip_available,Unavailable if no next trip,next_trip_id_2 == -1,,,,,coef_unavailable, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Based on line 28, should this be "util_next_trip_available_2"? |
||
| util_next2_ivt,in vehicle time to next trip 2 origin,v_to_trip_orig2_time,,,,,coef_ivt, | ||
| util_next2_rel,reliability vehicle location to next trip 2 origin,"@df.v_to_trip_orig2_rel * 14 / np.maximum(0.2, df.v_to_trip_orig2_dist)",,,,,coef_ivt, | ||
| util_next2_auto_cost,auto operating cost from vehicle location to next trip 2 origin,@(df.v_to_trip_orig2_dist * costPerMile * autoCostPerMileFactorAV) + df.v_to_trip_orig2_toll,,,,,coef_cost, | ||
| # service next trip util 3,,,,,,,, | ||
| util_next_trip_available_3,Unavailable if no next trip 3,next_trip_id_3 == -1,,,,,,coef_unavailable | ||
| util_next3_ivt,in vehicle time to next trip 3 origin,v_to_trip_orig3_time,,,,,,coef_ivt | ||
| util_next3_rel,reliability vehicle location to next trip 3 origin,"@df.v_to_trip_orig3_rel * 14 / np.maximum(0.3, df.v_to_trip_orig3_dist)",,,,,,coef_ivt | ||
dhensle marked this conversation as resolved.
Show resolved
Hide resolved
dhensle marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| util_next3_auto_cost,auto operating cost from vehicle location to next trip 3 origin,@(df.v_to_trip_orig3_dist * costPerMile * autoCostPerMileFactorAV) + df.v_to_trip_orig3_toll,,,,,,coef_cost | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| coefficient_name,value,constrain | ||
| coef_unavailable,-999.0,F | ||
| coef_ivt,-0.03,F | ||
| coef_cost,-0.002,F |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| Description,Target,Expression | ||
| next trip start time,next_depart,df['trip_id'].map(trips.groupby('tour_id')['depart'].shift(-1).to_dict()) | ||
| trip duration,duration_hrs,"np.where(next_depart.isna(), 0, next_depart - df.depart) / 2" | ||
| duration benefit,duration_benefit,"np.where((duration_hrs < 1.5) & (duration_hrs > 0), 60 - (60/1.5 * duration_hrs), 0)" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. duration_benefit term is not being used in av_repositioning.csv, maybe drop? |
||
| #Parking cost calculation,, | ||
| ,tour_id,"reindex(trips.tour_id, df.trip_id)" | ||
| ,tour_type,"reindex(tours.tour_type, tour_id)" | ||
| ,person_id,"reindex(trips.person_id, df.trip_id)" | ||
| ,ptype,"reindex(persons.ptype, person_id)" | ||
| ,free_parking_at_work,"reindex(persons.free_parking_at_work, person_id)" | ||
| ,free_parking_available,(tour_type == 'work') & free_parking_at_work | ||
| ,number_of_participants,"reindex(tours.number_of_participants, tour_id)" | ||
| ,is_indiv,(number_of_participants == 1) | ||
| person has free on-site parking at workplace,freeOnsite,"(free_parking_available)*np.where(is_indiv,1,0)" | ||
| new reimbursement amount,reimburseProportion,0 | ||
| tour primary destination,tour_dest,"reindex(tours.destination, tour_id)" | ||
| half tour duration,tourDuration,"reindex(tours.duration, tour_id)/2" | ||
| new daily parking cost with reimbursement,parkingCostDayDollars,"reindex(land_use.exp_daily, tour_dest)" | ||
| new hourly parking cost with reimbursement,parkingCostHourDollars,"reindex(land_use.exp_hourly, tour_dest)" | ||
| new monthly parking cost with reimbursement,parkingCostMonthDollars,"reindex(land_use.exp_monthly, tour_dest)" | ||
| daily cost converted to cents,parkingCostDay,parkingCostDayDollars*100 | ||
| hourly cost converted to cents,parkingCostHour,parkingCostHourDollars*100 | ||
| monthly cost converted to cents,parkingCostMonth,parkingCostMonthDollars*100 | ||
| Trip parking cost for full-time workers and university students,_parkingCostBeforeReimb,"ptype.isin([1,3]).values * is_indiv * np.minimum(parkingCostMonth/22, parkingCostDay)" | ||
| Trip parking cost for full-time workers and university students,_parkingCostBeforeReimb,"ptype.isin([1,3]).values * is_indiv * np.minimum(_parkingCostBeforeReimb, parkingCostHour * duration_hrs)" | ||
| ,is_joint,(number_of_participants > 1) | ||
| Trip parking cost for other person types,parkingCostBeforeReimb,"np.where((~ptype.isin([1,3]).values * is_indiv) | (is_joint), np.minimum(parkingCostDay, parkingCostHour * duration_hrs), _parkingCostBeforeReimb)" | ||
| Reimbursement applies to this tour purpose,reimbursePurpose,tour_type=='work' | ||
| Effective parking cost for free parkers,_parkingCost,"0 * np.where(reimbursePurpose*freeOnsite,1,0)" | ||
| Effective parking cost for reimbursed parkers,_parkingCost,"np.where(is_indiv*reimbursePurpose*(1-freeOnsite), np.maximum((1-reimburseProportion) * parkingCostBeforeReimb, 0),_parkingCost)" | ||
| Effective parking cost,parkingCost,"np.where(is_joint+is_indiv*(1-reimbursePurpose), parkingCostBeforeReimb,_parkingCost)" | ||
| # These following two are from AutonomousVehicleAllocationChoice.xls,, | ||
| Maximim benefit for keeping car close (min),AV_maxBenefit,60 | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't need to define these here because they are in configs/common/constants.yaml? |
||
| Maximum duration for keeping car close (hrs),AV_maxDuration,1.5 | ||
| Slope of benefit calculation,slope, (-1)*(AV_maxBenefit / AV_maxDuration) | ||
| # below taken from parametersByYear.csv,, | ||
| ,RemoteParkingCostPerHour,0.81 | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment as above. |
||
| #,, | ||
| ,parkingConstrained,"reindex(land_use.parking_type,df.destination)==1" | ||
| ,v_to_trip_orig1_time,"np.where(df.next_trip_id_1 > 0, v_to_trip_orig1_skim['SOV_TR_H_TIME'], 0)" | ||
| ,v_to_trip_orig2_time,"np.where(df.next_trip_id_2 > 0, v_to_trip_orig2_skim['SOV_TR_H_TIME'], 0)" | ||
| ,v_to_trip_orig3_time,"np.where(df.next_trip_id_3 > 0, v_to_trip_orig3_skim['SOV_TR_H_TIME'], 0)" | ||
| ,v_to_trip_orig1_dist,"np.where(df.next_trip_id_1 > 0, v_to_trip_orig1_skim['SOV_TR_H_DIST'], 0)" | ||
| ,v_to_trip_orig2_dist,"np.where(df.next_trip_id_2 > 0, v_to_trip_orig2_skim['SOV_TR_H_DIST'], 0)" | ||
| ,v_to_trip_orig3_dist,"np.where(df.next_trip_id_3 > 0, v_to_trip_orig3_skim['SOV_TR_H_DIST'], 0)" | ||
| ,v_to_trip_orig1_rel,"np.where(df.next_trip_id_1 > 0, v_to_trip_orig1_skim['SOV_TR_H_REL'], 0)" | ||
| ,v_to_trip_orig2_rel,"np.where(df.next_trip_id_2 > 0, v_to_trip_orig2_skim['SOV_TR_H_REL'], 0)" | ||
| ,v_to_trip_orig3_rel,"np.where(df.next_trip_id_3 > 0, v_to_trip_orig3_skim['SOV_TR_H_REL'], 0)" | ||
| ,v_to_trip_orig1_toll,"np.where(df.next_trip_id_1 > 0, v_to_trip_orig1_skim['SOV_TR_H_TOLLCOST'], 0)" | ||
| ,v_to_trip_orig2_toll,"np.where(df.next_trip_id_2 > 0, v_to_trip_orig2_skim['SOV_TR_H_TOLLCOST'], 0)" | ||
| ,v_to_trip_orig3_toll,"np.where(df.next_trip_id_3 > 0, v_to_trip_orig3_skim['SOV_TR_H_TOLLCOST'], 0)" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| # spec and coefficients for AV trip matching model | ||
| AV_TRIP_MATCHING_SPEC: av_trip_matching.csv | ||
| AV_TRIP_MATCHING_COEFFICIENTS: av_trip_matching_coefficients.csv | ||
|
|
||
| # spec and coefficients for AV repositioning model | ||
| AV_REPOSITIONING_SPEC: av_repositioning.csv | ||
| AV_REPOSITIONING_COEFFICIENTS: av_repositioning_coefficients.csv | ||
|
|
||
| # needed to pass logit settings validation, but not used in this model | ||
| SPEC: None | ||
|
|
||
| # Column in landuse DataFrame that indicates if a zone has AV parking available | ||
| AV_PARKING_ZONE_COLUMN: remoteAVParking | ||
|
|
||
| # Skim core for nearest parking zone calculations | ||
| NEAREST_ZONE_SKIM: DIST | ||
|
|
||
| # List of modes that are eligible for routing with a household AV | ||
| DRIVING_MODES: | ||
| - DRIVEALONE | ||
| - SHARED2 | ||
| - SHARED3 | ||
|
|
||
| av_trip_matching_preprocessor: | ||
| SPEC: av_trip_matching_preprocessor.csv | ||
| DF: df | ||
| TABLES: | ||
| - trips | ||
|
|
||
| av_repositioning_preprocessor: | ||
| SPEC: av_repositioning_preprocessor.csv | ||
| DF: df | ||
| TABLES: | ||
| - trips | ||
| - land_use | ||
| - tours | ||
| - persons |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| Label,Description,Expression,coefficient | ||
| util_dummy_1,Dummy variable 1,1,coef_one | ||
| util_veh_to_trip_origin_time,Time veh to trip origin,"@np.where((df.veh_location == df.origin) | (df.veh_location < 0) | (df.origin < 0), 0, veho_tripo_t_skims['SOV_TR_L_TIME'])",coef_ivt | ||
| util_veh_to_trip_origin_cost,cost veh to trip origin,"@np.where((df.veh_location == df.origin) | (df.veh_location < 0) | (df.origin < 0), 0, (df.auto_operating_cost * veho_tripo_t_skims['SOV_TR_L_DIST']) + veho_tripo_t_skims['SOV_TR_L_TOLLCOST'])",coef_cost | ||
| # *14 multiplier to convert from ivt to reliability as used in previous iteration,,, | ||
| util_veh_to_trip_origin_reliability,reliability veh to trip origin,"@np.where((df.veh_location == df.origin) | (df.veh_location < 0) | (df.origin < 0), 0, veho_tripo_t_skims['SOV_NT_L_REL']) * 14",coef_ivt | ||
| util_trip_duration,Trip duration,df.duration_benefit,coef_ivt | ||
| util_no_vehicle,Alternative unavailable if no vehicle,df.vehicle_id.isna() & (df.trip_number > 0),coef_unavailable | ||
| util_no_trip,unavailable if no trip and alt is not idle,df.trip_id.isna() & (df.trip_number > 0),coef_unavailable | ||
| util_idle,Do not service any trips,(df.trip_number == 0) & ~df.vehicle_id.isna(),coef_idle |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| coefficient_name,value,constrain | ||
| coef_unavailable,-999.0,F | ||
| coef_one,1.0,F | ||
| coef_idle,-10.0,F | ||
| coef_ivt,-0.03,F | ||
| coef_cost,-0.002,F |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| Description,Target,Expression | ||
| next trip start time,next_depart,df['trip_id'].map(trips.groupby('tour_id')['depart'].shift(-1).to_dict()) | ||
| trip duration,duration_hrs,"np.where(next_depart.isna(), 0, next_depart - df.depart) / 2" | ||
| duration benefit,duration_benefit,"np.where((duration_hrs < 1.5) & (duration_hrs > 0), 60 - (60/1.5 * duration_hrs), 0)" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need to get AV_maxduration and AV_maxbenefit from configs/common/constants.yaml here? |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What exactly is the factor 14 we are multiplying reliability by?