Skip to content

Commit 788a4de

Browse files
authored
Merge pull request #30 from wsp-sag/explicit_telecommute
Example model configs for `telecommute_status` model
2 parents 81121b7 + 98bd0e1 commit 788a4de

File tree

202 files changed

+25893
-5940
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

202 files changed

+25893
-5940
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,11 @@ jobs:
5151
# as the pre-installed one is the latest release but not the most up-to-date
5252
- name: Install ActivitySim
5353
run: |
54+
uv pip uninstall activitysim
5455
uv pip install --no-deps ./cloned/activitysim
5556
5657
- name: Test this implementation
5758
run: |
58-
uv run pytest ./test
59+
source .venv/bin/activate
60+
pytest ./test
5961

configs/resident/cdap_indiv_and_hhsize1.csv

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Base works from home 2016,(work_from_home),,coef_base_work_from_home_2016_N,
2525
Part time worker who works from home,(ptype == 2) & (work_from_home),,coef_part_time_worker_work_from_home_N,
2626
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,
2727
Telecommutes 1 day per week,telecommute_frequency=='1_day_week',,coef_telecommute_1_day_week_N,coef_telecommute_1_day_week_H
28-
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
28+
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
2929
Telecommutes 4 days per week,telecommute_frequency=='4_days_week',,coef_telecommute_4_days_week_N,coef_telecommute_4_days_week_H
3030
Full-time worker 2016 ASC,@(df.ptype == 1) & (PRE_COVID),coef_full_time_worker_2016_asc_M,coef_full_time_worker_2016_asc_N,
3131
Part-time worker 2016 ASC,@(df.ptype == 2) & (PRE_COVID),coef_part_time_worker_2016_asc_M,coef_part_time_worker_2016_asc_N,
@@ -36,7 +36,7 @@ Driving-age child who is in school 2016 ASC,@(df.ptype == 6) & (PRE_COVID),coef_
3636
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,
3737
Preschool child 2016 ASC,@(df.ptype == 8) & (PRE_COVID),coef_preschool_child_2016_asc_M,coef_preschool_child_2016_asc_N,
3838
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
39-
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
39+
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
4040
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
4141
Mandatory pattern unavailable if not worker or student,(is_student == False) & (is_worker == False),coef_UNAVAILABLE,,
4242
Mandatory pattern unavailable if not works from home,(work_from_home == True) & (is_student == False),coef_UNAVAILABLE,,

configs/resident/non_mandatory_tour_frequency.csv

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ util_othdiscr_accessibility_visiting,Retail Accessibility for Visiting,othdiscr_
105105
# work from home and telecommute_frequency,,,,,,,,,,
106106
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,,,,,,,
107107
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,,,,,,,
108-
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,,,,,,,
109-
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,,,,,,,
108+
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,,,,,,,
109+
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,,,,,,,
110110
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,,,,,,
111111
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,,,,,,,
112112
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,,,,,,,

configs/resident/settings.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ models:
179179
- transponder_ownership
180180
- free_parking
181181
- telecommute_frequency
182+
- telecommute_status
182183
- cdap_simulate
183184
- mandatory_tour_frequency
184185
- mandatory_tour_scheduling
Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,33 @@
1-
Label,Description,Expression,No_Telecommute,1_day_week,2_3_days_week,4_days_week
2-
util_HasChildren0to5,Has children 0 to 5 years old,@df.num_young_children>0,,coef_HasChildren0to5_1day,coef_HasChildren0to5_234day,coef_HasChildren0to5_234day
3-
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
4-
util_OneAdultInHH,One adult in hh,@df.num_adults==1,,coef_OneAdultInHH_1day,coef_OneAdultInHH_23day,coef_OneAdultInHH_4day
5-
util_Female,female,@df.female,,coef_Female_1234day,coef_Female_1234day,coef_Female_1234day
6-
util_PartTimeWorker,Part-time worker,@df.pemploy==2,,coef_PartTimeWorker_1234day,coef_PartTimeWorker_1234day,coef_PartTimeWorker_1234day
7-
util_Income60to100k,Income 60-100k,"@df.income.between(60000, 100000)",,coef_Income60to100k_1day,coef_Income60to100k_23day,coef_Income60to100k_4day
8-
util_Income100to150k,Income 100-150k,"@df.income.between(100000, 150000)",,coef_Income100to150k_1day,coef_Income100to150k_234day,coef_Income100to150k_234day
9-
util_Income150kplus,Income 150k+,@df.income > 150000,,coef_Income150kplus_1day,coef_Income150kplus_23day,coef_Income150kplus_4day
10-
util_0Autos,0 Autos,@df.auto_ownership==0,,coef_0Autos_1day,coef_0Autos_234day,coef_0Autos_234day
11-
util_1Auto,1 Auto,@df.auto_ownership==1,,coef_1Auto_1day,coef_1Auto_234day,coef_1Auto_234day
12-
util_3plusAutos,3+ Autos,@df.auto_ownership>=3,,coef_3plusAutos_1day,coef_3plusAutos_23day,coef_3plusAutos_4day
13-
util_DistanceToWork,Distance to work,@df.distance_to_work,,coef_DistanceToWork_1day,coef_DistanceToWork_234day,coef_DistanceToWork_234day
14-
util_calib_2020,scenario year is 2020,@scenarioYear==2020,,coef_calib_2020_1day,coef_calib_2020_23day,coef_calib_2020_4day
15-
util_calib_2025,scenario year is 2025,@scenarioYear==2025,,coef_calib_2025_1day,coef_calib_2025_23day,coef_calib_2025_4day
16-
util_calib_2035,scenario year is 2035,@scenarioYear==2035,,coef_calib_2035_1day,coef_calib_2035_23day,coef_calib_2035_4day
17-
util_calib_2050,scenario year is 2050,@scenarioYear==2050,,coef_calib_2050_1day,coef_calib_2050_23day,coef_calib_2050_4day
18-
util_2016,Model year is 2016,@PRE_COVID,,coef_2016_1day,coef_2016_23day,coef_2016_4day
19-
util_accomodation,Accomodation industry,@df.naics_code==721,,coef_accomodation_1234day,coef_accomodation_1234day,coef_accomodation_1234day
20-
util_agriculture,Agriculture industry,@df.naics_code==11,,coef_agriculture_1234day,coef_agriculture_1234day,coef_agriculture_1234day
21-
util_business_srv,Business services industry,@df.naics_code==54,,coef_business_srv_1day,coef_business_srv_23day,coef_business_srv_4day
22-
util_construction,Construction industry,@df.naics_code==23,,coef_construction_1day,coef_construction_234day,coef_construction_234day
23-
util_education,Education industry,@df.naics_code==61,,coef_education_1234day,coef_education_1234day,coef_education_1234day
24-
util_entertainment,Entertainment industry,@df.naics_code==71,,coef_entertainment_1day,coef_entertainment_23day,coef_entertainment_4day
25-
util_food_srv,Food services industry,@df.naics_code==722,,coef_food_srv_1234day,coef_food_srv_1234day,coef_food_srv_1234day
26-
util_government,Government industry,@df.naics_code==92,,coef_government_1day,coef_government_234day,coef_government_234day
27-
util_healthcare,Healthcare industry,@df.naics_code==62,,coef_healthcare_1234day,coef_healthcare_1234day,coef_healthcare_1234day
28-
util_manufacturing,Manufacturing industry,"@df.naics_code.isin([31,32,33])",,coef_manufacturing_1day,coef_manufacturing_234day,coef_manufacturing_234day
29-
util_mgmt_srv,Management services industry,@df.naics_code==55,,coef_mgmt_srv_1day,coef_mgmt_srv_23day,coef_mgmt_srv_4day
30-
util_military,Miliary industry,@df.naics_code==9000,,coef_military_1day,coef_military_234day,coef_military_234day
31-
util_retail,Retail industry,"@df.naics_code.isin([44,45])",,coef_retail_1day,coef_retail_23day,coef_retail_4day
32-
util_asc,Alternative specific constant,1,,asc_1day,asc_23day,asc_4day
1+
Label,Description,Expression,No_Telecommute,1_day_week,2_days_week,3_days_week,4_days_week
2+
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
3+
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
4+
util_OneAdultInHH,One adult in hh,@df.num_adults==1,,coef_OneAdultInHH_1day,coef_OneAdultInHH_23day,coef_OneAdultInHH_23day,coef_OneAdultInHH_4day
5+
util_Female,female,@df.female,,coef_Female_1234day,coef_Female_1234day,coef_Female_1234day,coef_Female_1234day
6+
util_PartTimeWorker,Part-time worker,@df.pemploy==2,,coef_PartTimeWorker_1234day,coef_PartTimeWorker_1234day,coef_PartTimeWorker_1234day,coef_PartTimeWorker_1234day
7+
util_Income60to100k,Income 60-100k,"@df.income.between(60000, 100000)",,coef_Income60to100k_1day,coef_Income60to100k_23day,coef_Income60to100k_23day,coef_Income60to100k_4day
8+
util_Income100to150k,Income 100-150k,"@df.income.between(100000, 150000)",,coef_Income100to150k_1day,coef_Income100to150k_234day,coef_Income100to150k_234day,coef_Income100to150k_234day
9+
util_Income150kplus,Income 150k+,@df.income > 150000,,coef_Income150kplus_1day,coef_Income150kplus_23day,coef_Income150kplus_23day,coef_Income150kplus_4day
10+
util_0Autos,0 Autos,@df.auto_ownership==0,,coef_0Autos_1day,coef_0Autos_234day,coef_0Autos_234day,coef_0Autos_234day
11+
util_1Auto,1 Auto,@df.auto_ownership==1,,coef_1Auto_1day,coef_1Auto_234day,coef_1Auto_234day,coef_1Auto_234day
12+
util_3plusAutos,3+ Autos,@df.auto_ownership>=3,,coef_3plusAutos_1day,coef_3plusAutos_23day,coef_3plusAutos_23day,coef_3plusAutos_4day
13+
util_DistanceToWork,Distance to work,@df.distance_to_work,,coef_DistanceToWork_1day,coef_DistanceToWork_234day,coef_DistanceToWork_234day,coef_DistanceToWork_234day
14+
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
15+
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
16+
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
17+
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
18+
util_2016,Model year is 2016,@PRE_COVID,,coef_2016_1day,coef_2016_23day,coef_2016_23day,coef_2016_4day
19+
util_accomodation,Accomodation industry,@df.naics_code==721,,coef_accomodation_1234day,coef_accomodation_1234day,coef_accomodation_1234day,coef_accomodation_1234day
20+
util_agriculture,Agriculture industry,@df.naics_code==11,,coef_agriculture_1234day,coef_agriculture_1234day,coef_agriculture_1234day,coef_agriculture_1234day
21+
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
22+
util_construction,Construction industry,@df.naics_code==23,,coef_construction_1day,coef_construction_234day,coef_construction_234day,coef_construction_234day
23+
util_education,Education industry,@df.naics_code==61,,coef_education_1234day,coef_education_1234day,coef_education_1234day,coef_education_1234day
24+
util_entertainment,Entertainment industry,@df.naics_code==71,,coef_entertainment_1day,coef_entertainment_23day,coef_entertainment_23day,coef_entertainment_4day
25+
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
26+
util_government,Government industry,@df.naics_code==92,,coef_government_1day,coef_government_234day,coef_government_234day,coef_government_234day
27+
util_healthcare,Healthcare industry,@df.naics_code==62,,coef_healthcare_1234day,coef_healthcare_1234day,coef_healthcare_1234day,coef_healthcare_1234day
28+
util_manufacturing,Manufacturing industry,"@df.naics_code.isin([31,32,33])",,coef_manufacturing_1day,coef_manufacturing_234day,coef_manufacturing_234day,coef_manufacturing_234day
29+
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
30+
util_military,Miliary industry,@df.naics_code==9000,,coef_military_1day,coef_military_234day,coef_military_234day,coef_military_234day
31+
util_retail,Retail industry,"@df.naics_code.isin([44,45])",,coef_retail_1day,coef_retail_23day,coef_retail_23day,coef_retail_4day
32+
util_asc,Alternative specific constant,1,,asc_1day,asc_23day,asc_23day,asc_4day
33+
util_split_2_3_days_constant, Constant for splitting 2_3_days telecommute frequency,@np.log(0.5),,,1,1,
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Label,Description,Expression,telecommuting,commuting
2+
util_no_commute,commute 0 day a week,@df.work_from_home,,coef_unavailable
3+
util_no_telecommute,telecommute 0 day a week,@df.telecommute_frequency=='No_Telecommute',coef_unavailable,
4+
util_commute_1_day_a_week,commute to work 1 day a week,@(df.telecommute_frequency=='4_days_week') * np.log(1),,coef_one
5+
util_telecommute_4_days_a_week,telecommute 4 days a week,@(df.telecommute_frequency=='4_days_week') * np.log(4),coef_one,
6+
util_commute_2_days_a_week,commute to work 2 days a week,@(df.telecommute_frequency=='3_days_week') * np.log(2),,coef_one
7+
util_telecommute_3_days_a_week,telecommute 3 days a week,@(df.telecommute_frequency=='3_days_week') * np.log(3),coef_one,
8+
util_commute_3_days_a_week,commute to work 3 days a week,@(df.telecommute_frequency=='2_days_week') * np.log(3),,coef_one
9+
util_telecommute_2_days_a_week,telecommute 2 days a week,@(df.telecommute_frequency=='2_days_week') * np.log(2),coef_one,
10+
util_commute_4_days_a_week,commute to work 4 days a week,@(df.telecommute_frequency=='1_day_week') * np.log(4),,coef_one
11+
util_telecommute_1_day_a_week,telecommute 1 day a week,@(df.telecommute_frequency=='1_day_week') * np.log(1),coef_one,
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
SPEC: telecommute_status.csv
2+
COEFFICIENTS: telecommute_status_coeffs.csv
3+
4+
LOGIT_TYPE: MNL
5+
6+
TELECOMMUTE_ALT: 0
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
coefficient_name,value,constrain
2+
coef_unavailable,-999,F
3+
coef_one,1,F

0 commit comments

Comments
 (0)