Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,11 @@ jobs:
# as the pre-installed one is the latest release but not the most up-to-date
- name: Install ActivitySim
run: |
uv pip uninstall activitysim
uv pip install --no-deps ./cloned/activitysim

- name: Test this implementation
run: |
uv run pytest ./test
source .venv/bin/activate
pytest ./test

4 changes: 2 additions & 2 deletions configs/resident/cdap_indiv_and_hhsize1.csv
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Base works from home 2016,(work_from_home),,coef_base_work_from_home_2016_N,
Part time worker who works from home,(ptype == 2) & (work_from_home),,coef_part_time_worker_work_from_home_N,
Part time worker who works from home,@(df.ptype == 2) & (df.work_from_home) & (PRE_COVID),,coef_part_time_worker_work_from_home_2016_N,
Telecommutes 1 day per week,telecommute_frequency=='1_day_week',,coef_telecommute_1_day_week_N,coef_telecommute_1_day_week_H
Telecommutes 2-3 days per week,telecommute_frequency=='2_3_days_week',,coef_telecommute_2_3_days_week_N,coef_telecommute_2_3_days_week_H
Telecommutes 2-3 days per week,@(df.telecommute_frequency=='2_days_week') | (df.telecommute_frequency=='3_days_week'),,coef_telecommute_2_3_days_week_N,coef_telecommute_2_3_days_week_H
Telecommutes 4 days per week,telecommute_frequency=='4_days_week',,coef_telecommute_4_days_week_N,coef_telecommute_4_days_week_H
Full-time worker 2016 ASC,@(df.ptype == 1) & (PRE_COVID),coef_full_time_worker_2016_asc_M,coef_full_time_worker_2016_asc_N,
Part-time worker 2016 ASC,@(df.ptype == 2) & (PRE_COVID),coef_part_time_worker_2016_asc_M,coef_part_time_worker_2016_asc_N,
Expand All @@ -36,7 +36,7 @@ Driving-age child who is in school 2016 ASC,@(df.ptype == 6) & (PRE_COVID),coef_
Pre-driving-age child who is in school 2016 ASC,@(df.ptype == 7) & (PRE_COVID),coef_pre_driving_age_child_2016_asc_M,coef_pre_driving_age_child_2016_asc_N,
Preschool child 2016 ASC,@(df.ptype == 8) & (PRE_COVID),coef_preschool_child_2016_asc_M,coef_preschool_child_2016_asc_N,
Telecommutes 1 day per week 2016,@(df.telecommute_frequency=='1_day_week') & (PRE_COVID),,coef_telecommute_1_day_week_2016_N,coef_telecommute_1_day_week_2016_H
Telecommutes 2-3 days per week 2016,@(df.telecommute_frequency=='2_3_days_week') & (PRE_COVID),,coef_telecommute_2_3_days_week_2016_N,coef_telecommute_2_3_days_week_2016_H
Telecommutes 2-3 days per week 2016,@((df.telecommute_frequency=='2_days_week') | (df.telecommute_frequency=='3_days_week')) & (PRE_COVID),,coef_telecommute_2_3_days_week_2016_N,coef_telecommute_2_3_days_week_2016_H
Telecommutes 4 days per week 2016,@(df.telecommute_frequency=='4_days_week') & (PRE_COVID),,coef_telecommute_4_days_week_2016_N,coef_telecommute_4_days_week_2016_H
Mandatory pattern unavailable if not worker or student,(is_student == False) & (is_worker == False),coef_UNAVAILABLE,,
Mandatory pattern unavailable if not works from home,(work_from_home == True) & (is_student == False),coef_UNAVAILABLE,,
Expand Down
4 changes: 2 additions & 2 deletions configs/resident/non_mandatory_tour_frequency.csv
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ util_othdiscr_accessibility_visiting,Retail Accessibility for Visiting,othdiscr_
# work from home and telecommute_frequency,,,,,,,,,,
util_work_from_home_and_iNM_tour_freq_2,Work From Home & Tour Frequency =2,(work_from_home) & (_total_indNM_tours == 2),coef_work_from_home_and_iNM_tour_freq_2,,,,,,,
util_work_from_home_and_iNM_tour_freq_3p,Work From Home & Tour Frequency =3p,(work_from_home) & (_total_indNM_tours >= 3),coef_work_from_home_and_iNM_tour_freq_3p,,,,,,,
util_telecommute_2_3_days_week_and_iNM_tour_freq_2,Telecommute 1 day per week & Tour Frequency =2,(telecommute_frequency == '2_3_days_week') & (_total_indNM_tours == 2),coef_telecommute_2_3_4_days_week_and_iNM_tour_freq_2,,,,,,,
util_telecommute_2_3_days_week_and_iNM_tour_freq_3p,Telecommute 1 day per week & Tour Frequency =3p,(telecommute_frequency == '2_3_days_week') & (_total_indNM_tours >= 3),coef_telecommute_2_3_4_days_week_and_iNM_tour_freq_3p,,,,,,,
util_telecommute_2_3_days_week_and_iNM_tour_freq_2,Telecommute 1 day per week & Tour Frequency =2,@((df.telecommute_frequency=='2_days_week') | (df.telecommute_frequency=='3_days_week')) & (_total_indNM_tours == 2),coef_telecommute_2_3_4_days_week_and_iNM_tour_freq_2,,,,,,,
util_telecommute_2_3_days_week_and_iNM_tour_freq_3p,Telecommute 1 day per week & Tour Frequency =3p,@((df.telecommute_frequency=='2_days_week') | (df.telecommute_frequency=='3_days_week')) & (_total_indNM_tours >= 3),coef_telecommute_2_3_4_days_week_and_iNM_tour_freq_3p,,,,,,,
util_telecommute_4_days_week_and_iNM_tour_freq_1,Telecommute 1 day per week & Tour Frequency =1,(telecommute_frequency == '4_days_week') & (_total_indNM_tours == 1),,coef_telecommute_4_days_week_and_iNM_tour_freq_1,,,,,,
util_telecommute_4_days_week_and_iNM_tour_freq_2,Telecommute 1 day per week & Tour Frequency =2,(telecommute_frequency == '4_days_week') & (_total_indNM_tours == 2),coef_telecommute_2_3_4_days_week_and_iNM_tour_freq_2,,,,,,,
util_telecommute_4_days_week_and_iNM_tour_freq_3p,Telecommute 1 day per week & Tour Frequency =3p,(telecommute_frequency == '4_days_week') & (_total_indNM_tours >= 3),coef_telecommute_2_3_4_days_week_and_iNM_tour_freq_3p,,,,,,,
1 change: 1 addition & 0 deletions configs/resident/settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ models:
- transponder_ownership
- free_parking
- telecommute_frequency
- telecommute_status
- cdap_simulate
- mandatory_tour_frequency
- mandatory_tour_scheduling
Expand Down
65 changes: 33 additions & 32 deletions configs/resident/telecommute_frequency.csv
Original file line number Diff line number Diff line change
@@ -1,32 +1,33 @@
Label,Description,Expression,No_Telecommute,1_day_week,2_3_days_week,4_days_week
util_HasChildren0to5,Has children 0 to 5 years old,@df.num_young_children>0,,coef_HasChildren0to5_1day,coef_HasChildren0to5_234day,coef_HasChildren0to5_234day
util_HasChildren6to12,Has children 6 to 12 years old,@df.num_children_6_to_12>0,,coef_HasChildren6to12_1day,coef_HasChildren6to12_23day,coef_HasChildren6to12_4day
util_OneAdultInHH,One adult in hh,@df.num_adults==1,,coef_OneAdultInHH_1day,coef_OneAdultInHH_23day,coef_OneAdultInHH_4day
util_Female,female,@df.female,,coef_Female_1234day,coef_Female_1234day,coef_Female_1234day
util_PartTimeWorker,Part-time worker,@df.pemploy==2,,coef_PartTimeWorker_1234day,coef_PartTimeWorker_1234day,coef_PartTimeWorker_1234day
util_Income60to100k,Income 60-100k,"@df.income.between(60000, 100000)",,coef_Income60to100k_1day,coef_Income60to100k_23day,coef_Income60to100k_4day
util_Income100to150k,Income 100-150k,"@df.income.between(100000, 150000)",,coef_Income100to150k_1day,coef_Income100to150k_234day,coef_Income100to150k_234day
util_Income150kplus,Income 150k+,@df.income > 150000,,coef_Income150kplus_1day,coef_Income150kplus_23day,coef_Income150kplus_4day
util_0Autos,0 Autos,@df.auto_ownership==0,,coef_0Autos_1day,coef_0Autos_234day,coef_0Autos_234day
util_1Auto,1 Auto,@df.auto_ownership==1,,coef_1Auto_1day,coef_1Auto_234day,coef_1Auto_234day
util_3plusAutos,3+ Autos,@df.auto_ownership>=3,,coef_3plusAutos_1day,coef_3plusAutos_23day,coef_3plusAutos_4day
util_DistanceToWork,Distance to work,@df.distance_to_work,,coef_DistanceToWork_1day,coef_DistanceToWork_234day,coef_DistanceToWork_234day
util_calib_2020,scenario year is 2020,@scenarioYear==2020,,coef_calib_2020_1day,coef_calib_2020_23day,coef_calib_2020_4day
util_calib_2025,scenario year is 2025,@scenarioYear==2025,,coef_calib_2025_1day,coef_calib_2025_23day,coef_calib_2025_4day
util_calib_2035,scenario year is 2035,@scenarioYear==2035,,coef_calib_2035_1day,coef_calib_2035_23day,coef_calib_2035_4day
util_calib_2050,scenario year is 2050,@scenarioYear==2050,,coef_calib_2050_1day,coef_calib_2050_23day,coef_calib_2050_4day
util_2016,Model year is 2016,@PRE_COVID,,coef_2016_1day,coef_2016_23day,coef_2016_4day
util_accomodation,Accomodation industry,@df.naics_code==721,,coef_accomodation_1234day,coef_accomodation_1234day,coef_accomodation_1234day
util_agriculture,Agriculture industry,@df.naics_code==11,,coef_agriculture_1234day,coef_agriculture_1234day,coef_agriculture_1234day
util_business_srv,Business services industry,@df.naics_code==54,,coef_business_srv_1day,coef_business_srv_23day,coef_business_srv_4day
util_construction,Construction industry,@df.naics_code==23,,coef_construction_1day,coef_construction_234day,coef_construction_234day
util_education,Education industry,@df.naics_code==61,,coef_education_1234day,coef_education_1234day,coef_education_1234day
util_entertainment,Entertainment industry,@df.naics_code==71,,coef_entertainment_1day,coef_entertainment_23day,coef_entertainment_4day
util_food_srv,Food services industry,@df.naics_code==722,,coef_food_srv_1234day,coef_food_srv_1234day,coef_food_srv_1234day
util_government,Government industry,@df.naics_code==92,,coef_government_1day,coef_government_234day,coef_government_234day
util_healthcare,Healthcare industry,@df.naics_code==62,,coef_healthcare_1234day,coef_healthcare_1234day,coef_healthcare_1234day
util_manufacturing,Manufacturing industry,"@df.naics_code.isin([31,32,33])",,coef_manufacturing_1day,coef_manufacturing_234day,coef_manufacturing_234day
util_mgmt_srv,Management services industry,@df.naics_code==55,,coef_mgmt_srv_1day,coef_mgmt_srv_23day,coef_mgmt_srv_4day
util_military,Miliary industry,@df.naics_code==9000,,coef_military_1day,coef_military_234day,coef_military_234day
util_retail,Retail industry,"@df.naics_code.isin([44,45])",,coef_retail_1day,coef_retail_23day,coef_retail_4day
util_asc,Alternative specific constant,1,,asc_1day,asc_23day,asc_4day
Label,Description,Expression,No_Telecommute,1_day_week,2_days_week,3_days_week,4_days_week
util_HasChildren0to5,Has children 0 to 5 years old,@df.num_young_children>0,,coef_HasChildren0to5_1day,coef_HasChildren0to5_234day,coef_HasChildren0to5_234day,coef_HasChildren0to5_234day
util_HasChildren6to12,Has children 6 to 12 years old,@df.num_children_6_to_12>0,,coef_HasChildren6to12_1day,coef_HasChildren6to12_23day,coef_HasChildren6to12_23day,coef_HasChildren6to12_4day
util_OneAdultInHH,One adult in hh,@df.num_adults==1,,coef_OneAdultInHH_1day,coef_OneAdultInHH_23day,coef_OneAdultInHH_23day,coef_OneAdultInHH_4day
util_Female,female,@df.female,,coef_Female_1234day,coef_Female_1234day,coef_Female_1234day,coef_Female_1234day
util_PartTimeWorker,Part-time worker,@df.pemploy==2,,coef_PartTimeWorker_1234day,coef_PartTimeWorker_1234day,coef_PartTimeWorker_1234day,coef_PartTimeWorker_1234day
util_Income60to100k,Income 60-100k,"@df.income.between(60000, 100000)",,coef_Income60to100k_1day,coef_Income60to100k_23day,coef_Income60to100k_23day,coef_Income60to100k_4day
util_Income100to150k,Income 100-150k,"@df.income.between(100000, 150000)",,coef_Income100to150k_1day,coef_Income100to150k_234day,coef_Income100to150k_234day,coef_Income100to150k_234day
util_Income150kplus,Income 150k+,@df.income > 150000,,coef_Income150kplus_1day,coef_Income150kplus_23day,coef_Income150kplus_23day,coef_Income150kplus_4day
util_0Autos,0 Autos,@df.auto_ownership==0,,coef_0Autos_1day,coef_0Autos_234day,coef_0Autos_234day,coef_0Autos_234day
util_1Auto,1 Auto,@df.auto_ownership==1,,coef_1Auto_1day,coef_1Auto_234day,coef_1Auto_234day,coef_1Auto_234day
util_3plusAutos,3+ Autos,@df.auto_ownership>=3,,coef_3plusAutos_1day,coef_3plusAutos_23day,coef_3plusAutos_23day,coef_3plusAutos_4day
util_DistanceToWork,Distance to work,@df.distance_to_work,,coef_DistanceToWork_1day,coef_DistanceToWork_234day,coef_DistanceToWork_234day,coef_DistanceToWork_234day
util_calib_2020,scenario year is 2020,@scenarioYear==2020,,coef_calib_2020_1day,coef_calib_2020_23day,coef_calib_2020_23day,coef_calib_2020_4day
util_calib_2025,scenario year is 2025,@scenarioYear==2025,,coef_calib_2025_1day,coef_calib_2025_23day,coef_calib_2025_23day,coef_calib_2025_4day
util_calib_2035,scenario year is 2035,@scenarioYear==2035,,coef_calib_2035_1day,coef_calib_2035_23day,coef_calib_2035_23day,coef_calib_2035_4day
util_calib_2050,scenario year is 2050,@scenarioYear==2050,,coef_calib_2050_1day,coef_calib_2050_23day,coef_calib_2050_23day,coef_calib_2050_4day
util_2016,Model year is 2016,@PRE_COVID,,coef_2016_1day,coef_2016_23day,coef_2016_23day,coef_2016_4day
util_accomodation,Accomodation industry,@df.naics_code==721,,coef_accomodation_1234day,coef_accomodation_1234day,coef_accomodation_1234day,coef_accomodation_1234day
util_agriculture,Agriculture industry,@df.naics_code==11,,coef_agriculture_1234day,coef_agriculture_1234day,coef_agriculture_1234day,coef_agriculture_1234day
util_business_srv,Business services industry,@df.naics_code==54,,coef_business_srv_1day,coef_business_srv_23day,coef_business_srv_23day,coef_business_srv_4day
util_construction,Construction industry,@df.naics_code==23,,coef_construction_1day,coef_construction_234day,coef_construction_234day,coef_construction_234day
util_education,Education industry,@df.naics_code==61,,coef_education_1234day,coef_education_1234day,coef_education_1234day,coef_education_1234day
util_entertainment,Entertainment industry,@df.naics_code==71,,coef_entertainment_1day,coef_entertainment_23day,coef_entertainment_23day,coef_entertainment_4day
util_food_srv,Food services industry,@df.naics_code==722,,coef_food_srv_1234day,coef_food_srv_1234day,coef_food_srv_1234day,coef_food_srv_1234day
util_government,Government industry,@df.naics_code==92,,coef_government_1day,coef_government_234day,coef_government_234day,coef_government_234day
util_healthcare,Healthcare industry,@df.naics_code==62,,coef_healthcare_1234day,coef_healthcare_1234day,coef_healthcare_1234day,coef_healthcare_1234day
util_manufacturing,Manufacturing industry,"@df.naics_code.isin([31,32,33])",,coef_manufacturing_1day,coef_manufacturing_234day,coef_manufacturing_234day,coef_manufacturing_234day
util_mgmt_srv,Management services industry,@df.naics_code==55,,coef_mgmt_srv_1day,coef_mgmt_srv_23day,coef_mgmt_srv_23day,coef_mgmt_srv_4day
util_military,Miliary industry,@df.naics_code==9000,,coef_military_1day,coef_military_234day,coef_military_234day,coef_military_234day
util_retail,Retail industry,"@df.naics_code.isin([44,45])",,coef_retail_1day,coef_retail_23day,coef_retail_23day,coef_retail_4day
util_asc,Alternative specific constant,1,,asc_1day,asc_23day,asc_23day,asc_4day
util_split_2_3_days_constant, Constant for splitting 2_3_days telecommute frequency,@np.log(0.5),,,1,1,
11 changes: 11 additions & 0 deletions configs/resident/telecommute_status.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Label,Description,Expression,telecommuting,commuting
util_no_commute,commute 0 day a week,@df.work_from_home,,coef_unavailable
util_no_telecommute,telecommute 0 day a week,@df.telecommute_frequency=='No_Telecommute',coef_unavailable,
util_commute_1_day_a_week,commute to work 1 day a week,@(df.telecommute_frequency=='4_days_week') * np.log(1),,coef_one
util_telecommute_4_days_a_week,telecommute 4 days a week,@(df.telecommute_frequency=='4_days_week') * np.log(4),coef_one,
util_commute_2_days_a_week,commute to work 2 days a week,@(df.telecommute_frequency=='3_days_week') * np.log(2),,coef_one
util_telecommute_3_days_a_week,telecommute 3 days a week,@(df.telecommute_frequency=='3_days_week') * np.log(3),coef_one,
util_commute_3_days_a_week,commute to work 3 days a week,@(df.telecommute_frequency=='2_days_week') * np.log(3),,coef_one
util_telecommute_2_days_a_week,telecommute 2 days a week,@(df.telecommute_frequency=='2_days_week') * np.log(2),coef_one,
util_commute_4_days_a_week,commute to work 4 days a week,@(df.telecommute_frequency=='1_day_week') * np.log(4),,coef_one
util_telecommute_1_day_a_week,telecommute 1 day a week,@(df.telecommute_frequency=='1_day_week') * np.log(1),coef_one,
6 changes: 6 additions & 0 deletions configs/resident/telecommute_status.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
SPEC: telecommute_status.csv
COEFFICIENTS: telecommute_status_coeffs.csv

LOGIT_TYPE: MNL

TELECOMMUTE_ALT: 0
3 changes: 3 additions & 0 deletions configs/resident/telecommute_status_coeffs.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
coefficient_name,value,constrain
coef_unavailable,-999,F
coef_one,1,F
Loading