Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions activitysim/abm/models/trip_mode_choice.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ def trip_mode_choice(
trace_choice_name="trip_mode_choice",
estimator=estimator,
compute_settings=model_settings.compute_settings,
explicit_chunk_size=model_settings.explicit_chunk,
)

if state.settings.trace_hh_id:
Expand Down
3 changes: 3 additions & 0 deletions activitysim/abm/models/util/mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def mode_choice_simulate(
trace_column_names=None,
estimator: Optional[Estimator] = None,
compute_settings: ComputeSettings | None = None,
explicit_chunk_size: float = 0,
):
"""
common method for both tour_mode_choice and trip_mode_choice
Expand Down Expand Up @@ -74,6 +75,7 @@ def mode_choice_simulate(
estimator=estimator,
trace_column_names=trace_column_names,
compute_settings=compute_settings,
explicit_chunk_size=explicit_chunk_size,
)

# for consistency, always return dataframe, whether or not logsums were requested
Expand Down Expand Up @@ -176,6 +178,7 @@ def run_tour_mode_choice_simulate(
trace_column_names=trace_column_names,
estimator=estimator,
compute_settings=model_settings.compute_settings,
explicit_chunk_size=model_settings.explicit_chunk,
)

return choices
8 changes: 8 additions & 0 deletions activitysim/core/configuration/logit.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,14 @@ class TemplatedLogitComponentSettings(LogitComponentSettings, extra="forbid"):
segment-specific names.
"""

explicit_chunk: float = 0
"""
If > 0, use this fixed chunk size (number of chooser rows) instead of adaptive
chunking. If less than 1, use this fraction of the total number of rows. Plumbed
through mode_choice_simulate -> simple_simulate so mode-choice models can be chunked
(default 0 = unchanged chunkless/adaptive behavior).
"""


class LocationComponentSettings(BaseLogitComponentSettings):
"""
Expand Down
5 changes: 4 additions & 1 deletion activitysim/core/simulate.py
Original file line number Diff line number Diff line change
Expand Up @@ -1719,6 +1719,7 @@ def simple_simulate(
trace_choice_name=None,
trace_column_names=None,
compute_settings: ComputeSettings | None = None,
explicit_chunk_size: float = 0,
):
"""
Run an MNL or NL simulation for when the model spec does not involve alternative
Expand All @@ -1737,7 +1738,9 @@ def simple_simulate(
chooser_chunk,
chunk_trace_label,
chunk_sizer,
) in chunk.adaptive_chunked_choosers(state, choosers, trace_label):
) in chunk.adaptive_chunked_choosers(
state, choosers, trace_label, explicit_chunk_size=explicit_chunk_size
):
choices = _simple_simulate(
state,
chooser_chunk,
Expand Down