Skip to content
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

TM1.6.1: Use updated data, etc. #75

Open
wants to merge 184 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
184 commits
Select commit Hold shift + click to select a range
25fb8c1
initial edits to incorporate min_vtoll in HwySkims.job (updates comin…
FlaviaTsang Feb 9, 2024
cb58053
set minimum toll, except when vtoll is 0 as it indicates no toll path
FlaviaTsang Feb 9, 2024
a677071
Propagate min_vtoll from params.properties --> runtimeconfiguration.p…
FlaviaTsang Feb 11, 2024
964ab59
updated details in comments re. ACTC min toll
FlaviaTsang Feb 13, 2024
a41f77e
update properties file for NGF NoProject
FlaviaTsang Feb 13, 2024
8de8800
updating the properties file for RTP2025, for 2023 model year for now
FlaviaTsang Feb 13, 2024
0356797
renaming the properties file with "min_vtoll =" (this is needed to re…
FlaviaTsang Apr 11, 2024
3a61153
Update WFH models using PUMS2022 data
lmz Jul 31, 2024
3fbf6e9
Remove unused Readme
lmz Aug 1, 2024
c24dfb2
Rename BART_Transit_Hesitance -> Rail_Transit_Hesitance
lmz Sep 17, 2024
058631d
Update WFH scaling factors slightly to achieve 2015 and 2023 targets
lmz Sep 19, 2024
0fa97cd
Reduce Work_Transit_Hesitance and WFH_PartTimeWorker_Factor slightly
lmz Sep 24, 2024
e1ab325
Initial revision of script to summarize BART to annual weekday riders…
lmz Oct 1, 2024
1019fc0
Reduce Rail_Transit_Hesitance to 68
lmz Oct 1, 2024
3039725
Merge pull request #71 from BayAreaMetro/min_vtoll
lmz Oct 9, 2024
1407c24
Add min_vtoll to 2015 and 2023 config
lmz Oct 10, 2024
84af683
Initial implementation of distance-based term (linear on distance) fo…
lmz Oct 15, 2024
2ffac82
Add WFHDistanceFactor values for first test runs
lmz Oct 18, 2024
1782b07
Add another level of precision to WFHDistanceFactor
lmz Oct 18, 2024
16a9c97
Rename files with underscores and with consistency
lmz Oct 18, 2024
5d7da45
Update build date
lmz Oct 21, 2024
9bb5474
Update runtime\mtc.jar with distance-based WFH term
lmz Oct 21, 2024
d233a0c
Update to calculate household income allocation to HHINQ categories o…
lmz Oct 22, 2024
4bf4d77
Initial commit
lmz Oct 26, 2024
550a04e
Create wfh variable
lmz Oct 26, 2024
8bd38cf
Locate home and work to TAZ
lmz Oct 26, 2024
c83a3cb
Add some models
lmz Oct 27, 2024
256ac30
NOP; for readability
lmz Oct 27, 2024
ab43a83
Convert household income to 2000 dollars
lmz Oct 27, 2024
21cf6d7
Fix indent error
lmz Oct 27, 2024
462d4c1
Filter out NaN empsix and leave out reference dummies
lmz Oct 27, 2024
c4d0d41
Fix formula typo (NOP)
lmz Oct 27, 2024
d839fcd
Add home county as dummy variable and as segmented
lmz Oct 27, 2024
3bcfcb4
Changes based on input
lmz Oct 28, 2024
bc3c237
Didn't mean to drop industries. Also drop a few income categories
lmz Oct 28, 2024
ada4bd0
Drop ind_OTHEMPN since it's not significant
lmz Oct 28, 2024
d202561
NOP; markdown update
lmz Oct 28, 2024
0b3160d
Initial implementation of binomial logit WFH model using BATS 2023
lmz Oct 30, 2024
e49ffa4
Removing vestigial code bits from TM1.6.0 WFH
lmz Oct 30, 2024
5769936
Update properties file for TM1.6.1 single WFH calibration constant
lmz Oct 30, 2024
fd6f3aa
NOP, line break change in comment
lmz Oct 30, 2024
39a4183
Update mtc.jar with WFH model updates
lmz Oct 30, 2024
78e353e
Update to use 2018-2022 ACS rather than 2017-2021 ACS
lmz Oct 31, 2024
f219f37
Update survey dir path and assume this script is run from validation …
lmz Oct 31, 2024
ca8af3a
Set industry/WFH for all employed persons
lmz Oct 31, 2024
5a33e47
Fix bug in UEC (coefficients weren't in the right column)
lmz Nov 1, 2024
1361914
Add more trace/debug logging
lmz Nov 1, 2024
f112dfd
Add functionality to parse WFH logs
lmz Nov 1, 2024
c13f774
Initial WFH constants for 2015 and 2023
lmz Nov 2, 2024
c875437
Add space to be consistent
lmz Nov 2, 2024
6dad56f
Sync with HwyAssign.job
lmz Nov 4, 2024
ffa08da
Remove additional _v2 suffixes
lmz Nov 6, 2024
de6b570
Add Alameda/SF term
lmz Nov 6, 2024
ae34ae8
Add Alameda[+ContraCosta] to/from SF term
lmz Nov 6, 2024
1cdc77e
Add work county to UEC (although it's not used - so this is a NOP)
lmz Nov 6, 2024
90c0ebe
Try work county = SF
lmz Nov 6, 2024
5f64b52
Update WFH model to 2.10b - include work in SF term, and Alameda/CC t…
lmz Nov 6, 2024
332b6a9
Move eastbay/SF logic into java
lmz Nov 7, 2024
3d251df
Fix letter case
lmz Nov 7, 2024
2c1b35d
Moved this up a few directories because it's not 2020-specific
lmz Nov 8, 2024
7677f8c
Add year to output filename and run for 2021
lmz Nov 8, 2024
c13396f
Update so employment is based on 2021 LODES WAC data
lmz Nov 8, 2024
d05da8a
Now that employment 2020 data is really 2021, scale using QCEW 2021 v…
lmz Nov 8, 2024
8c4c89d
Read employment_2021_with_QCEW_pct_change_applied.csv
lmz Nov 8, 2024
99ca678
Readme updates
lmz Nov 8, 2024
d725546
Current version of Employment by different Sources
lmz Nov 9, 2024
51ea69c
Created extract of taz_self_employed_workers_2020.csv since the table…
lmz Nov 9, 2024
e6c500a
Update WFH_Calibration_constant for latest WFH specification
lmz Nov 9, 2024
a8ff340
Use EDD by county and industry to scale to 2023 employment
FlaviaTsang Nov 17, 2024
856d053
Tableau summary of QCEW vs EDD scaling
FlaviaTsang Nov 18, 2024
9454b52
taz-data-baseyears readme fixes
lmz Nov 18, 2024
b9aa8af
Update filename in readme
lmz Nov 18, 2024
da9efce
Files generated by census-tools-for-planning\analysis_by_topic\PUMS_H…
lmz Nov 19, 2024
fb5b879
Rename file slightly for consistency
lmz Nov 19, 2024
dac6ed8
Update files for bug fix
lmz Nov 20, 2024
1486918
Adding ACS2018-2022 version of excel files, and update worker correct…
lmz Nov 20, 2024
59db9ea
Update 2020 tazdata output files after rerunning create_2020_tazdata.R
lmz Nov 20, 2024
9bd1caf
Fix readme links
lmz Nov 20, 2024
2c96002
Scale EMPRES (and pers_occ_*) so empres matches totals from ACS 2023 …
lmz Nov 20, 2024
5b9ed91
NOP: remove unused code (deprecated by last commit to this script)
lmz Nov 20, 2024
da7bcc6
Use employment_2021_with_EDD_pct_change_applied.csv
lmz Nov 20, 2024
2cec837
Move this file to more logical location
lmz Nov 26, 2024
253156b
Update Employment tableau to update and clarify EDD sources
lmz Nov 26, 2024
3de90ca
Initial commit to fetch and summarize LEHD LODES OD data
lmz Nov 26, 2024
9078ecf
Added LEHD LODES OD
lmz Nov 26, 2024
b7e5d1f
Merge branch 'master' into v1.6.1_develop
lmz Nov 26, 2024
190e2a0
Add county aggregate version in addition to tract-level version
lmz Nov 27, 2024
64ddde4
Added worksheet, LEHD LODES WithinRegion Line
lmz Nov 27, 2024
6c783e1
Move this file up a level since it's not 2020-specific
lmz Nov 27, 2024
b8f5eb7
Run for most recent available year -- 2022
lmz Nov 27, 2024
6c4d57d
Update lodes_wac_to_TAZ.py script to do additional steps: scale down …
lmz Nov 28, 2024
e319b10
Fix some outdated/slightly confusing documentation
lmz Nov 28, 2024
0b37322
Add TAZ 2023 version history for comparisons
lmz Nov 28, 2024
34accbb
Update script/documentation to use LODES 2022 data
lmz Nov 28, 2024
a56415a
Update tableau workbooks to reflect TAZdata updates
lmz Nov 28, 2024
aba72ad
Fix bug where missing self-employed caused NA values for TAZ 1439
lmz Nov 28, 2024
67f87a3
Missed one in previous commit
lmz Nov 28, 2024
53b7a05
Update to read WeightedDataset_11272024 and pass through day_weight t…
lmz Dec 2, 2024
3510d58
Processes 2018-19 BATS data alongside 2023-24 BATS data
lmz Dec 4, 2024
369a1f9
Zero out WFH_Calibration_constant
lmz Dec 5, 2024
44d1a76
Move map_ACS5year_household_income_to_TM1_categories() to common.R
lmz Dec 9, 2024
59ffb79
Move more into common.R
lmz Dec 10, 2024
8544ec1
Move files into Workers dir and add a Readme
lmz Dec 10, 2024
a975876
Move one more file into Workers subdir
lmz Dec 10, 2024
33ce5e9
Removing this file as I'm not sure of the source
lmz Dec 10, 2024
97f0ba2
NOP: the only data change is to use geographies/taz-superdistrict-cou…
lmz Dec 11, 2024
844abed
Move these files to M:\Data\Census\PUMS\PUMS YYYY-YY
lmz Dec 11, 2024
93b64d9
NOP - but pull down ACS numbers for many tables that are currently us…
lmz Dec 11, 2024
2e3a58d
Move this file up a level as we'll make it generic
lmz Dec 11, 2024
2a338d2
Move files to more appropriate locations
lmz Dec 11, 2024
340f7f7
Move these files up a level or two; the script isn't really 2020-spec…
lmz Dec 11, 2024
526b0d0
Add lodes_wac_employment_2022.csv
lmz Dec 12, 2024
98e311d
Simplify create_tazdata_2020_and_after so it works for 2020 and after
lmz Dec 12, 2024
0eedaac
Archive previous version
lmz Dec 14, 2024
810d7c5
Add more documentation and save current output
lmz Dec 14, 2024
d6a39e1
Started adding logic to scale up county totals to target ACS1 year
lmz Dec 14, 2024
5fa4faf
Rename superdistricts slightly (to match geographies file)
lmz Dec 14, 2024
e609473
Fix popsyn empres definition to be based on pemploy==1 or 2
lmz Dec 16, 2024
663a71d
Expand East Bay / SF so East Bay includes Solano (really Eastern Nort…
lmz Dec 16, 2024
5a8742b
Update WFH model UEC and code slightly to match model spec
lmz Dec 16, 2024
dde149e
Update tableau to load data (tazdata & popsyn) from M
lmz Dec 18, 2024
128c089
NOP: moves fix_rounding_artifacts() logic to generic function in comm…
lmz Dec 19, 2024
0138d5c
Implement update_gqop_to_county_totals()
lmz Dec 20, 2024
e080c5c
Implement update_empres_to_county_totals()
lmz Dec 20, 2024
ae7d1d5
Implement generic update_tazdata_to_county_target()
lmz Dec 21, 2024
ff68ad2
Add logging options and fix bug where sum_var needs to be re-calculated
lmz Dec 21, 2024
f8520d3
Implement make_hhsizes_consistent_with_population()
lmz Dec 22, 2024
e410574
Remove some superceded code
lmz Dec 22, 2024
a1c793a
Implement EMPRES_LODES_WEIGHT and create tazdata with test value 1.0
lmz Dec 23, 2024
28fd411
Update for v09
lmz Dec 23, 2024
8360a4c
Simplify this; no need for a special block file
lmz Dec 23, 2024
38212e8
Added EastBay/SF WFH calibration factor
lmz Dec 31, 2024
9525fa2
Try much higher calibration factor
lmz Dec 31, 2024
321de5b
Fix work location bug
lmz Jan 3, 2025
a4e6b81
Run with EMPRES_LODES_WEIGHT = 0.5
lmz Jan 4, 2025
b41c1de
Update AOC using MTC AOC calculation_workingfile_V5.xlsx
lmz Jan 4, 2025
29be3d2
Update WFH_Calibration_constant for 2015 and 2023
lmz Jan 7, 2025
5e6411d
Update WFH_Calibration_constant for 2015 and 2023
lmz Jan 7, 2025
a6b0754
Merge branch 'v1.6.1_develop' of https://github.com/BayAreaMetro/trav…
lmz Jan 7, 2025
90bdf77
Make Rail_Transit_Hesitance apply to work purposes only
lmz Jan 8, 2025
bae2768
Back off Work_Transit_Hesitance slightly (50 -> 45)
lmz Jan 8, 2025
23ec7a5
Update WFH_Calibration_constant to -0.392
lmz Jan 8, 2025
e61f216
Update WFH_Calibration_constant to -0.292
lmz Jan 8, 2025
c1757ed
Merge branch 'v1.6.1_develop' of https://github.com/BayAreaMetro/trav…
lmz Jan 8, 2025
400ece8
More tweaking for run v23
lmz Jan 9, 2025
3adfa1d
Tweaking for run v24
lmz Jan 10, 2025
44c6d9d
Update documentation and deprecate create_2023_tazdata_from_2020_vint…
lmz Jan 12, 2025
f210095
Fix slash direction in documentation
lmz Jan 12, 2025
9738fea
More fixes to documentation
lmz Jan 12, 2025
538a61a
Initial commit of simple utility for extracting nonres trip tables to…
lmz Jan 13, 2025
828f116
Move table sources data up one level, alongside the script
lmz Jan 13, 2025
7dc0bd8
No change to models or estimation, just pass through VMT-generating t…
lmz Jan 14, 2025
43d49c0
Update documentation on WFH model
lmz Jan 15, 2025
5cf3533
No change to models or estimation, just pass through age & student st…
lmz Jan 15, 2025
13be29f
Increase WFH slightly
lmz Jan 16, 2025
85fa5cc
Initial commit of script for comparing BATS data with model data in W…
lmz Jan 17, 2025
c15ab18
Complete this script to it outputs a combined dataset
lmz Jan 22, 2025
b472cea
NOP: Fix income for 2019 - it should come from household
lmz Jan 22, 2025
b759d99
Move forward to WeightedDataset_12112024
lmz Jan 22, 2025
3ea72a8
Update 2035 config for initial FBP runs
lmz Jan 22, 2025
a15f15d
Add min_vtoll to 2035 NoProject/Blueprint
lmz Jan 22, 2025
724539c
Update for tracing university tour mode choice
lmz Jan 23, 2025
ea38c05
Renaming to make this more generic
lmz Jan 23, 2025
db096ea
Move notify_slack.py into model-files
lmz Jan 23, 2025
ec39d6a
Move more functionality into post_message() for other scripts to use
lmz Jan 23, 2025
61c0cb9
Always include instance in slack message
lmz Jan 23, 2025
25b1677
Output csv and dbf both rather than just dbf
lmz Jan 23, 2025
edf582c
Generalize the filtering of unconnected households to popsyn
lmz Jan 23, 2025
dc2ce23
Relax assertion that wfh+goes_to_work == 0
lmz Jan 23, 2025
38d6fa4
NOP; just updated debugging statements
lmz Jan 25, 2025
a9b9a24
Bug fix: the wrong GQ targets were being used.
lmz Jan 25, 2025
e2d6359
Bug fix: update cols HHPOP, EMPRES with new estimates
lmz Jan 26, 2025
2e5acfd
More bug fixes: GQ results not used ("tadata" typo)
lmz Jan 26, 2025
5771922
Round empres and tothh
lmz Jan 27, 2025
0b4d545
Refresh for 2023_v11
lmz Jan 27, 2025
dabda56
Added household check
lmz Jan 28, 2025
3468299
Fix reporting of households to exclude GQ "households"
lmz Jan 28, 2025
9b1ae3d
Decrease 2023 WFH_Calibration_constant slightly to achieve target
lmz Jan 28, 2025
d4db6ea
Reduce WFH slightly and update SetUpModel for PBA50+
lmz Jan 28, 2025
5dade61
Subtract out institutionalized GQ
lmz Jan 30, 2025
33bec16
Inputs and parameter update for 2023_TM161_IPA_27
lmz Jan 31, 2025
64e605e
Reduce WFH further for 2035 NoProject
lmz Jan 31, 2025
f0fb57f
Keep post-covid mode preferences in sync with 2023 config
lmz Jan 31, 2025
3f43255
I misread -- WFH was too low. Bringing back up for 2035 NoProject
lmz Jan 31, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ public class ChoiceModelApplication implements java.io.Serializable {
private long totalCount;
private long otherCount;

public ChoiceModelApplication (String controlFileName, int modelSheet, int dataSheet, HashMap<String,String> propertyMap, Object dmuClassObject, Logger logger) {
// call the original constructor
this(controlFileName, modelSheet, dataSheet, propertyMap, dmuClassObject);

if (logger != null) {
debugLogger = logger;
}
}

public ChoiceModelApplication (String controlFileName, int modelSheet, int dataSheet, HashMap<String,String> propertyMap, Object dmuObject) {

Expand Down Expand Up @@ -594,7 +602,7 @@ public void logLogitCalculations(String choiceModelLabel, String decisionMakerLa
{
debugLogger
.debug("****************************************************************************************************************");
debugLogger.debug(String.format("HH DEBUG: %s Logit Calcuations for %s", choiceModelLabel,
debugLogger.debug(String.format("HH DEBUG: %s Logit Calculations for %s", choiceModelLabel,
decisionMakerLabel));
debugLogger
.debug("****************************************************************************************************************");
Expand Down Expand Up @@ -638,6 +646,10 @@ private void logLogitCalculations(LogitModel nest)
}
}
}

public void logDataValues(Logger localLogger, int origTaz, int destTaz) {
uec.logDataValues(localLogger, origTaz, destTaz, 0);
}

public void logUECResults ( Logger localLogger ){
logUECResults( localLogger, description );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.apache.log4j.Logger;

import com.pb.common.calculator.IndexValues;
import com.pb.common.calculator.MatrixDataManager;
import com.pb.common.calculator.VariableTable;

/**
Expand All @@ -32,27 +33,31 @@ public class CoordinatedDailyActivityPatternDMU implements Serializable, Variabl
public CoordinatedDailyActivityPatternDMU(){
dmuIndex = new IndexValues();
}

public void setPropertyFileValues( HashMap<String, String> propertyMap ) {
// pass
}

public void setDmuIndexValues(int zoneId) {
dmuIndex.setZoneIndex(zoneId);
public void setDmuIndexValues(int hhId, int homeTaz, int workTaz, Logger localLogger) {
setDmuIndexValues(hhId, homeTaz, workTaz);
if ( householdObject.getDebugChoiceModels() ) {
localLogger.info("CoordinatedDailyActivityPatternDMU.setDmuIndexValues(): " + dmuIndex.toString());
}
}

public void setDmuIndexValues(int hhId, int homeTaz, int workTaz) {
dmuIndex.setHHIndex(hhId);
dmuIndex.setOriginZone(homeTaz);
dmuIndex.setDestZone(workTaz);
dmuIndex.setDebug(false);
dmuIndex.setDebugLabel ( "" );
dmuIndex.setDebugLabel("");

if ( householdObject.getDebugChoiceModels() ) {
dmuIndex.setDebug(true);
dmuIndex.setDebugLabel ( "Debug CDAP UEC" );
dmuIndex.setDebugLabel ("Debug CDAP UEC");
}

}

public IndexValues getIndexValues() {
return dmuIndex;
}

public void setHousehold(Household passedInHouseholdObject){

householdObject = passedInHouseholdObject;
Expand All @@ -71,9 +76,13 @@ public void setPersonA(Person passedInPersonA){
dmuIndex.setStopZone(passedInPersonA.getPersonWorkLocationZone());
}

public void setWorksFromHomeForPersonA(Logger cdapLogger) {
public void setIndustryForPersonA(Logger cdapLogger) {
// pass -- implemented in subclass
}
public IndexValues getDmuIndexValues() {
return dmuIndex;
}


public void setPersonB(Person passedInPersonB){
this.personB = passedInPersonB;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ private List<String> formPersonColumnNames() {
data.add("schoolDCLogsum");
data.add("sampleRate");
data.add("wfh_choice");
data.add("industry");
return data;
}

Expand All @@ -421,6 +422,7 @@ private List<SqliteDataTypes> formPersonColumnTypes() {
data.add(SqliteDataTypes.REAL);
data.add(SqliteDataTypes.REAL);
data.add(SqliteDataTypes.INTEGER);
data.add(SqliteDataTypes.TEXT);
return data;
}

Expand All @@ -442,6 +444,7 @@ private List<String> formPersonDataEntry(Person p) {
float sampleRate = p.getSampleRate();
data.add(string(sampleRate));
data.add(string(p.getPersonWorksFromHome()));
data.add(p.getPersonIndustry());
return data;
}

Expand Down
44 changes: 42 additions & 2 deletions core/models/ctramp/src/java/com/pb/models/ctramp/Person.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,18 @@ public class Person implements java.io.Serializable {
public static final String[] employmentCategoryNameArray = {EMPLOYMENT_CATEGORY_FULL_TIME_WORKER_NAME,
EMPLOYMENT_CATEGORY_PART_TIME_WORKER_NAME,EMPLOYMENT_CATEGORY_NOT_EMPLOYED_NAME,EMPLOYMENT_CATEGORY_UNDER_AGE_16_NAME};

// six categories: https://github.com/BayAreaMetro/modeling-website/wiki/TazData
public static final String INDUSTRY_CATEGORY_NA = "N/A";
public static final String INDUSTRY_CATEGORY_AGREMP = "AGR";
public static final String INDUSTRY_CATEGORY_FPSEMP = "FPS";
public static final String INDUSTRY_CATEGORY_HEREMP = "HER";
public static final String INDUSTRY_CATEGORY_MWTEMP = "MWT";
public static final String INDUSTRY_CATEGORY_OTHEMP = "OTH";
public static final String INDUSTRY_CATEGORY_RETEMP = "RET";

public static final String[] industryCategoryNameArray = {INDUSTRY_CATEGORY_NA, INDUSTRY_CATEGORY_AGREMP, INDUSTRY_CATEGORY_FPSEMP,
INDUSTRY_CATEGORY_HEREMP, INDUSTRY_CATEGORY_MWTEMP, INDUSTRY_CATEGORY_OTHEMP, INDUSTRY_CATEGORY_RETEMP};

public static final String WFH_CATEGORY_NA = "N/A";
public static final String WFH_CATEGORY_GOES_TO_WORK = "Goes to work";
public static final String WFH_WORKS_FROM_HOME = "Works from home";
Expand All @@ -56,6 +68,7 @@ public class Person implements java.io.Serializable {
private byte persAge;
private byte persGender;
private byte persEmploymentCategory;
private byte persIndustryCategory; // set by CoordinatedDailyActivityPatternModel
private byte persWfhCategory; // set by CoordinatedDailyActivityPatternModel
private byte persStudentCategory;
private byte personType;
Expand Down Expand Up @@ -323,8 +336,12 @@ public void setPersEmploymentCategory( int category ) {
persEmploymentCategory = (byte)category;
}

public void setPersWorksFromHomeCategory(int category) {
persWfhCategory = (byte)category;
public void setPersIndustryCategory(Person.IndustryStatus category) {
persIndustryCategory = (byte)category.ordinal();
}

public void setPersWorksFromHomeCategory(Person.WorkFromHomeStatus category) {
persWfhCategory = (byte)category.ordinal();
}

public void setPersStudentCategory( int category ){
Expand Down Expand Up @@ -888,6 +905,16 @@ public int getPersonWorksFromHome() {
else
return 0;
}
/**
* Get assumed industry for person.
* @return 3-letter code for industry
*/
public String getPersonIndustry() {
if (persIndustryCategory == IndustryStatus.nul.ordinal()) return "nul";
if (persIndustryCategory == IndustryStatus.NOT_APPLICABLE.ordinal()) return "N_A";
if (persIndustryCategory > industryCategoryNameArray.length) return "ERR";
return industryCategoryNameArray[persIndustryCategory-1];
}
/**
* Determine if person is a student (of any age, independent of person type)
* @return 1 if student, 0 otherwise
Expand Down Expand Up @@ -1290,6 +1317,7 @@ public void logPersonObject( Logger logger, int totalChars ) {
Household.logHelper( logger, "persAge: ", persAge, totalChars );
Household.logHelper( logger, "persGender: ", persGender, totalChars );
Household.logHelper( logger, "persEmploymentCategory: ", persEmploymentCategory, totalChars );
Household.logHelper( logger, "persIndustryCategory: ", persIndustryCategory, totalChars );
Household.logHelper( logger, "persWfhCategory: ", persWfhCategory, totalChars );
Household.logHelper( logger, "persStudentCategory: ", persStudentCategory, totalChars );
Household.logHelper( logger, "personType: ", personType, totalChars );
Expand Down Expand Up @@ -1445,6 +1473,7 @@ public void logEntirePersonObject( Logger logger, ModelStructure modelStructure
Household.logHelper( logger, "persAge: ", persAge, totalChars );
Household.logHelper( logger, "persGender: ", persGender, totalChars );
Household.logHelper( logger, "persEmploymentCategory: ", persEmploymentCategory, totalChars );
Household.logHelper( logger, "persIndustryCategory: ", persIndustryCategory, totalChars );
Household.logHelper( logger, "persWfhCategory: ", persWfhCategory, totalChars );
Household.logHelper( logger, "persStudentCategory: ", persStudentCategory, totalChars );
Household.logHelper( logger, "personType: ", personType, totalChars );
Expand Down Expand Up @@ -1606,6 +1635,17 @@ public enum EmployStatus {
UNDER16
}

public enum IndustryStatus {
nul, // unset
NOT_APPLICABLE, // non-worker
AGREMP,
FPSEMP,
HEREMP,
MWTEMP,
OTHEMP,
RETEMP
}

public enum WorkFromHomeStatus {
nul, // unset
NOT_APPLICABLE, // non-worker
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ public class HouseholdCoordinatedDailyActivityPatternModel implements Serializab
private static final String HOME_PATTERN = Definitions.HOME_PATTERN;
private static final String[] activityNameArray = { MANDATORY_PATTERN, NONMANDATORY_PATTERN, HOME_PATTERN };


// New for MTC TM1.6.1: WFH model
private static final int UEC_WORK_FROM_HOME = 5;

private ModelStructure modelStructure;
private double[][] fixedCumulativeProportions;

Expand All @@ -79,6 +81,8 @@ public class HouseholdCoordinatedDailyActivityPatternModel implements Serializab

// Four separate UECs to compute segments of the utility
private UtilityExpressionCalculator onePersonUec, twoPeopleUec, threePeopleUec, allMemberInteractionUec;
// WorkFromHome ChoiceModel Application
private ChoiceModelApplication workFromHomeChoiceModelApp;


public HouseholdCoordinatedDailyActivityPatternModel( HashMap<String, String> propertyMap, ModelStructure modelStructure, CtrampDmuFactoryIf dmuFactory ) {
Expand All @@ -95,7 +99,7 @@ public HouseholdCoordinatedDailyActivityPatternModel( HashMap<String, String> pr
private void setupCoordinatedDailyActivityPatternModelApplication( HashMap<String, String> propertyMap, CtrampDmuFactoryIf dmuFactory ) {

logger.info( "setting up CDAP choice model." );

// locate the coordinated daily activity pattern choice model UEC
String projectDirectory = propertyMap.get( CtrampApplication.PROPERTIES_PROJECT_DIRECTORY );
String cdapUecFile = propertyMap.get( PROPERTIES_UEC_DAILY_ACTIVITY_PATTERN);
Expand All @@ -105,15 +109,16 @@ private void setupCoordinatedDailyActivityPatternModelApplication( HashMap<Strin
// create the coordinated daily activity pattern choice model DMU object.
logger.info( "About to create cdapDmuObject" );
cdapDmuObject = dmuFactory.getCoordinatedDailyActivityPatternDMU();
cdapDmuObject.setPropertyFileValues(propertyMap);
logger.info( "cdapDmuObject = " + cdapDmuObject );

// create the uecs
onePersonUec = new UtilityExpressionCalculator( new File(cdapUecFile), UEC_ONE_PERSON, UEC_DATA_PAGE, propertyMap, (VariableTable)cdapDmuObject );
twoPeopleUec = new UtilityExpressionCalculator( new File(cdapUecFile), UEC_TWO_PERSON, UEC_DATA_PAGE, propertyMap, (VariableTable)cdapDmuObject );
threePeopleUec = new UtilityExpressionCalculator( new File(cdapUecFile), UEC_THREE_PERSON, UEC_DATA_PAGE, propertyMap, (VariableTable)cdapDmuObject );
allMemberInteractionUec = new UtilityExpressionCalculator( new File(cdapUecFile), UEC_ALL_PERSON, UEC_DATA_PAGE, propertyMap, (VariableTable)cdapDmuObject );


workFromHomeChoiceModelApp = new ChoiceModelApplication(cdapUecFile, UEC_WORK_FROM_HOME, UEC_DATA_PAGE, propertyMap, (Object )cdapDmuObject, cdapLogger);

//get the proportions by person type
double[][] fixedRelativeProportions = modelStructure.getCdap6PlusProps();
fixedCumulativeProportions = new double[fixedRelativeProportions.length][];
Expand Down Expand Up @@ -311,7 +316,7 @@ private void createLogitModels(){
* the activity pattern for that person, in order (see Household.reOrderPersonsForCdap method).
*/
public String getCoordinatedDailyActivityPatternChoice( Household householdObject ){

// set all household level dmu variables
cdapDmuObject.setHousehold(householdObject);

Expand All @@ -322,18 +327,59 @@ public String getCoordinatedDailyActivityPatternChoice( Household householdObjec
// reorder persons for large households if need be
reOrderPersonsForCdap(householdObject);

// loop through each person for WFH
for(int i=0;i<modelHhSize;++i){
Person personA = getCdapPerson(i+1);
// loop through each person for industry and WFH
for(int i=1;i<actualHhSize+1;++i){
Person personA = householdObject.getPersons()[i];
// set the person level dmu variables
cdapDmuObject.setPersonA(personA);

// make the simple person industry choice
cdapDmuObject.setDmuIndexValues(householdObject.getHhId(),
householdObject.getHhTaz(), personA.getPersonWorkLocationZone());
cdapDmuObject.setIndustryForPersonA(cdapLogger);

// if the person doesn't have an industry then don't continue
String personIndustry = personA.getPersonIndustry();
if(householdObject.getDebugChoiceModels()){
cdapLogger.info("Household " + householdObject.getHhId() + " Person " + i + " => " + personA.getPersonId());
cdapLogger.info("Household " + householdObject.getHhId() + " Person " + i +
" => " + personA.getPersonId() + "; personIndustry=" + personIndustry);
}
if ((personIndustry == "nul") || (personIndustry == "N_A") || (personIndustry == "ERR")) {
continue;
}

// compute the wfh utilities
workFromHomeChoiceModelApp.computeUtilities( cdapDmuObject, cdapDmuObject.getDmuIndexValues());

// if the choice model has at least one available alternative, make choice.
int chosenAlt;
double randomNumber = householdObject.getHhRandom().nextDouble();
if (workFromHomeChoiceModelApp.getAvailabilityCount() > 0) {
chosenAlt = workFromHomeChoiceModelApp.getChoiceResult(randomNumber);
}
else {
String errorMessage = String.format("Exception caught for HHID=%d, PERSID=%d, no available WFH alternatives to choose from in choiceModelApplication.",
householdObject.getHhId(), personA.getPersonId());
logger.error (errorMessage);
throw new RuntimeException();
}

// make the simple WFH choice
cdapDmuObject.setWorksFromHomeForPersonA(cdapLogger);
// write choice model alternative info to log file
if ( householdObject.getDebugChoiceModels() ) {
// workFromHomeChoiceModelApp.logDataValues(cdapLogger, householdObject.getHhTaz(), personA.getUsualWorkLocation());

String header = "Work-From-Home Choice ";
String headerInfo = String.format("HHID=%d PERSID=%d personIndustry=%s ", householdObject.getHhId(), personA.getPersonId(), personIndustry);
headerInfo += String.format("homeTAZ=%d workTAZ=%d ", householdObject.getHhTaz(), personA.getUsualWorkLocation());
workFromHomeChoiceModelApp.logUECResults(cdapLogger, header + headerInfo);
workFromHomeChoiceModelApp.logAlternativesInfo(header, headerInfo);
}
// set it: in the UEC, Alt1 = WFH, Alt2 = Does not WFH
if (chosenAlt == 1) {
personA.setPersWorksFromHomeCategory(Person.WorkFromHomeStatus.WORKS_FROM_HOME);
} else if (chosenAlt == 2) {
personA.setPersWorksFromHomeCategory(Person.WorkFromHomeStatus.GOES_TO_WORK);
}
}

// get the logit model we need and clear it of any lingering probilities
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

public class HouseholdFreeParkingModel implements Serializable {

private transient Logger logger = Logger.getLogger(HouseholdFreeParkingModel.class);
private transient Logger logger = Logger.getLogger("freeparking");

private static final String FP_CONTROL_FILE_TARGET = "UecFile.FreeParking";
private static final int FP_DATA_SHEET = 0;
Expand Down Expand Up @@ -91,6 +91,7 @@ private int getFreeParkingChoice (Person personObj, double randomNumber) {

// write choice model alternative info to log file
if ( hhObj.getDebugChoiceModels() ) {
fpModel.logUECResults(logger, "Free parking Choice");
fpModel.logAlternativesInfo("Free parking Choice", String.format("PERS_%d", personObj.getPersonId()));
fpModel.logSelectionInfo ( "Free parking Choice", String.format("PERS_%d", personObj.getPersonId()), randomNumber, chosenAlt);
}
Expand Down
Binary file modified core/projects/mtc/release/mtc.jar
Binary file not shown.
Loading