At-work Subtour Scheduling#

The at-work subtours scheduling model selects a tour departure and duration period (and therefore a start and end period as well) for each at-work subtour. This model uses person time_windows.

This model is the same as the mandatory tour scheduling model except it operates on the at-work tours and constrains the alternative set to available person time_windows. The at-work subtour scheduling model does not use mode choice logsums. The at-work subtour frequency model can choose multiple tours so this model must process all first tours and then second tours since isFirstAtWorkTour is an explanatory variable.

Choosers: at-work tours Alternatives: alternative departure time and arrival back at origin time pairs WITHIN the work tour departure time and arrival time back at origin AND the person time window. If no time window is available for the tour, make the first and last time periods within the work tour available, make the choice, and log the number of times this occurs. Dependent tables: skims, person, land use, work tour Outputs: at-work tour departure time and arrival back at origin time, updated person time windows

The main interface to the at-work subtours scheduling model is the atwork_subtour_scheduling function. This function is registered as an Inject step in the example Pipeline.

Structure#

  • Configuration File: tour_scheduling_atwork.yaml

  • Core Table: tours

  • Result Field: start, end, duration

  • Skims keys: workplace_taz, alt_dest, MD time period, MD time period

Configuration#

settings activitysim.abm.models.atwork_subtour_scheduling.TourSchedulingSettings#

Bases: LogitComponentSettings

Fields:
Validators:
  • nests_are_for_nl » NESTS

field ALTS_PREPROCESSOR: PreprocessorSettings | dict[str, PreprocessorSettings] = {}#

If the alternatives preprocessor is a single PreprocessorSettings object, it is assumed to be an unsegmented preprocessor. Otherwise, the dict keys give the segements.

field COEFFICIENTS: Path | None = None#

Coefficients filename.

This is a CSV file giving named parameters for use in the utility expression. If it is not provided, then it is assumed that all model coefficients are given explicitly in the SPEC as numerical values instead of named parameters. This is perfectly acceptable for use with ActivitySim for typical simulation applications, but may be problematic if used with “estimation mode”.

field CONSTANTS: dict[str, Any] = {}#

Named constants usable in the utility expressions.

field DESTINATION_FOR_TOUR_PURPOSE: str | dict[str, str] | None = None#
field LOGIT_TYPE: Literal['MNL', 'NL'] = 'MNL'#

Logit model mathematical form.

  • “MNL”

    Multinomial logit model.

  • “NL”

    Nested multinomial logit model.

field LOGSUM_PREPROCESSOR: str = 'preprocessor'#
field LOGSUM_SETTINGS: Path | None = None#
field NESTS: LogitNestSpec | None = None#

Nesting structure for a nested logit model.

The nesting structure is specified heirarchically from the top, so the value of this field should be the “root” level nest of the nested logit tree, which should contain references to lower level nests and/or the actual alternatives.

For example, this YAML defines a simple nesting structure for four alternatives (DRIVE, WALK, WALK_TO_TRANSIT, DRIVE_TO_TRANSIT) with the two transit alternatives grouped together in a nest:

NESTS:
  name: root
  coefficient: coef_nest_root
  alternatives:
    - DRIVE
    - WALK
    - name: TRANSIT
      coefficient: coef_nest_transit
      alternatives:
      - WALK_TO_TRANSIT
      - DRIVE_TO_TRANSIT
Validated by:
  • nests_are_for_nl

field SIMULATE_CHOOSER_COLUMNS: list[str] | None = None#
field SPEC: Path | None = None#

Utility specification filename.

This is sometimes alternatively called the utility expressions calculator (UEC). It is a CSV file giving all the functions for the terms of a linear-in-parameters utility expression. If SPEC_SEGMENTS is given, then this unsegmented SPEC should be omitted.

field SPEC_SEGMENTS: dict[str, LogitComponentSettings] = {}#
field TOUR_SPEC_SEGMENTS: dict[str, str] = {}#
field preprocessor: PreprocessorSettings | None = None#

Setting for the preprocessor.

field sharrow_skip: bool = False#

Skip sharrow when evaluating this component.

field source_file_paths: list[Path] = None#

A list of source files from which these settings were loaded.

This value should not be set by the user within the YAML settings files, instead it is populated as those files are loaded. It is primarily provided for debugging purposes, and does not actually affect the operation of any model.

validator nests_are_for_nl  »  NESTS#

Checks that nests are provided if (and only if) LOGIT_TYPE is NL.

Examples#

Implementation#

activitysim.abm.models.atwork_subtour_scheduling.atwork_subtour_scheduling(state: State, tours: DataFrame, persons_merged: DataFrame, tdd_alts: DataFrame, skim_dict: SkimDict | SkimDataset, model_settings: Optional[TourSchedulingSettings] = None, model_settings_file_name: str = 'tour_scheduling_atwork.yaml', trace_label: str = 'atwork_subtour_scheduling') None#

This model predicts the departure time and duration of each activity for at work subtours tours