Skip to content

Explicit Telecommute: new telework_arrangement and telework_duration components - #1126

Open
i-am-sijia wants to merge 11 commits into
ActivitySim:mainfrom
wsp-sag:explicit-telecommute
Open

i-am-sijia wants to merge 11 commits into
ActivitySim:mainfrom
wsp-sag:explicit-telecommute

Conversation

@i-am-sijia

@i-am-sijia i-am-sijia commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

This pull request adds two new model components to the ActivitySim ABM: telework_arrangement and telework_duration. These components enable the simulation of whether a worker has in-home work activity (telework) on a given day and, if so, the duration of their telework. The changes include new model step implementations, settings classes, unit tests, and integration into the settings checker and model initialization.

New telework modeling components:

  • Added the telework_arrangement model step and its settings class (TeleworkArrangementSettings), which predicts whether workers have in-home telework activity on the simulation day. This includes a new implementation file telework_arrangement.py.
  • Added the telework_duration model step and its settings class (TeleworkDurationSettings), which assigns a duration to in-home work activities using either a probabilistic or MNL choice model. This includes a new implementation file telework_duration.py.

Integration with ActivitySim ABM framework:

  • Registered the new telework_arrangement and telework_duration components in the ABM model's initialization (__init__.py).
  • Integrated the new settings classes and model steps into the settings checker to ensure configuration validation and proper loading of settings files.

Unit test

  • Added unit tests for both components. For telework_duration, unit tests for both MNL and probabilistic options are available.

Estimation Memo

As requested in meetings, a GitHub hosted memo is preferrable. Therefore, this PR also expanded the new markdown files for the two components to include:

  • Estimation data preparation and data analysis
  • Behavioral hypotheses and associated model specification exploration
  • Software implementation
  • Guidance for model users on calibration of the model for their regions

The markdown files also identify data required to perform calibration using the current specification, and discuss additional data items that may not be currently available, but which could inform future data collection and model improvements.

@jpn--
jpn-- requested a review from janzill October 22, 2026 17:42
@jpn--
jpn-- requested review from JoeJimFlood and removed request for janzill October 22, 2026 18:35

@JoeJimFlood JoeJimFlood left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! I just had a couple comments over small things.

estimator.end_estimation()

persons["has_in_home_work_activity"] = (
choices.reindex(persons.index).fillna(0).astype(bool)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like a value of 0 in this field indicates that a person has in-home work activities by default. So would this mean that people with null values are assumed to have in-home work activities?

Settings for the `telework_duration` component.
"""

CHOICE_MODEL: Literal["PROBABILISTIC", "MNL"] = "PROBABILISTIC"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would LOGIT be the better option here instead of MNL to avoid confusion with the LOGIT_TYPE setting?

estimator.write_override_choices(choices)
estimator.end_estimation()

persons["has_in_home_work_activity"] = (

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is more of a general ActivitySim comment: I've noticed that in some model components (such as this one) the name(s) of the column with the choice is(are) hardcoded, but in others (such as telework duration in this PR) the name(s) is(are) defined in the model settings. Should this be consistent?

@pytest.fixture(scope="module")
def households() -> pd.DataFrame:
households = pd.DataFrame(
{

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent formatting between this and how the persons table is defined. Perhaps the differences in the number of the rows are on either side of a formatter's threshold on lists being displayed horizontally vs vertically?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants