Skip to content

Commit

Permalink
add tncs
Browse files Browse the repository at this point in the history
todo: rng.lognormal_for_df needs a data frame with a unique index and the chooser table repeats person ids.  Need to deal with this.
  • Loading branch information
bstabler committed Feb 11, 2020
1 parent 6336839 commit a6fd71d
Show file tree
Hide file tree
Showing 9 changed files with 955 additions and 680 deletions.
2 changes: 1 addition & 1 deletion example/configs/settings.yaml
Expand Up @@ -45,7 +45,7 @@ use_shadow_pricing: False
# trace household id; comment out or leave empty for no trace
# households with all tour types
# [ 728370 1234067 1402924 1594625 1595333 1747572 1896849 1931818 2222690 2344951 2677154]
trace_hh_id: 701664
trace_hh_id: 2223759

# trace origin, destination in accessibility calculation; comment out or leave empty for no trace
# trace_od: [5, 11]
Expand Down
648 changes: 342 additions & 306 deletions example/configs/tour_mode_choice.csv

Large diffs are not rendered by default.

57 changes: 56 additions & 1 deletion example/configs/tour_mode_choice.yaml
Expand Up @@ -47,6 +47,12 @@ NESTS:
- DRIVE_EXP
- DRIVE_HVY
- DRIVE_COM
- name: MAAS
coefficient: 0.72
alternatives:
- TAXI
- TNC_SINGLE
- TNC_SHARED

SPEC: tour_mode_choice.csv
COEFFS: tour_mode_choice_coeffs.csv
Expand All @@ -69,7 +75,55 @@ CONSTANTS:
upperAM: 10
upperMD: 15
upperPM: 19

# MAAS Settings
Taxi_baseFare: 2.20
Taxi_costPerMile: 2.30
Taxi_costPerMinute: 0.10
Taxi_waitTime_mean:
1: 26.5
2: 17.3
3: 13.3
4: 9.5
5: 5.5
Taxi_waitTime_sd:
1: 6.4
2: 6.4
3: 6.4
4: 6.4
5: 6.4
TNC_single_baseFare: 2.20
TNC_single_costPerMile: 1.33
TNC_single_costPerMinute: 0.24
TNC_single_costMinimum: 7.20
TNC_single_waitTime_mean:
1: 10.3
2: 8.5
3: 8.4
4: 6.3
5: 4.7
TNC_single_waitTime_sd:
1: 4.1
2: 4.1
3: 4.1
4: 4.1
5: 4.1
TNC_shared_baseFare: 2.20
TNC_shared_costPerMile: 0.53
TNC_shared_costPerMinute: 0.10
TNC_shared_costMinimum: 3.00
TNC_shared_IVTFactor: 1.5
TNC_shared_waitTime_mean:
1: 15.0
2: 15.0
3: 11.0
4: 8.0
5: 7.0
TNC_shared_waitTime_sd:
1: 4.1
2: 4.1
3: 4.1
4: 4.1
5: 4.1

# so far, we can use the same spec as for non-joint tours
preprocessor:
Expand All @@ -85,6 +139,7 @@ nontour_preprocessor:
TABLES:
- land_use

# to reduce memory needs filter chooser table to these fields
LOGSUM_CHOOSER_COLUMNS:
- tour_type
- hhsize
Expand Down
Expand Up @@ -28,6 +28,38 @@ local,_DF_IS_TOUR,'tour_type' in df.columns
,drive_transit_available,_walk_transit_destination & (df.auto_ownership > 0)
,origin_walk_time,shortWalk*60/walkSpeed
,destination_walk_time,shortWalk*60/walkSpeed
# MAAS,,
,origin_density_measure,"(reindex(land_use.TOTPOP, df[orig_col_name]) + reindex(land_use.TOTEMP, df[orig_col_name])) / (reindex(land_use.TOTACRE, df[orig_col_name]) / 640)"
,dest_density_measure,"(reindex(land_use.TOTPOP, df[dest_col_name]) + reindex(land_use.TOTEMP, df[dest_col_name])) / (reindex(land_use.TOTACRE, df[dest_col_name]) / 640)"
,origin_density,"pd.cut(origin_density_measure, bins=[-np.inf, 500, 2000, 5000, 15000, np.inf], labels=[1, 2, 3, 4, 5]).astype(int)"
,dest_density,"pd.cut(dest_density_measure, bins=[-np.inf, 500, 2000, 5000, 15000, np.inf], labels=[1, 2, 3, 4, 5]).astype(int)"
,origin_zone_taxi_wait_time_mean,"origin_density.map({k: v for k, v in Taxi_waitTime_mean.items()})"
,origin_zone_taxi_wait_time_sd,"origin_density.map({k: v for k, v in Taxi_waitTime_sd.items()})"
,dest_zone_taxi_wait_time_mean,"dest_density.map({k: v for k, v in Taxi_waitTime_mean.items()})"
,dest_zone_taxi_wait_time_sd,"dest_density.map({k: v for k, v in Taxi_waitTime_sd.items()})"
#,origTaxiWaitTime,"rng.lognormal_for_df(df, mu=origin_zone_taxi_wait_time_mean, sigma=origin_zone_taxi_wait_time_sd)"
,origTaxiWaitTime,5
#,destTaxiWaitTime,"rng.lognormal_for_df(df, mu=dest_zone_taxi_wait_time_mean, sigma=dest_zone_taxi_wait_time_sd)"
,destTaxiWaitTime,5
,origin_zone_singleTNC_wait_time_mean,"origin_density.map({k: v for k, v in TNC_single_waitTime_mean.items()})"
,origin_zone_singleTNC_wait_time_sd,"origin_density.map({k: v for k, v in TNC_single_waitTime_sd.items()})"
,dest_zone_singleTNC_wait_time_mean,"dest_density.map({k: v for k, v in TNC_single_waitTime_mean.items()})"
,dest_zone_singleTNC_wait_time_sd,"dest_density.map({k: v for k, v in TNC_single_waitTime_sd.items()})"
#,origSingleTNCWaitTime,"rng.lognormal_for_df(df, mu=origin_zone_singleTNC_wait_time_mean, sigma=origin_zone_singleTNC_wait_time_sd)"
,origSingleTNCWaitTime,5
#,destSingleTNCWaitTime,"rng.lognormal_for_df(df, mu=dest_zone_singleTNC_wait_time_mean, sigma=dest_zone_singleTNC_wait_time_sd)"
,destSingleTNCWaitTime,5
,origin_zone_sharedTNC_wait_time_mean,"origin_density.map({k: v for k, v in TNC_shared_waitTime_mean.items()})"
,origin_zone_sharedTNC_wait_time_sd,"origin_density.map({k: v for k, v in TNC_shared_waitTime_sd.items()})"
,dest_zone_sharedTNC_wait_time_mean,"dest_density.map({k: v for k, v in TNC_shared_waitTime_mean.items()})"
,dest_zone_sharedTNC_wait_time_sd,"dest_density.map({k: v for k, v in TNC_shared_waitTime_sd.items()})"
#,origSharedTNCWaitTime,"rng.lognormal_for_df(df, mu=origin_zone_sharedTNC_wait_time_mean, sigma=origin_zone_sharedTNC_wait_time_sd)"
,origSharedTNCWaitTime,5
#,destSharedTNCWaitTime,"rng.lognormal_for_df(df, mu=dest_zone_sharedTNC_wait_time_mean, sigma=dest_zone_sharedTNC_wait_time_sd)"
,destSharedTNCWaitTime,5
,totalWaitTaxi,origTaxiWaitTime + destTaxiWaitTime
,totalWaitSingleTNC,origSingleTNCWaitTime + destSingleTNCWaitTime
,totalWaitSharedTNC,origSharedTNCWaitTime + destSharedTNCWaitTime
#,,
,_free_parking_available,(df.tour_type == 'work') & df.free_parking_at_work if _DF_IS_TOUR else False
,_dest_hourly_peak_parking_cost,"reindex(land_use.PRKCST, df[dest_col_name])"
Expand Down
42 changes: 30 additions & 12 deletions example/configs/tour_mode_choice_coeffs.csv
Expand Up @@ -34,41 +34,59 @@ c_hhsize1_sr,0,0,0,0,0,0,0,0,54.82 * c_ivt,0
c_hhsize2_sr,0,0,0,0,28.38839286 * c_ivt,0,0,28.38839286 * c_ivt,0,0
#indiv tour ASCs,,,,,,,,,,
walk_ASC_no_auto,5.125117111,2.801206737,3.266594735,1.28729901,18.41455742,2.376877423,1.868091482,6.408966934,5.767215561,6.669212684
walk_ASC_auto_decicient,3.274605133,-0.902046556,2.249407533,1.369040422,3.257362412,2.270173198,2.870183935,4.505909886,2.401041643,0.925460911
walk_ASC_auto_deficient,3.274605133,-0.902046556,2.249407533,1.369040422,3.257362412,2.270173198,2.870183935,4.505909886,2.401041643,0.925460911
walk_ASC_auto_sufficient,1.551690381,-0.811606606,1.263347649,0.799963401,0.647685583,0.731266314,1.707218614,1.060766418,0.053265336,0.677215999
bike_ASC_no_auto,0.868070976,-0.716211996,-0.376423218,1.539433341,12.09873445,0.834155474,0.020583211,4.29451543,3.194008732,-0.907258478
bike_ASC_auto_decicient,-1.569110587,-4.527927892,-0.092468342,-1.518464864,-0.528067855,-0.875844687,0.634521411,-0.66923499,0.253189685,-0.807408302
bike_ASC_auto_deficient,-1.569110587,-4.527927892,-0.092468342,-1.518464864,-0.528067855,-0.875844687,0.634521411,-0.66923499,0.253189685,-0.807408302
bike_ASC_auto_sufficient,-1.200347041,-5.063108669,-1.071459675,-2.808302294,-2.113468744,-2.566210272,-1.368070919,-1.939783244,-1.580023134,15.72017028
sr2_ASC_no_auto,0,0,0,0,0,0,0,0,0,0
sr2_ASC_auto_decicient,0.588234462,0,0.660151286,0.262152713,0.124743645,0.244097554,1.855852789,-1.692234683,-0.338031245,-2.110242203
sr2_ASC_auto_deficient,0.588234462,0,0.660151286,0.262152713,0.124743645,0.244097554,1.855852789,-1.692234683,-0.338031245,-2.110242203
sr2_ASC_auto_sufficient,0.862805535,0,0.496846169,0.25817882,-1.606265705,0.197707068,0.523602468,-1.859427005,-1.085745845,-1.445061795
sr3p_ASC_no_auto,0.321999775,-1.81292667,0.272169027,-0.803185378,-6.024082818,-0.279789475,-1.403690228,-6.05600139,-0.583126911,0.582662586
sr3p_ASC_auto_decicient,0.046052359,-0.408187662,1.047096588,-1.349392509,0.714957094,-0.073370165,1.50072437,-1.727742177,-0.852704253,-2.514658092
sr3p_ASC_auto_deficient,0.046052359,-0.408187662,1.047096588,-1.349392509,0.714957094,-0.073370165,1.50072437,-1.727742177,-0.852704253,-2.514658092
sr3p_ASC_auto_sufficient,0.846859553,-0.057412532,0.588502059,-0.075498672,-1.020193438,-0.077571296,0.506178835,-1.904709832,-1.469970203,-1.652174009
walk_transit_ASC_no_auto,2.593636732,-2.217208252,2.243778563,2.564345654,21.38374939,2.106747676,1.381465034,8.786037716,5.035416445,2.704187734
walk_transit_ASC_auto_decicient,-0.038963238,-4.960703718,0.953088412,-3.059725678,4.120707976,-0.847656898,0.974444892,3.136255604,0.653028572,-2.998829183
walk_transit_ASC_auto_deficient,-0.038963238,-4.960703718,0.953088412,-3.059725678,4.120707976,-0.847656898,0.974444892,3.136255604,0.653028572,-2.998829183
walk_transit_ASC_auto_sufficient,-1.112690543,-4.934847012,-0.80636791,-1.547117283,0.745908748,-2.203679837,-0.345375907,0.473116311,-0.89165065,-3.401027004
drive_transit_ASC_no_auto,0,0,0,0,0,0,0,0,0,0
drive_transit_ASC_auto_decicient,0.599806096,-1.153706724,0.319930804,-0.299432268,5.325265625,-0.418491771,1.56271942,1.850117609,0.100815665,-998.8195926
drive_transit_ASC_auto_deficient,0.599806096,-1.153706724,0.319930804,-0.299432268,5.325265625,-0.418491771,1.56271942,1.850117609,0.100815665,-998.8195926
drive_transit_ASC_auto_sufficient,-0.969515832,-4.60142462,-0.378591674,-2.624947672,1.401350042,-2.171893862,-0.615855782,1.358775285,-1.004545986,-999.2146659
taxi_ASC_no_auto,0.5415,0.4206,0.5415,0.4206,-7.0000,0.4206,0.5415,-7.0000,3.3083,3.5519
taxi_ASC_auto_deficient,-3.2876,-0.5186,-3.2876,-0.5186,-0.3338,-0.5186,-3.2876,4.2519,-1.1105,-4.7658
taxi_ASC_auto_sufficient,-2.2887,-2.3106,-2.2887,-2.3106,-2.4294,-2.3106,-2.2887,0.0537,-4.5089,-3.6275
tnc_single_ASC_no_auto,0.1592,-0.0732,0.1592,-0.0732,-7.0000,-0.0732,0.1592,-0.9993,2.6502,3.1470
tnc_single_ASC_auto_deficient,-3.6369,-0.9682,-3.6369,-0.9682,-0.6524,-0.9682,-3.6369,0.3464,-1.6322,-5.0431
tnc_single_ASC_auto_sufficient,-2.8104,-2.8115,-2.8104,-2.8115,-2.8375,-2.8115,-2.8104,-0.4917,-4.9703,-3.9106
tnc_shared_ASC_no_auto,-0.8890,-1.0868,-0.8890,-1.0868,-7.0000,-1.0868,-0.8890,-2.6912,0.7111,1.9189
tnc_shared_ASC_auto_deficient,-4.5876,-1.9093,-4.5876,-1.9093,-1.4746,-1.9093,-4.5876,-2.0394,-2.9216,-5.7572
tnc_shared_ASC_auto_sufficient,-3.9858,-3.7830,-3.9858,-3.7830,-3.7219,-3.7830,-3.9858,-1.6532,-6.1634,-4.7542
joint_walk_ASC_no_auto,-0.21274701,-0.21274701,-0.21274701,-0.21274701,-0.21274701,-0.21274701,-0.21274701,-0.21274701,-0.21274701,-0.21274701
joint_walk_ASC_auto_decicient,-1.960770582,-1.960770582,-1.960770582,-1.960770582,-1.960770582,-1.960770582,-1.960770582,-1.960770582,-1.960770582,-1.960770582
joint_walk_ASC_auto_deficient,-1.960770582,-1.960770582,-1.960770582,-1.960770582,-1.960770582,-1.960770582,-1.960770582,-1.960770582,-1.960770582,-1.960770582
joint_walk_ASC_auto_sufficient,-3.235215607,-3.235215607,-3.235215607,-3.235215607,-3.235215607,-3.235215607,-3.235215607,-3.235215607,-3.235215607,-3.235215607
joint_bike_ASC_no_auto,-2.867159872,-2.867159872,-2.867159872,-2.867159872,-2.867159872,-2.867159872,-2.867159872,-2.867159872,-2.867159872,-2.867159872
joint_bike_ASC_auto_decicient,-6.076415164,-6.076415164,-6.076415164,-6.076415164,-6.076415164,-6.076415164,-6.076415164,-6.076415164,-6.076415164,-6.076415164
joint_bike_ASC_auto_deficient,-6.076415164,-6.076415164,-6.076415164,-6.076415164,-6.076415164,-6.076415164,-6.076415164,-6.076415164,-6.076415164,-6.076415164
joint_bike_ASC_auto_sufficient,-6.376065819,-6.376065819,-6.376065819,-6.376065819,-6.376065819,-6.376065819,-6.376065819,-6.376065819,-6.376065819,-6.376065819
joint_sr2_ASC_no_auto,0,0,0,0,0,0,0,0,0,0
joint_sr2_ASC_auto_decicient,0,0,0,0,0,0,0,0,0,0
joint_sr2_ASC_auto_deficient,0,0,0,0,0,0,0,0,0,0
joint_sr2_ASC_auto_sufficient,0,0,0,0,0,0,0,0,0,0
joint_sr3p_ASC_no_auto,0.563067095,0.563067095,0.563067095,0.563067095,0.563067095,0.563067095,0.563067095,0.563067095,0.563067095,0.563067095
joint_sr3p_ASC_auto_decicient,-1.884169225,-1.884169225,-1.884169225,-1.884169225,-1.884169225,-1.884169225,-1.884169225,-1.884169225,-1.884169225,-1.884169225
joint_sr3p_ASC_auto_deficient,-1.884169225,-1.884169225,-1.884169225,-1.884169225,-1.884169225,-1.884169225,-1.884169225,-1.884169225,-1.884169225,-1.884169225
joint_sr3p_ASC_auto_sufficient,-2.234826088,-2.234826088,-2.234826088,-2.234826088,-2.234826088,-2.234826088,-2.234826088,-2.234826088,-2.234826088,-2.234826088
joint_walk_transit_ASC_no_auto,0.622924164,0.622924164,0.622924164,0.622924164,0.622924164,0.622924164,0.622924164,0.622924164,0.622924164,0.622924164
joint_walk_transit_ASC_auto_decicient,-5.163448126,-5.163448126,-5.163448126,-5.163448126,-5.163448126,-5.163448126,-5.163448126,-5.163448126,-5.163448126,-5.163448126
joint_walk_transit_ASC_auto_deficient,-5.163448126,-5.163448126,-5.163448126,-5.163448126,-5.163448126,-5.163448126,-5.163448126,-5.163448126,-5.163448126,-5.163448126
joint_walk_transit_ASC_auto_sufficient,-18.26453357,-18.26453357,-18.26453357,-18.26453357,-18.26453357,-18.26453357,-18.26453357,-18.26453357,-18.26453357,-18.26453357
joint_drive_transit_ASC_no_auto,0,0,0,0,0,0,0,0,0,0
joint_drive_transit_ASC_auto_decicient,-5.963221337,-5.963221337,-5.963221337,-5.963221337,-5.963221337,-5.963221337,-5.963221337,-5.963221337,-5.963221337,-5.963221337
joint_drive_transit_ASC_auto_deficient,-5.963221337,-5.963221337,-5.963221337,-5.963221337,-5.963221337,-5.963221337,-5.963221337,-5.963221337,-5.963221337,-5.963221337
joint_drive_transit_ASC_auto_sufficient,-8.045285637,-8.045285637,-8.045285637,-8.045285637,-8.045285637,-8.045285637,-8.045285637,-8.045285637,-8.045285637,-8.045285637
joint_taxi_ASC_no_auto,-1.2775,-1.2775,-1.2775,-1.2775,-1.2775,-1.2775,-1.2775,-1.2775,-1.2775,-1.2775
joint_taxi_ASC_auto_deficient,-6.7340,-6.7340,-6.7340,-6.7340,-6.7340,-6.7340,-6.7340,-6.7340,-6.7340,-6.7340
joint_taxi_ASC_auto_sufficient,-7.0000,-7.0000,-7.0000,-7.0000,-7.0000,-7.0000,-7.0000,-7.0000,-7.0000,-7.0000
joint_tnc_single_ASC_no_auto,-1.6608,-1.6608,-1.6608,-1.6608,-1.6608,-1.6608,-1.6608,-1.6608,-1.6608,-1.6608
joint_tnc_single_ASC_auto_deficient,-6.8524,-6.8524,-6.8524,-6.8524,-6.8524,-6.8524,-6.8524,-6.8524,-6.8524,-6.8524
joint_tnc_single_ASC_auto_sufficient,-7.0000,-7.0000,-7.0000,-7.0000,-7.0000,-7.0000,-7.0000,-7.0000,-7.0000,-7.0000
joint_tnc_shared_ASC_no_auto,-1.9348,-1.9348,-1.9348,-1.9348,-1.9348,-1.9348,-1.9348,-1.9348,-1.9348,-1.9348
joint_tnc_shared_ASC_auto_deficient,-7.1600,-7.1600,-7.1600,-7.1600,-7.1600,-7.1600,-7.1600,-7.1600,-7.1600,-7.1600
joint_tnc_shared_ASC_auto_sufficient,-7.0000,-7.0000,-7.0000,-7.0000,-7.0000,-7.0000,-7.0000,-7.0000,-7.0000,-7.0000
#c,,,,,,,,,,
local_bus_ASC,-0.090703267,-0.090703267,-0.090703267,-0.090703267,-0.065086209,-0.090703267,-0.090703267,-0.065086209,0.066895065,-0.090703267
walk_light_rail_ASC,0.76895473,0.76895473,0.76895473,0.76895473,1.681400281,0.76895473,0.76895473,1.681400281,0.825556718,0.76895473
Expand Down

0 comments on commit a6fd71d

Please sign in to comment.