Stop Models Design - ActivitySim/activitysim GitHub Wiki

The ActivitySim example model follows the TM1 design for modeling immediate stops on tours (i.e. trips). In TM1, tours are first attributed with an intermediate stop frequency and then a series of sub-models are run to convert the tours + number of stops to trips. After creating a skeleton pandas data frame of all trips based on the tours and stop frequency, various additional fields are added to the table in order to subset and filter records as needed for the vectorized trip sub-models.

The new sub-models, which are inserted after atwork_subtour_mode_choice, are:

The existing create_simple_trips sub-model will be deleted since it was a simple placeholder for trips. The existing trip_mode_choice_simulate sub-model will be upgraded.

Intermediate stop frequency

  • For each tour
  • MNL model by each purpose
  • Alternatives: 16 (0 to 3 stops outbound + 0 to 3 stops inbound)
  • Notes:
    • This model should attribute each tour with a number of intermediate inbound stops and outbound stops
    • This model should create a trip table for the subsequent sub-models with the following fields: household id, person id(s), tour id, and stop/trip tour sequence identifiers such as first_trip_on_tour_inbound, intermediate_trip_on_tour_inbound, last_trip_on_tour_inbound, etc. since these are required for subsequent model expressions and for a vectorized implementation. An inbound trip for a tour with no inbound stops would have first_trip_on_tour_inbound=true, intermediate_trip_on_tour_inbound=false, and last_trip_on_tour_inbound=true.

Trip Purpose

  • For each intermediate stop on a tour (i.e. trip other than the last trip outbound or inbound)
  • Each trip is assigned a purpose based on an observed frequency distribution
  • Notes:
    • The distribution is segmented by tour purpose, tour direction and person type. Work tours are also segmented by departure or arrival time period.

Trip destination choice sample

  • For each trip without a destination (i.e. intermediate stops on tours)
  • Select X alternatives using a similar approach as before except for two major revisions:
    • Condition the set of available alternatives by tour mode (for example, only alternatives that are within walking distance if the tour mode is walk-transit)
    • Sequentially process the trips from tour origin to destination when outbound and then tour destination to origin when inbound. When doing so, the model calculates out-of-direction distance for the stop location in two-parts: origin to alternative destination location + alternative destination location to next destination.
    • A new skim lookup key is required for this model. The existing @odt,@dot keys represent origin, destination, and time period. The @dpt key could be used to represent destination to primary destination for time period t, and @dht key could be used to represent destination to home for time period t. As a result, the out-of-direction distance lookup could be @odt + @dpt for outbound and @odt + @dht for inbound.
  • Alternatives: Zones

Trip destination choice sample logsums

  • For each trip without a destination
  • Calculate X mode choice logsums using the same approach as before, but do it twice for each alternative since we need out-of-direction logsum (i.e . @odt + @dpt for outbound or @odt + @dht for inbound)
  • Alternatives: Sample of alternative zones

Trip destination final choice

  • For each trip without a destination
  • Select a final destination zone using the same approach as before
  • Alternatives: Sample of alternative zones
  • If trip destination fails since there are no alternatives available, trip purpose + trip destination is re-run with new random numbers. The number of re-runs is logged for understanding the statistical impact.

Trip timing

  • For each trip
  • Assign a departure hour based on an input lookup table of percents by tour purpose, direction (inbound/outbound), tour hour, and trip index
    • The tour hour is the tour start hour for outbound trips and the tour end hour for inbound trips
    • The trip index is the trip sequence on the tour, with up to four trips per half tour
    • For outbound trips, the trip depart hour must be greater than or equal to the previously selected trip depart hour
    • For inbound trips, trips are handled in reverse order from the next-to-last trip in the leg back to the first. The tour end hour serves as the anchor time point from which to start assigning trip time periods.
    • Outbound trips on at-work subtours are assigned the tour depart hour and inbound trips on at-work subtours are assigned the tour end hour.
  • The assignment of trip depart time is run iteratively up to a max number of iterations (1000) since it's possible that the time period selected for an earlier trip in a half-tour makes selection of a later trip time period impossible (or low probability). Thus, the sampling is re-run until a feasible set of trip time periods is found. Only the current trip is re-run, but maybe all the trips on the tour should be re-run?
  • If a trip can't be scheduled after the max iterations, then the trip is assigned the previous trip's choice (i.e. assumed to happen right after the previous trip).
  • Alternatives: Available time periods in the tour window (i.e. tour start and end period). When processing stops on work tours, the available time periods need to be constrained by the at-work subtour start and end period as well.
  • The number of re-runs is logged for understanding the statistical impact.
  • This simple model was also implemented for CMAP, but was replaced by an improved model for ARC.

Trip mode choice

  • For each trip
  • Nested logit model that uses the existing expressions file - trip_mode_choice.csv
  • Notes:
    • Trip mode choice is constrained by tour mode
    • Need to turn on walk and bike alternatives and support for all purposes
    • Need to use the correct OD pairs and time periods
    • Need to clean-up the expression file as it makes sense