diff --git a/activitysim/abm/models/location_choice.py b/activitysim/abm/models/location_choice.py index faaa508637..5f6f87f187 100644 --- a/activitysim/abm/models/location_choice.py +++ b/activitysim/abm/models/location_choice.py @@ -242,14 +242,10 @@ def location_sample( chunk_tag, trace_label, ): - # FIXME - MEMORY HACK - only include columns actually used in spec - chooser_columns = model_settings.SIMULATE_CHOOSER_COLUMNS - # Drop this when PR #1017 is merged - if ("household_id" not in chooser_columns) and ( - "household_id" in persons_merged.columns - ): - chooser_columns = chooser_columns + ["household_id"] - choosers = persons_merged[chooser_columns] + # The former column selection returned an independent frame. Preserve that + # isolation so component preprocessors cannot leak annotations into the + # shared persons table or into later location-choice segments. + choosers = persons_merged.copy() # create wrapper with keys for this lookup - in this case there is a home_zone_id in the choosers # and a zone_id in the alternatives which get merged during interaction @@ -441,17 +437,8 @@ def location_presample( HOME_TAZ in persons_merged ) # 'TAZ' should already be in persons_merged from land_use - # FIXME - MEMORY HACK - only include columns actually used in spec - # FIXME we don't actually require that land_use provide a TAZ crosswalk - # FIXME maybe we should add it for multi-zone (from maz_taz) if missing? - chooser_columns = model_settings.SIMULATE_CHOOSER_COLUMNS - chooser_columns = [HOME_TAZ if c == HOME_MAZ else c for c in chooser_columns] - # Drop this when PR #1017 is merged - if ("household_id" not in chooser_columns) and ( - "household_id" in persons_merged.columns - ): - chooser_columns = chooser_columns + ["household_id"] - choosers = persons_merged[chooser_columns] + # Keep chooser annotations local to this model segment. + choosers = persons_merged.copy() # create wrapper with keys for this lookup - in this case there is a HOME_TAZ in the choosers # and a DEST_TAZ in the alternatives which get merged during interaction @@ -627,11 +614,6 @@ def run_location_logsums( mandatory=False, ) - # FIXME - MEMORY HACK - only include columns actually used in spec - persons_merged_df = logsum.filter_chooser_columns( - persons_merged_df, logsum_settings, model_settings - ) - logger.info(f"Running {trace_label} with {len(location_sample_df.index)} rows") choosers = location_sample_df.join(persons_merged_df, how="left") @@ -691,14 +673,9 @@ def run_location_simulate( """ assert not persons_merged.empty - # FIXME - MEMORY HACK - only include columns actually used in spec - chooser_columns = model_settings.SIMULATE_CHOOSER_COLUMNS - # Drop this when PR #1017 is merged - if ("household_id" not in chooser_columns) and ( - "household_id" in persons_merged.columns - ): - chooser_columns = chooser_columns + ["household_id"] - choosers = persons_merged[chooser_columns] + # Preprocessors annotate choosers in place. Use a copy so those temporary + # columns do not affect subsequent segments that share persons_merged. + choosers = persons_merged.copy() alt_dest_col_name = model_settings.ALT_DEST_COL_NAME diff --git a/activitysim/abm/models/school_escorting.py b/activitysim/abm/models/school_escorting.py index d24d52a41f..ed13af914b 100644 --- a/activitysim/abm/models/school_escorting.py +++ b/activitysim/abm/models/school_escorting.py @@ -3,10 +3,12 @@ from __future__ import annotations import logging +import warnings from typing import Any, Literal import numpy as np import pandas as pd +from pydantic import field_validator from activitysim.abm.models.util import school_escort_tours_trips from activitysim.core import ( @@ -335,7 +337,26 @@ class SchoolEscortSettings(BaseLogitComponentSettings, extra="forbid"): GENDER_WEIGHT: float = 10.0 AGE_WEIGHT: float = 1.0 - SIMULATE_CHOOSER_COLUMNS: list[str] | None = None + SIMULATE_CHOOSER_COLUMNS: Any | None = None + """Was used to help reduce the memory needed for the model. + + This setting is now obsolete and does nothing. Its functionality has been + replaced by :func:`activitysim.core.util.drop_unused_columns`. + + .. deprecated:: 1.6 + """ + + @field_validator("SIMULATE_CHOOSER_COLUMNS", mode="before") + @classmethod + def _deprecate_simulate_chooser_columns(cls, value): + if value is not None: + warnings.warn( + "SIMULATE_CHOOSER_COLUMNS is deprecated and no longer used, " + "unused columns are now dropped automatically", + DeprecationWarning, + stacklevel=2, + ) + return None SPEC: None = None """The school escort model does not use this setting.""" @@ -465,17 +486,6 @@ def school_escorting( # else: # locals_dict.pop("_sharrow_skip", None) - # reduce memory by limiting columns if selected columns are supplied - chooser_columns = model_settings.SIMULATE_CHOOSER_COLUMNS - if chooser_columns is not None: - # Drop this when PR #1017 is merged - if ("household_id" not in chooser_columns) and ( - "household_id" in choosers.columns - ): - chooser_columns = chooser_columns + ["household_id"] - chooser_columns = chooser_columns + participant_columns - choosers = choosers[chooser_columns] - # add previous data to stage if stage_num >= 1: choosers = add_prev_choices_to_choosers( @@ -566,10 +576,14 @@ def school_escorting( ) if stage_num >= 1: - choosers["alt"] = choices - choosers = choosers.join(alts, how="left", on="alt") + # The raw alternative columns are only needed to construct bundle + # records. Do not retain them on the chooser state: the final + # stage would otherwise try to join the same columns a second time. + bundle_choosers = choosers.assign(alt=choices).join( + alts, how="left", on="alt" + ) bundles = create_school_escorting_bundles_table( - choosers[choosers["alt"] > 1], tours, stage + bundle_choosers[bundle_choosers["alt"] > 1], tours, stage ) escort_bundles.append(bundles) diff --git a/activitysim/abm/models/util/logsums.py b/activitysim/abm/models/util/logsums.py index 346f5ffa09..44b3dcc36c 100644 --- a/activitysim/abm/models/util/logsums.py +++ b/activitysim/abm/models/util/logsums.py @@ -7,7 +7,6 @@ import pandas as pd from activitysim.core import config, expressions, los, simulate, tracing, workflow -from activitysim.core.configuration import PydanticBase from activitysim.core.configuration.logit import ( TourLocationComponentSettings, TourModeComponentSettings, @@ -16,41 +15,6 @@ logger = logging.getLogger(__name__) -def filter_chooser_columns( - choosers, logsum_settings: dict | PydanticBase, model_settings: dict | PydanticBase -): - try: - chooser_columns = logsum_settings.LOGSUM_CHOOSER_COLUMNS - except AttributeError: - chooser_columns = logsum_settings.get("LOGSUM_CHOOSER_COLUMNS", []) - - if ( - isinstance(model_settings, dict) - and "CHOOSER_ORIG_COL_NAME" in model_settings - and model_settings["CHOOSER_ORIG_COL_NAME"] not in chooser_columns - ): - chooser_columns.append(model_settings["CHOOSER_ORIG_COL_NAME"]) - if ( - isinstance(model_settings, PydanticBase) - and hasattr(model_settings, "CHOOSER_ORIG_COL_NAME") - and model_settings.CHOOSER_ORIG_COL_NAME - and model_settings.CHOOSER_ORIG_COL_NAME not in chooser_columns - ): - chooser_columns.append(model_settings.CHOOSER_ORIG_COL_NAME) - - missing_columns = [c for c in chooser_columns if c not in choosers] - if missing_columns: - logger.debug( - "logsum.filter_chooser_columns missing_columns %s" % missing_columns - ) - - # ignore any columns not appearing in choosers df - chooser_columns = [c for c in chooser_columns if c in choosers] - - choosers = choosers[chooser_columns] - return choosers - - def compute_location_choice_logsums( state: workflow.State, choosers: pd.DataFrame, diff --git a/activitysim/abm/models/util/tour_destination.py b/activitysim/abm/models/util/tour_destination.py index 2ef983a51d..11bdb8ecdb 100644 --- a/activitysim/abm/models/util/tour_destination.py +++ b/activitysim/abm/models/util/tour_destination.py @@ -637,8 +637,10 @@ def destination_presample( orig_maz = model_settings.CHOOSER_ORIG_COL_NAME assert orig_maz in choosers - if ORIG_TAZ not in choosers: - choosers[ORIG_TAZ] = network_los.map_maz_to_taz(choosers[orig_maz]) + # This is the TAZ for the configured tour origin. A wider chooser table + # may already contain a same-named home TAZ, which is incorrect for models + # such as at-work subtour destination choice. + choosers[ORIG_TAZ] = network_los.map_maz_to_taz(choosers[orig_maz]) # create wrapper with keys for this lookup - in this case there is a HOME_TAZ in the choosers # and a DEST_TAZ in the alternatives which get merged during interaction @@ -691,23 +693,9 @@ def run_destination_sample( chunk_size, trace_label, ): - # FIXME - MEMORY HACK - only include columns actually used in spec (omit them pre-merge) - chooser_columns = model_settings.SIMULATE_CHOOSER_COLUMNS - # if special person id is passed chooser_id_column = model_settings.CHOOSER_ID_COLUMN - # Drop this when PR #1017 is merged - if ("household_id" not in chooser_columns) and ( - "household_id" in persons_merged.columns - ): - chooser_columns = chooser_columns + ["household_id"] - persons_merged = persons_merged[ - [c for c in persons_merged.columns if c in chooser_columns] - ] - tours = tours[ - [c for c in tours.columns if c in chooser_columns or c == chooser_id_column] - ] choosers = pd.merge( tours, persons_merged, left_on=chooser_id_column, right_index=True, how="left" ) @@ -805,11 +793,6 @@ def run_destination_logsums( chunk_tag = "tour_destination.logsums" - # FIXME - MEMORY HACK - only include columns actually used in spec - persons_merged = logsum.filter_chooser_columns( - persons_merged, logsum_settings, model_settings - ) - # merge persons into tours choosers = pd.merge( destination_sample, @@ -872,23 +855,9 @@ def run_destination_simulate( coefficients_file_name=model_settings.COEFFICIENTS, ) - # FIXME - MEMORY HACK - only include columns actually used in spec (omit them pre-merge) - chooser_columns = model_settings.SIMULATE_CHOOSER_COLUMNS - # if special person id is passed chooser_id_column = model_settings.CHOOSER_ID_COLUMN - # Drop this when PR #1017 is merged - if ("household_id" not in chooser_columns) and ( - "household_id" in persons_merged.columns - ): - chooser_columns = chooser_columns + ["household_id"] - persons_merged = persons_merged[ - [c for c in persons_merged.columns if c in chooser_columns] - ] - tours = tours[ - [c for c in tours.columns if c in chooser_columns or c == chooser_id_column] - ] choosers = pd.merge( tours, persons_merged, left_on=chooser_id_column, right_index=True, how="left" ) diff --git a/activitysim/abm/models/util/tour_od.py b/activitysim/abm/models/util/tour_od.py index b9f76d70b3..6626dccc25 100644 --- a/activitysim/abm/models/util/tour_od.py +++ b/activitysim/abm/models/util/tour_od.py @@ -736,13 +736,8 @@ def run_od_sample( coefficients_file_name=model_settings.COEFFICIENTS, ) - choosers = tours - # FIXME - MEMORY HACK - only include columns actually used in spec - chooser_columns = model_settings.SIMULATE_CHOOSER_COLUMNS - # Drop this when PR #1017 is merged - if ("household_id" not in chooser_columns) and ("household_id" in choosers.columns): - chooser_columns = chooser_columns + ["household_id"] - choosers = choosers[chooser_columns] + # Preserve the independent-frame behavior of the former column subset. + choosers = tours.copy() # interaction_sample requires that choosers.index.is_monotonic_increasing if not choosers.index.is_monotonic_increasing: @@ -820,11 +815,6 @@ def run_od_logsums( dest_id_col = model_settings.DEST_COL_NAME tour_od_id_col = get_od_id_col(origin_id_col, dest_id_col) - # FIXME - MEMORY HACK - only include columns actually used in spec - tours_merged_df = logsum.filter_chooser_columns( - tours_merged_df, logsum_settings, model_settings - ) - # merge ods into choosers table choosers = od_sample.join(tours_merged_df, how="left") choosers[tour_od_id_col] = ( @@ -998,14 +988,9 @@ def run_od_simulate( ) # merge persons into tours - choosers = tours - - # FIXME - MEMORY HACK - only include columns actually used in spec - chooser_columns = model_settings.SIMULATE_CHOOSER_COLUMNS - # Drop this when PR #1017 is merged - if ("household_id" not in chooser_columns) and ("household_id" in choosers.columns): - chooser_columns = chooser_columns + ["household_id"] - choosers = choosers[chooser_columns] + # Preprocessors may annotate choosers in place; keep those columns local to + # this segment instead of mutating the shared tours table. + choosers = tours.copy() # interaction_sample requires that choosers.index.is_monotonic_increasing if not choosers.index.is_monotonic_increasing: diff --git a/activitysim/abm/models/util/tour_scheduling.py b/activitysim/abm/models/util/tour_scheduling.py index e591c29db1..c7ac5ca853 100644 --- a/activitysim/abm/models/util/tour_scheduling.py +++ b/activitysim/abm/models/util/tour_scheduling.py @@ -9,7 +9,7 @@ from activitysim.abm.models.util import vectorize_tour_scheduling as vts from activitysim.core import config, estimation, expressions, simulate, workflow -from .vectorize_tour_scheduling import TourModeComponentSettings, TourSchedulingSettings +from .vectorize_tour_scheduling import TourSchedulingSettings logger = logging.getLogger(__name__) @@ -24,29 +24,9 @@ def run_tour_scheduling( trace_label: str, ): - if model_settings.LOGSUM_SETTINGS: - logsum_settings = TourModeComponentSettings.read_settings_file( - state.filesystem, - str(model_settings.LOGSUM_SETTINGS), - mandatory=False, - ) - logsum_columns = logsum_settings.LOGSUM_CHOOSER_COLUMNS - else: - logsum_columns = [] - - # - filter chooser columns for both logsums and simulate - model_columns = model_settings.SIMULATE_CHOOSER_COLUMNS - chooser_columns = logsum_columns + [ - c for c in model_columns if c not in logsum_columns - ] - - # Drop this when PR #1017 is merged - if ("household_id" not in chooser_columns) and ( - "household_id" in persons_merged.columns - ): - chooser_columns = chooser_columns + ["household_id"] - - persons_merged = expressions.filter_chooser_columns(persons_merged, chooser_columns) + # The deprecated chooser-column filter returned a new frame. Retain that + # isolation because vectorized scheduling annotates merged chooser data. + persons_merged = persons_merged.copy() timetable = state.get_injectable("timetable") diff --git a/activitysim/abm/models/util/vectorize_tour_scheduling.py b/activitysim/abm/models/util/vectorize_tour_scheduling.py index b75afdf9ed..8de43ca67e 100644 --- a/activitysim/abm/models/util/vectorize_tour_scheduling.py +++ b/activitysim/abm/models/util/vectorize_tour_scheduling.py @@ -3,12 +3,14 @@ from __future__ import annotations import logging +import warnings from collections import OrderedDict from pathlib import Path from typing import Any import numpy as np import pandas as pd +from pydantic import field_validator from activitysim.abm.models.tour_mode_choice import TourModeComponentSettings from activitysim.core import chunk, config, expressions, los, simulate @@ -43,7 +45,26 @@ class TourSchedulingSettings(LogitComponentSettings, extra="forbid"): it is assumed to be an unsegmented preprocessor. Otherwise, the dict keys give the segements. """ - SIMULATE_CHOOSER_COLUMNS: list[str] | None = None + SIMULATE_CHOOSER_COLUMNS: Any | None = None + """Was used to help reduce the memory needed for the model. + + This setting is now obsolete and does nothing. Its functionality has been + replaced by :func:`activitysim.core.util.drop_unused_columns`. + + .. deprecated:: 1.6 + """ + + @field_validator("SIMULATE_CHOOSER_COLUMNS", mode="before") + @classmethod + def _deprecate_simulate_chooser_columns(cls, value): + if value is not None: + warnings.warn( + "SIMULATE_CHOOSER_COLUMNS is deprecated and no longer used, " + "unused columns are now dropped automatically", + DeprecationWarning, + stacklevel=2, + ) + return None SPEC_SEGMENTS: dict[str, LogitComponentSettings] = {} diff --git a/activitysim/abm/test/test_misc/test_location_choice_sampling.py b/activitysim/abm/test/test_misc/test_location_choice_sampling.py index 34bd41b675..6b21e0329c 100644 --- a/activitysim/abm/test/test_misc/test_location_choice_sampling.py +++ b/activitysim/abm/test/test_misc/test_location_choice_sampling.py @@ -93,7 +93,6 @@ def fake_choose_maz_for_taz( (), { "ALT_DEST_COL_NAME": "zone_id", - "SIMULATE_CHOOSER_COLUMNS": [location_choice.HOME_MAZ], }, )() persons_merged = pd.DataFrame( @@ -222,7 +221,6 @@ def fake_choose_maz_for_taz( (), { "ALT_DEST_COL_NAME": "zone_id", - "SIMULATE_CHOOSER_COLUMNS": [location_choice.HOME_MAZ], }, )() persons_merged = pd.DataFrame( @@ -327,7 +325,6 @@ def fake_location_sample( (), { "ALT_DEST_COL_NAME": "zone_id", - "SIMULATE_CHOOSER_COLUMNS": [location_choice.HOME_MAZ], }, )() persons_merged = pd.DataFrame( diff --git a/activitysim/abm/test/test_misc/test_shadow_pricing_simulate.py b/activitysim/abm/test/test_misc/test_shadow_pricing_simulate.py index 032e2d1aa9..6d8bcff6e6 100644 --- a/activitysim/abm/test/test_misc/test_shadow_pricing_simulate.py +++ b/activitysim/abm/test/test_misc/test_shadow_pricing_simulate.py @@ -122,14 +122,6 @@ def state( choice_sizes[col] = 0 school_location_settings = """ - SIMULATE_CHOOSER_COLUMNS: - - home_zone_id - - school_segment - - household_id - - is_student - - age_0_to_5 - - age_6_to_12 - - pemploy CHOOSER_ORIG_COL_NAME: home_zone_id ALT_DEST_COL_NAME: alt_dest SAMPLE_SIZE: 30 diff --git a/activitysim/abm/test/test_misc/test_tour_destination_sampling.py b/activitysim/abm/test/test_misc/test_tour_destination_sampling.py index 2b74da1676..2157fdcadb 100644 --- a/activitysim/abm/test/test_misc/test_tour_destination_sampling.py +++ b/activitysim/abm/test/test_misc/test_tour_destination_sampling.py @@ -60,7 +60,7 @@ def test_destination_presample_uses_taz_stable_mapping(monkeypatch): def fake_destination_sample( _state, _spec_segment_name, - _choosers, + choosers, destination_size_terms, _skims, _estimator, @@ -72,6 +72,7 @@ def fake_destination_sample( stable_alt_positions=None, n_total_alts=None, ): + captured["origin_taz"] = choosers[tour_destination.ORIG_TAZ].copy() captured["alt_dest_col_name"] = alt_dest_col_name captured["zone_layer"] = zone_layer captured["active_taz_index"] = destination_size_terms.index.copy() @@ -106,7 +107,12 @@ def fake_choose_maz_for_taz( state = workflow.State().default_settings() state.settings.use_explicit_error_terms = True choosers = pd.DataFrame( - {"origin": [101]}, + { + "origin": [101], + # A merged person table may carry a home TAZ that does not match + # the configured tour origin. + tour_destination.ORIG_TAZ: [99], + }, index=pd.Index([7001], name="tour_id"), ) model_settings = type( @@ -152,6 +158,10 @@ def fake_choose_maz_for_taz( assert captured["zone_layer"] == "taz" assert captured["n_total_alts"] == 3 assert list(captured["stable_alt_positions"]) == [0, 2] + pd.testing.assert_series_equal( + captured["origin_taz"], + pd.Series([1], index=choosers.index, name=tour_destination.ORIG_TAZ), + ) pd.testing.assert_index_equal( captured["full_taz_index"], pd.Index([1, 2, 3], name=tour_destination.DEST_TAZ), diff --git a/activitysim/core/configuration/logit.py b/activitysim/core/configuration/logit.py index a1c305e532..cae9cd9736 100644 --- a/activitysim/core/configuration/logit.py +++ b/activitysim/core/configuration/logit.py @@ -6,7 +6,7 @@ import pydantic from pydantic import BaseModel as PydanticBase -from pydantic import model_validator, validator +from pydantic import field_validator, model_validator, validator from activitysim.core.configuration.base import PreprocessorSettings, PydanticCompute @@ -261,7 +261,15 @@ class TourLocationComponentSettings(LocationComponentSettings, extra="forbid"): SEGMENT_IDS: dict[str, int] | dict[str, str] | dict[str, bool] | None = None SHADOW_PRICE_TABLE: str | None = None MODELED_SIZE_TABLE: str | None = None - SIMULATE_CHOOSER_COLUMNS: list[str] | None = None + SIMULATE_CHOOSER_COLUMNS: Any | None = None + """Was used to help reduce the memory needed for the model. + + This setting is now obsolete and does nothing. Its functionality has been + replaced by :func:`activitysim.core.util.drop_unused_columns`. + + .. deprecated:: 1.6 + """ + ALT_DEST_COL_NAME: str LOGSUM_TOUR_PURPOSE: str | dict[str, str] | None = None MODEL_SELECTOR: str | None = None @@ -271,6 +279,18 @@ class TourLocationComponentSettings(LocationComponentSettings, extra="forbid"): ORIG_ZONE_ID: str | None = None """This setting appears to do nothing...""" + @field_validator("SIMULATE_CHOOSER_COLUMNS", mode="before") + @classmethod + def _deprecate_simulate_chooser_columns(cls, value): + if value is not None: + warnings.warn( + "SIMULATE_CHOOSER_COLUMNS is deprecated and no longer used, " + "unused columns are now dropped automatically", + DeprecationWarning, + stacklevel=2, + ) + return None + class TourModeComponentSettings(TemplatedLogitComponentSettings, extra="forbid"): MODE_CHOICE_LOGSUM_COLUMN_NAME: str | None = None @@ -279,4 +299,23 @@ class TourModeComponentSettings(TemplatedLogitComponentSettings, extra="forbid") nontour_preprocessor: PreprocessorSettings | list[ PreprocessorSettings ] | None = None - LOGSUM_CHOOSER_COLUMNS: list[str] = [] + LOGSUM_CHOOSER_COLUMNS: Any | None = None + """Was used to help reduce the memory needed for the model. + + This setting is now obsolete and does nothing. Its functionality has been + replaced by :func:`activitysim.core.util.drop_unused_columns`. + + .. deprecated:: 1.6 + """ + + @field_validator("LOGSUM_CHOOSER_COLUMNS", mode="before") + @classmethod + def _deprecate_logsum_chooser_columns(cls, value): + if value is not None: + warnings.warn( + "LOGSUM_CHOOSER_COLUMNS is deprecated and no longer used, " + "unused columns are now dropped automatically", + DeprecationWarning, + stacklevel=2, + ) + return None diff --git a/activitysim/core/expressions.py b/activitysim/core/expressions.py index f8a255fb12..e05df7eda3 100644 --- a/activitysim/core/expressions.py +++ b/activitysim/core/expressions.py @@ -338,15 +338,3 @@ def annotate_tables( # write table with new columns back to state state.add_table(table_name, df) - - -def filter_chooser_columns(choosers, chooser_columns): - missing_columns = [c for c in chooser_columns if c not in choosers] - if missing_columns: - logger.debug("filter_chooser_columns missing_columns %s" % missing_columns) - - # ignore any columns not appearing in choosers df - chooser_columns = [c for c in chooser_columns if c in choosers] - - choosers = choosers[chooser_columns] - return choosers diff --git a/activitysim/core/interaction_sample.py b/activitysim/core/interaction_sample.py index 84acadefbe..8a1ef1ca30 100644 --- a/activitysim/core/interaction_sample.py +++ b/activitysim/core/interaction_sample.py @@ -565,18 +565,23 @@ def _interaction_sample( if compute_settings is None: compute_settings = ComputeSettings() - # drop variables before the interaction dataframe is created + # drop variables before the interaction dataframe is created, otherwise the + # cross join of choosers and alternatives can blow up memory usage + if compute_settings.drop_unused_columns: + # when tracing, the unpruned choosers and alternatives have already been + # written out above, so here we only need to preserve the columns used to + # identify the traced rows in the interaction dataframe + trace_columns = ( + util.traceable_id_columns(choosers) if have_trace_targets else [] + ) - # check if tracing is enabled and if we have trace targets - # if not estimation mode, drop unused columns - if (not have_trace_targets) and (compute_settings.drop_unused_columns): choosers = util.drop_unused_columns( choosers, spec, locals_d, custom_chooser=None, sharrow_enabled=sharrow_enabled, - additional_columns=compute_settings.protect_columns, + additional_columns=trace_columns + compute_settings.protect_columns, ) alternatives = util.drop_unused_columns( diff --git a/activitysim/core/interaction_sample_simulate.py b/activitysim/core/interaction_sample_simulate.py index 2083a65302..1a7b927d4b 100644 --- a/activitysim/core/interaction_sample_simulate.py +++ b/activitysim/core/interaction_sample_simulate.py @@ -154,20 +154,33 @@ def _interaction_sample_simulate( if compute_settings is None: compute_settings = ComputeSettings() - # check if tracing is enabled and if we have trace targets - # if not estimation mode, drop unused columns - if ( - (not have_trace_targets) - and (estimator is None) - and (compute_settings.drop_unused_columns) - ): + if compute_settings.drop_unused_columns: + identity_columns = ( + util.traceable_id_columns(choosers) + if have_trace_targets or estimator is not None + else [] + ) + estimator_chooser_columns = ( + [estimator.chooser_id_column_name] + if estimator is not None and estimator.chooser_id_column_name is not None + else [] + ) + estimator_alternative_columns = ( + [estimator.alt_id_column_name] + if estimator is not None and estimator.alt_id_column_name is not None + else [] + ) choosers = util.drop_unused_columns( choosers, spec, locals_d, custom_chooser=None, sharrow_enabled=sharrow_enabled, - additional_columns=compute_settings.protect_columns, + additional_columns=( + identity_columns + + estimator_chooser_columns + + compute_settings.protect_columns + ), ) alternatives = util.drop_unused_columns( @@ -176,7 +189,11 @@ def _interaction_sample_simulate( locals_d, custom_chooser=None, sharrow_enabled=sharrow_enabled, - additional_columns=["tdd"] + compute_settings.protect_columns, + additional_columns=( + ["tdd"] + + estimator_alternative_columns + + compute_settings.protect_columns + ), ) interaction_df = alternatives.join(choosers, how="left", rsuffix="_chooser") diff --git a/activitysim/core/interaction_simulate.py b/activitysim/core/interaction_simulate.py index bb3213498b..a960e88618 100644 --- a/activitysim/core/interaction_simulate.py +++ b/activitysim/core/interaction_simulate.py @@ -757,22 +757,29 @@ def _interaction_simulate( if compute_settings is None: compute_settings = ComputeSettings() - # drop variables before the interaction dataframe is created - - # check if tracing is enabled and if we have trace targets - # if not estimation mode, drop unused columns - if ( - (not have_trace_targets) - and (estimator is None) - and (compute_settings.drop_unused_columns) - ): + # Pruning is safe for tracing because full inputs were written above, and + # safe for estimation because components write their chooser tables before + # utility evaluation. + if compute_settings.drop_unused_columns: + identity_columns = ( + util.traceable_id_columns(choosers) + if have_trace_targets or estimator is not None + else [] + ) + estimator_columns = ( + [estimator.chooser_id_column_name] + if estimator is not None and estimator.chooser_id_column_name is not None + else [] + ) choosers = util.drop_unused_columns( choosers, spec, locals_d, custom_chooser=None, sharrow_enabled=sharrow_enabled, - additional_columns=compute_settings.protect_columns, + additional_columns=( + identity_columns + estimator_columns + compute_settings.protect_columns + ), ) if ( diff --git a/activitysim/core/simulate.py b/activitysim/core/simulate.py index 9e3f383379..198d118a0b 100644 --- a/activitysim/core/simulate.py +++ b/activitysim/core/simulate.py @@ -1777,13 +1777,16 @@ def _simple_simulate( if compute_settings is None: compute_settings = ComputeSettings() - # if tracing is not enabled, drop unused columns - # if not estimation mode, drop unused columns - if ( - (not have_trace_targets) - and (estimator is None) - and (compute_settings.drop_unused_columns) - ): + if compute_settings.drop_unused_columns: + trace_columns = ( + util.traceable_id_columns(choosers) if have_trace_targets else [] + ) + if have_trace_targets and trace_column_names is not None: + trace_columns += ( + [trace_column_names] + if isinstance(trace_column_names, str) + else list(trace_column_names) + ) # drop unused variables in chooser table choosers = util.drop_unused_columns( choosers, @@ -1791,7 +1794,7 @@ def _simple_simulate( locals_d, custom_chooser, sharrow_enabled=sharrow_enabled, - additional_columns=compute_settings.protect_columns, + additional_columns=trace_columns + compute_settings.protect_columns, ) if nest_spec is None: @@ -2121,8 +2124,10 @@ def _simple_simulate_logsums( if compute_settings is None: compute_settings = ComputeSettings() - # if tracing is not enabled, drop unused columns - if (not have_trace_targets) and (compute_settings.drop_unused_columns): + if compute_settings.drop_unused_columns: + trace_columns = ( + util.traceable_id_columns(choosers) if have_trace_targets else [] + ) # drop unused variables in chooser table choosers = util.drop_unused_columns( choosers, @@ -2130,7 +2135,7 @@ def _simple_simulate_logsums( locals_d, custom_chooser=None, sharrow_enabled=state.settings.sharrow, - additional_columns=compute_settings.protect_columns, + additional_columns=trace_columns + compute_settings.protect_columns, ) if nest_spec is None: diff --git a/activitysim/core/test/test_deprecated_chooser_columns.py b/activitysim/core/test/test_deprecated_chooser_columns.py new file mode 100644 index 0000000000..62fdf3e81a --- /dev/null +++ b/activitysim/core/test/test_deprecated_chooser_columns.py @@ -0,0 +1,54 @@ +from __future__ import annotations + +import pytest + +from activitysim.abm.models.school_escorting import SchoolEscortSettings +from activitysim.abm.models.util.vectorize_tour_scheduling import TourSchedulingSettings +from activitysim.core.configuration.logit import ( + TourLocationComponentSettings, + TourModeComponentSettings, +) + + +@pytest.mark.parametrize( + "settings_class, extra_settings", + [ + ( + TourLocationComponentSettings, + dict( + SPEC="spec.csv", + SAMPLE_SPEC="sample_spec.csv", + SAMPLE_SIZE=10, + CHOOSER_ORIG_COL_NAME="home_zone_id", + ALT_DEST_COL_NAME="alt_dest", + ), + ), + (TourSchedulingSettings, dict(SPEC="spec.csv")), + (SchoolEscortSettings, dict(ALTS="alts.csv")), + ], +) +def test_simulate_chooser_columns_is_deprecated(settings_class, extra_settings): + with pytest.warns(DeprecationWarning, match="SIMULATE_CHOOSER_COLUMNS"): + settings = settings_class.model_validate( + dict(SIMULATE_CHOOSER_COLUMNS=["home_zone_id"], **extra_settings) + ) + # the deprecated setting is ignored + assert settings.SIMULATE_CHOOSER_COLUMNS is None + + +def test_logsum_chooser_columns_is_deprecated(): + with pytest.warns(DeprecationWarning, match="LOGSUM_CHOOSER_COLUMNS"): + settings = TourModeComponentSettings.model_validate( + dict(SPEC="spec.csv", LOGSUM_CHOOSER_COLUMNS=["age"]) + ) + # the deprecated setting is ignored + assert settings.LOGSUM_CHOOSER_COLUMNS is None + + +def test_no_warning_when_settings_omitted(): + import warnings + + with warnings.catch_warnings(): + warnings.simplefilter("error", DeprecationWarning) + TourModeComponentSettings.model_validate(dict(SPEC="spec.csv")) + TourSchedulingSettings.model_validate(dict(SPEC="spec.csv")) diff --git a/activitysim/core/test/test_interaction_sample.py b/activitysim/core/test/test_interaction_sample.py index 2d929053d0..a2d53fe66b 100644 --- a/activitysim/core/test/test_interaction_sample.py +++ b/activitysim/core/test/test_interaction_sample.py @@ -108,6 +108,68 @@ def fake_interaction_sample(_state, _choosers, _alternatives, **kwargs): assert captured["n_total_alts"] == 3 +def test_interaction_sample_prunes_unused_columns_while_tracing(state, monkeypatch): + choosers = pd.DataFrame( + { + "household_id": [10, 20], + "used": [1.0, 2.0], + "unused": [100.0, 200.0], + }, + index=pd.Index([1, 2], name="person_id"), + ) + alternatives = pd.DataFrame( + {"alt_attr": [1.0, 2.0]}, + index=pd.Index([10, 20], name="alt_id"), + ) + spec = pd.DataFrame( + {"coefficient": [1.0]}, + index=pd.Index(["used + alt_attr"], name="Expression"), + ) + pruned_chooser_columns = None + original_drop_unused_columns = interaction_sample.util.drop_unused_columns + + def capture_drop_unused_columns(df, *args, **kwargs): + nonlocal pruned_chooser_columns + result = original_drop_unused_columns(df, *args, **kwargs) + if df is choosers: + pruned_chooser_columns = list(result.columns) + return result + + monkeypatch.setattr( + interaction_sample.util, "drop_unused_columns", capture_drop_unused_columns + ) + monkeypatch.setattr(state.tracing, "has_trace_targets", lambda _df: True) + monkeypatch.setattr(state.tracing, "trace_df", lambda *_args, **_kwargs: None) + monkeypatch.setattr( + state.tracing, + "interaction_trace_rows", + lambda interaction_df, *_args: ( + np.ones(len(interaction_df), dtype=bool), + ["trace"], + ), + ) + monkeypatch.setattr( + state.tracing, + "trace_interaction_eval_results", + lambda *_args, **_kwargs: None, + ) + + state.rng().set_base_seed(42) + state.rng().add_channel("person_id", choosers) + state.rng().begin_step("test_traced_pruning") + + interaction_sample.interaction_sample( + state, + choosers, + alternatives, + spec, + sample_size=1, + alt_col_name="alt_id", + ) + + assert pruned_chooser_columns == ["household_id", "used"] + + def _weighted_shares(df: pd.DataFrame) -> pd.Series: counts = df.groupby("alt_id")["pick_count"].sum() return (counts / counts.sum()).sort_index() diff --git a/activitysim/core/test/test_simulate.py b/activitysim/core/test/test_simulate.py index 21e0f90e73..d192b0df9b 100644 --- a/activitysim/core/test/test_simulate.py +++ b/activitysim/core/test/test_simulate.py @@ -103,6 +103,42 @@ def test_simple_simulate_chunked(state, data, spec): pdt.assert_series_equal(choices, expected, check_dtype=False) +def test_simple_simulate_prunes_unused_columns_while_tracing(state, monkeypatch): + choosers = pd.DataFrame( + { + "household_id": [10, 20], + "tour_id": [100, 200], + "used": [1.0, 2.0], + "unused": [100.0, 200.0], + }, + index=pd.Index([1, 2], name="person_id"), + ) + spec = pd.DataFrame( + {"alternative": [1.0]}, + index=pd.Index(["used"], name="Expression"), + ) + captured_columns = None + + monkeypatch.setattr(state.tracing, "has_trace_targets", lambda _df: True) + + def capture_eval_mnl(_state, pruned_choosers, *_args, **_kwargs): + nonlocal captured_columns + captured_columns = list(pruned_choosers.columns) + return pd.Series(0, index=pruned_choosers.index) + + monkeypatch.setattr(simulate, "eval_mnl", capture_eval_mnl) + + simulate.simple_simulate( + state, + choosers, + spec, + nest_spec=None, + trace_column_names="tour_id", + ) + + assert captured_columns == ["household_id", "tour_id", "used"] + + def test_eval_mnl_eet(state): # Check that the same counts are returned by eval_mnl when using EET and when not. diff --git a/activitysim/core/util.py b/activitysim/core/util.py index 58bc50be46..1d03182cdd 100644 --- a/activitysim/core/util.py +++ b/activitysim/core/util.py @@ -660,6 +660,20 @@ def zarr_file_modification_time(zarr_dir: Path): return t +def traceable_id_columns(choosers): + """Return non-index identifiers needed to slice interaction trace rows.""" + return [ + column + for column in ( + "household_id", + "person_id", + "proto_household_id", + "proto_person_id", + ) + if column in choosers.columns + ] + + def drop_unused_columns( choosers, spec, diff --git a/activitysim/estimation/larch/location_choice.py b/activitysim/estimation/larch/location_choice.py index 5c50f6b736..a343dfafd2 100644 --- a/activitysim/estimation/larch/location_choice.py +++ b/activitysim/estimation/larch/location_choice.py @@ -63,6 +63,17 @@ def size_coefficients_from_spec(size_spec): ) +def _suffix_overlapping_chooser_columns(chooser_data, alternative_data): + """Match ActivitySim's namespace for chooser/alternative name collisions.""" + overlapping_columns = chooser_data.columns.intersection(alternative_data.columns) + if len(overlapping_columns) == 0: + return chooser_data + + return chooser_data.rename( + columns={name: f"{name}_chooser" for name in overlapping_columns} + ) + + def location_choice_model( name="workplace_location", edb_directory="output/estimation_data_bundle/{name}/", @@ -436,6 +447,12 @@ def split(a, n): assert len(x_co) > 0, "Empty chooser dataframe" assert len(x_ca_1) > 0, "Empty alternatives dataframe" + # ActivitySim gives chooser columns an ``_chooser`` suffix when the same + # name is present on an alternative. Reproduce that namespace in the EDB + # so wider automatically-pruned chooser tables do not collide with land-use + # variables when the case and alternative datasets are merged. + x_co = _suffix_overlapping_chooser_columns(x_co, x_ca_1) + d_ca = lx.Dataset.construct.from_idca(x_ca_1) d_co = lx.Dataset.construct.from_idco(x_co) d = d_ca.merge(d_co) diff --git a/activitysim/estimation/test/test_larch_location_choice.py b/activitysim/estimation/test/test_larch_location_choice.py new file mode 100644 index 0000000000..da49c83386 --- /dev/null +++ b/activitysim/estimation/test/test_larch_location_choice.py @@ -0,0 +1,36 @@ +from __future__ import annotations + +import pandas as pd + +from activitysim.estimation.larch.location_choice import ( + _suffix_overlapping_chooser_columns, +) + + +def test_suffix_overlapping_chooser_columns(): + chooser_data = pd.DataFrame( + { + "DISTRICT": [1, 2], + "income": [50_000, 75_000], + } + ) + alternative_data = pd.DataFrame( + { + "DISTRICT": [3, 4], + "size_term": [10.0, 20.0], + } + ) + + result = _suffix_overlapping_chooser_columns(chooser_data, alternative_data) + + assert list(result.columns) == ["DISTRICT_chooser", "income"] + assert list(chooser_data.columns) == ["DISTRICT", "income"] + + +def test_suffix_overlapping_chooser_columns_without_overlap(): + chooser_data = pd.DataFrame({"income": [50_000, 75_000]}) + alternative_data = pd.DataFrame({"size_term": [10.0, 20.0]}) + + result = _suffix_overlapping_chooser_columns(chooser_data, alternative_data) + + assert result is chooser_data diff --git a/activitysim/examples/placeholder_multiple_zone/configs_1_zone/non_mandatory_tour_destination.yaml b/activitysim/examples/placeholder_multiple_zone/configs_1_zone/non_mandatory_tour_destination.yaml index a4b2e86c64..19e26abd58 100644 --- a/activitysim/examples/placeholder_multiple_zone/configs_1_zone/non_mandatory_tour_destination.yaml +++ b/activitysim/examples/placeholder_multiple_zone/configs_1_zone/non_mandatory_tour_destination.yaml @@ -24,11 +24,6 @@ SEGMENTS: - social - escort -SIMULATE_CHOOSER_COLUMNS: - - tour_type - - home_zone_id - - person_id - LOGSUM_SETTINGS: tour_mode_choice.yaml # model-specific logsum-related settings diff --git a/activitysim/examples/placeholder_psrc/configs/atwork_subtour_destination.yaml b/activitysim/examples/placeholder_psrc/configs/atwork_subtour_destination.yaml index ea2ac82c23..b04a4898bf 100644 --- a/activitysim/examples/placeholder_psrc/configs/atwork_subtour_destination.yaml +++ b/activitysim/examples/placeholder_psrc/configs/atwork_subtour_destination.yaml @@ -13,11 +13,6 @@ SEGMENTS: ORIG_ZONE_ID: workplace_zone_id -SIMULATE_CHOOSER_COLUMNS: - - person_id - - income_segment - - workplace_zone_id - LOGSUM_SETTINGS: tour_mode_choice.yaml # model-specific logsum-related settings diff --git a/activitysim/examples/placeholder_psrc/configs/mandatory_tour_scheduling.yaml b/activitysim/examples/placeholder_psrc/configs/mandatory_tour_scheduling.yaml index 871f159ca7..69775593ea 100755 --- a/activitysim/examples/placeholder_psrc/configs/mandatory_tour_scheduling.yaml +++ b/activitysim/examples/placeholder_psrc/configs/mandatory_tour_scheduling.yaml @@ -1,22 +1,4 @@ -SIMULATE_CHOOSER_COLUMNS: - - ptype - - hhsize - - roundtrip_auto_time_to_work - - num_workers - - income_in_thousands - - work_and_school_and_worker - - work_and_school_and_student - - workplace_in_cbd - - home_is_rural - - mandatory_tour_frequency - - is_worker - - is_student - - is_university - - workplace_zone_id - - school_zone_id - - home_zone_id - LOGSUM_SETTINGS: tour_mode_choice.yaml # school and univ have the same spec file and coefficients but are handled seperately diff --git a/activitysim/examples/placeholder_psrc/configs/non_mandatory_tour_destination.yaml b/activitysim/examples/placeholder_psrc/configs/non_mandatory_tour_destination.yaml index 3bc2483c88..6a173bb1d6 100755 --- a/activitysim/examples/placeholder_psrc/configs/non_mandatory_tour_destination.yaml +++ b/activitysim/examples/placeholder_psrc/configs/non_mandatory_tour_destination.yaml @@ -24,11 +24,6 @@ SEGMENTS: - social - escort -SIMULATE_CHOOSER_COLUMNS: - - tour_type - - home_zone_id - - person_id - LOGSUM_SETTINGS: tour_mode_choice.yaml # model-specific logsum-related settings diff --git a/activitysim/examples/placeholder_psrc/configs/non_mandatory_tour_scheduling.yaml b/activitysim/examples/placeholder_psrc/configs/non_mandatory_tour_scheduling.yaml index 5c1d821135..d36c0db4e0 100755 --- a/activitysim/examples/placeholder_psrc/configs/non_mandatory_tour_scheduling.yaml +++ b/activitysim/examples/placeholder_psrc/configs/non_mandatory_tour_scheduling.yaml @@ -19,11 +19,3 @@ preprocessor: - land_use - joint_tour_participants -SIMULATE_CHOOSER_COLUMNS: - - ptype - - num_children - - roundtrip_auto_time_to_work - - num_mand - - num_escort_tours - - num_non_escort_tours - - adult diff --git a/activitysim/examples/placeholder_psrc/configs/school_location.yaml b/activitysim/examples/placeholder_psrc/configs/school_location.yaml index 07114fd0ea..896e2b0b4f 100755 --- a/activitysim/examples/placeholder_psrc/configs/school_location.yaml +++ b/activitysim/examples/placeholder_psrc/configs/school_location.yaml @@ -1,10 +1,5 @@ SAMPLE_SIZE: 30 -SIMULATE_CHOOSER_COLUMNS: - - home_zone_id - - school_segment - - household_id - # model-specific logsum-related settings CHOOSER_ORIG_COL_NAME: home_zone_id ALT_DEST_COL_NAME: alt_dest diff --git a/activitysim/examples/placeholder_psrc/configs/tour_mode_choice.yaml b/activitysim/examples/placeholder_psrc/configs/tour_mode_choice.yaml index 5caa0d586d..96f72ab612 100755 --- a/activitysim/examples/placeholder_psrc/configs/tour_mode_choice.yaml +++ b/activitysim/examples/placeholder_psrc/configs/tour_mode_choice.yaml @@ -170,20 +170,5 @@ nontour_preprocessor: TABLES: - land_use -# to reduce memory needs filter chooser table to these fields -LOGSUM_CHOOSER_COLUMNS: - - tour_type - - hhsize - - density_index - - age - - age_16_p - - age_16_to_19 - - auto_ownership - - number_of_participants - - tour_category - - num_workers - - value_of_time - - free_parking_at_work - MODE_CHOICE_LOGSUM_COLUMN_NAME: mode_choice_logsum diff --git a/activitysim/examples/placeholder_psrc/configs/workplace_location.yaml b/activitysim/examples/placeholder_psrc/configs/workplace_location.yaml index 71c1b74d5f..5c05c0da7c 100755 --- a/activitysim/examples/placeholder_psrc/configs/workplace_location.yaml +++ b/activitysim/examples/placeholder_psrc/configs/workplace_location.yaml @@ -1,9 +1,5 @@ SAMPLE_SIZE: 30 -SIMULATE_CHOOSER_COLUMNS: - - income_segment - - home_zone_id - SAMPLE_SPEC: workplace_location_sample.csv SPEC: workplace_location.csv COEFFICIENTS: workplace_location_coeffs.csv diff --git a/activitysim/examples/production_semcog/configs/atwork_subtour_destination.yaml b/activitysim/examples/production_semcog/configs/atwork_subtour_destination.yaml index af05b1ecea..1fb9c84333 100644 --- a/activitysim/examples/production_semcog/configs/atwork_subtour_destination.yaml +++ b/activitysim/examples/production_semcog/configs/atwork_subtour_destination.yaml @@ -10,11 +10,6 @@ ORIG_ZONE_ID: workplace_zone_id SAMPLE_SIZE: 30 -SIMULATE_CHOOSER_COLUMNS: - - person_id - - income_segment - - workplace_zone_id - LOGSUM_SETTINGS: tour_mode_choice.yaml # model-specific logsum-related settings diff --git a/activitysim/examples/production_semcog/configs/joint_tour_destination.yaml b/activitysim/examples/production_semcog/configs/joint_tour_destination.yaml index 8043564ee8..0306380072 100644 --- a/activitysim/examples/production_semcog/configs/joint_tour_destination.yaml +++ b/activitysim/examples/production_semcog/configs/joint_tour_destination.yaml @@ -16,13 +16,6 @@ SAMPLE_SIZE: 30 # we can't use use household income_segment as this will also be set for non-workers CHOOSER_SEGMENT_COLUMN_NAME: tour_type -SIMULATE_CHOOSER_COLUMNS: - - tour_type - - home_zone_id - - person_id - - income_segment - - num_children - LOGSUM_SETTINGS: tour_mode_choice.yaml # model-specific logsum-related settings diff --git a/activitysim/examples/production_semcog/configs/mandatory_tour_scheduling.yaml b/activitysim/examples/production_semcog/configs/mandatory_tour_scheduling.yaml index ea9ca0a2db..ea8fd5d5e4 100644 --- a/activitysim/examples/production_semcog/configs/mandatory_tour_scheduling.yaml +++ b/activitysim/examples/production_semcog/configs/mandatory_tour_scheduling.yaml @@ -1,28 +1,4 @@ -SIMULATE_CHOOSER_COLUMNS: - - age - - female - - ptype - - is_university - - is_income_less25K - - is_income_25K_to_60K - - is_income_60K_to_120K - - is_income_greater120K - - is_pre_drive_child_in_HH - - is_non_worker_in_HH - - auto_ownership - - is_all_adults_full_time_workers - - distance_to_school - - roundtrip_auto_time_to_work - - roundtrip_auto_time_to_school - - free_parking_at_work - - workplace_zone_id - - school_zone_id - - home_zone_id - - TAZ - - transit_pass_ownership - - transit_pass_subsidy - LOGSUM_SETTINGS: tour_mode_choice.yaml TOUR_SPEC_SEGMENTS: diff --git a/activitysim/examples/production_semcog/configs/non_mandatory_tour_destination.yaml b/activitysim/examples/production_semcog/configs/non_mandatory_tour_destination.yaml index ca005185dd..69d3a0326c 100644 --- a/activitysim/examples/production_semcog/configs/non_mandatory_tour_destination.yaml +++ b/activitysim/examples/production_semcog/configs/non_mandatory_tour_destination.yaml @@ -24,18 +24,6 @@ SEGMENTS: - social - escort -SIMULATE_CHOOSER_COLUMNS: - - tour_type - - home_zone_id - - person_id - - income_segment - - pemploy - - is_student - - age_0_to_5 - - age_6_to_12 - - hh_child - - home_county - LOGSUM_SETTINGS: tour_mode_choice.yaml # model-specific logsum-related settings diff --git a/activitysim/examples/production_semcog/configs/non_mandatory_tour_scheduling.yaml b/activitysim/examples/production_semcog/configs/non_mandatory_tour_scheduling.yaml index 1dd3561ff1..da2c1571f5 100644 --- a/activitysim/examples/production_semcog/configs/non_mandatory_tour_scheduling.yaml +++ b/activitysim/examples/production_semcog/configs/non_mandatory_tour_scheduling.yaml @@ -10,29 +10,6 @@ preprocessor: - land_use - joint_tour_participants -SIMULATE_CHOOSER_COLUMNS: - - home_zone_id - - age - - female - - adult - - ptype - - is_university - - has_pre_school_child_with_mandatory - - has_driving_age_child_with_mandatory - - retired_adults_only_hh - - is_income_less25K - - is_income_25K_to_60K - - is_income_60K_to_120K - - auto_ownership - - num_children - - num_adults - - num_mand - - num_joint_tours - - num_escort_tours - - num_non_escort_tours - - num_add_shop_maint_tours - - num_add_soc_discr_tours - LOGSUM_SETTINGS: tour_mode_choice.yaml # map : : diff --git a/activitysim/examples/production_semcog/configs/school_location.yaml b/activitysim/examples/production_semcog/configs/school_location.yaml index e16a80dde0..e851169305 100644 --- a/activitysim/examples/production_semcog/configs/school_location.yaml +++ b/activitysim/examples/production_semcog/configs/school_location.yaml @@ -1,14 +1,5 @@ SAMPLE_SIZE: 30 -SIMULATE_CHOOSER_COLUMNS: - - home_zone_id - - school_segment - - household_id - - is_student - - age_0_to_5 - - age_6_to_12 - - pemploy - # model-specific logsum-related settings CHOOSER_ORIG_COL_NAME: home_zone_id ALT_DEST_COL_NAME: alt_dest diff --git a/activitysim/examples/production_semcog/configs/tour_mode_choice.yaml b/activitysim/examples/production_semcog/configs/tour_mode_choice.yaml index 19b352c857..693a66fdef 100644 --- a/activitysim/examples/production_semcog/configs/tour_mode_choice.yaml +++ b/activitysim/examples/production_semcog/configs/tour_mode_choice.yaml @@ -169,22 +169,4 @@ nontour_preprocessor: TABLES: - land_use -# to reduce memory needs filter chooser table to these fields -LOGSUM_CHOOSER_COLUMNS: - - tour_type - - hhsize - - density_index - - age - - age_16_p - - age_16_to_19 - - auto_ownership - - number_of_participants - - tour_category - - num_workers - - value_of_time - - free_parking_at_work - - umich_affiliate - - income - - transit_pass_ownership - - transit_pass_subsidy MODE_CHOICE_LOGSUM_COLUMN_NAME: mode_choice_logsum diff --git a/activitysim/examples/production_semcog/configs/tour_scheduling_atwork.yaml b/activitysim/examples/production_semcog/configs/tour_scheduling_atwork.yaml index f04f93b8e5..40eff6b4e5 100644 --- a/activitysim/examples/production_semcog/configs/tour_scheduling_atwork.yaml +++ b/activitysim/examples/production_semcog/configs/tour_scheduling_atwork.yaml @@ -9,8 +9,5 @@ preprocessor: # - land_use # - tours -SIMULATE_CHOOSER_COLUMNS: - - od_distance - CONSTANTS: time_cap: 30 \ No newline at end of file diff --git a/activitysim/examples/production_semcog/configs/workplace_location.yaml b/activitysim/examples/production_semcog/configs/workplace_location.yaml index c7c209c742..e01bb80595 100644 --- a/activitysim/examples/production_semcog/configs/workplace_location.yaml +++ b/activitysim/examples/production_semcog/configs/workplace_location.yaml @@ -1,12 +1,5 @@ SAMPLE_SIZE: 30 -SIMULATE_CHOOSER_COLUMNS: - - income_segment - - home_zone_id - - is_student - - pemploy - - home_county - SAMPLE_SPEC: workplace_location_sample.csv SPEC: workplace_location.csv COEFFICIENTS: workplace_location_coeffs.csv diff --git a/activitysim/examples/production_semcog/test/regress/final_trips.csv b/activitysim/examples/production_semcog/test/regress/final_trips.csv index 3402fa28c2..38e5ab9422 100644 --- a/activitysim/examples/production_semcog/test/regress/final_trips.csv +++ b/activitysim/examples/production_semcog/test/regress/final_trips.csv @@ -42,22 +42,22 @@ trip_id,person_id,household_id,primary_purpose,trip_num,outbound,trip_count,dest 1752394330,2671332,1083128,shopping,2,False,2,22637,22713,109524645,home,,,False,30.0,0,876197166,DRIVEALONE,-0.6753239045055804 1871905057,2853513,1152948,shopping,1,True,1,22781,22770,116994066,shopping,,,False,13.0,0,935952529,WALK,-0.15286567920809457 1871905065,2853513,1152948,shopping,1,False,1,22770,22781,116994066,home,,,False,16.0,0,935952533,WALK,-0.15286567920809457 -1871905073,2853513,1152948,shopping,1,True,1,22800,22770,116994067,shopping,,,False,22.0,0,935952537,WALK,-0.6260852483044879 -1871905081,2853513,1152948,shopping,1,False,2,22807,22800,116994067,othmaint,13.689405015818817,,False,23.0,0,935952541,WALK,-0.5662778537062289 -1871905082,2853513,1152948,shopping,2,False,2,22770,22807,116994067,home,,,False,23.0,0,935952542,WALK,2.1564636451535324 +1871905073,2853513,1152948,shopping,1,True,1,22804,22770,116994067,shopping,,,False,22.0,0,935952537,WALK,-0.09038920657732336 +1871905081,2853513,1152948,shopping,1,False,2,22770,22804,116994067,othmaint,14.727081498405456,,False,23.0,0,935952541,WALK,-0.09038920657732336 +1871905082,2853513,1152948,shopping,2,False,2,22770,22770,116994067,home,,,False,23.0,0,935952542,WALK,1.2924624540580065 1871905089,2853513,1152948,shopping,1,True,1,22798,22770,116994068,shopping,,,False,25.0,0,935952545,WALK,0.3629456060638815 1871905097,2853513,1152948,shopping,1,False,1,22770,22798,116994068,home,,,False,32.0,0,935952549,WALK,0.3629456060638815 -1873669969,2856204,1154357,escort,1,True,1,22767,22815,117104373,escort,,,False,11.0,0,936834985,WALK,1.572441903227518 -1873669977,2856204,1154357,escort,1,False,1,22815,22767,117104373,home,,,False,11.0,0,936834989,WALK,1.572441903227518 +1873669969,2856204,1154357,escort,1,True,1,22767,22815,117104373,escort,,,False,25.0,0,936834985,WALK,1.572441903227518 +1873669977,2856204,1154357,escort,1,False,1,22815,22767,117104373,home,,,False,26.0,0,936834989,WALK,1.572441903227518 1873670225,2856204,1154357,othdiscr,1,True,1,22795,22815,117104389,othdiscr,,,False,11.0,0,936835113,WALK,-1.136157391902266 -1873670233,2856204,1154357,othdiscr,1,False,1,22815,22795,117104389,home,,,False,15.0,0,936835117,WALK,-1.136157391902266 -1873670321,2856204,1154357,univ,1,True,3,22767,22815,117104395,work,13.498034431649993,,False,21.0,0,936835161,WALK,5.028511196364142 -1873670322,2856204,1154357,univ,2,True,3,22809,22767,117104395,univ,10.775599452844196,22809,False,22.0,0,936835162,WALK_LOC,2.7954607582586246 -1873670323,2856204,1154357,univ,3,True,3,22809,22809,117104395,univ,,,False,24.0,0,936835163,WALK,3.0008457318923365 -1873670329,2856204,1154357,univ,1,False,4,22767,22809,117104395,othmaint,11.97899358246422,,False,42.0,0,936835165,WALK,2.7869485143816908 -1873670330,2856204,1154357,univ,2,False,4,22764,22767,117104395,univ,14.341759600913552,,False,42.0,0,936835166,WALK,5.487620370472843 -1873670331,2856204,1154357,univ,3,False,4,22770,22764,117104395,othdiscr,12.599191957343043,,False,44.0,0,936835167,WALK,2.6096929225906433 -1873670332,2856204,1154357,univ,4,False,4,22815,22770,117104395,home,,,False,44.0,0,936835168,WALK_LOC,3.5917238491796746 +1873670233,2856204,1154357,othdiscr,1,False,1,22815,22795,117104389,home,,,False,14.0,0,936835117,WALK,-1.136157391902266 +1873670321,2856204,1154357,univ,1,True,3,22767,22815,117104395,work,13.498034431649993,,False,22.0,0,936835161,WALK,5.028742724196297 +1873670322,2856204,1154357,univ,2,True,3,22809,22767,117104395,univ,10.775599452844196,22809,False,22.0,0,936835162,WALK_LOC,2.7974400032247324 +1873670323,2856204,1154357,univ,3,True,3,22809,22809,117104395,univ,,,False,23.0,0,936835163,WALK,3.002749099971166 +1873670329,2856204,1154357,univ,1,False,4,22767,22809,117104395,othmaint,11.97899358246422,,False,22.0,0,936835165,WALK,2.8108919967071793 +1873670330,2856204,1154357,univ,2,False,4,22764,22767,117104395,univ,14.341759600913552,,False,22.0,0,936835166,WALK,5.443437829357615 +1873670331,2856204,1154357,univ,3,False,4,22770,22764,117104395,othdiscr,12.599191957343043,,False,22.0,0,936835167,WALK,2.6659772507500294 +1873670332,2856204,1154357,univ,4,False,4,22815,22770,117104395,home,,,False,25.0,0,936835168,WALK_LOC,3.594676984676708 1873969057,2856660,1154635,eatout,1,True,1,22810,22815,117123066,eatout,,,False,32.0,0,936984529,WALK,-0.29168228455903983 1873969065,2856660,1154635,eatout,1,False,1,22815,22810,117123066,home,,,False,33.0,0,936984533,WALK,-0.29168228455903983 1873969457,2856660,1154635,univ,1,True,1,22764,22815,117123091,univ,,,False,17.0,0,936984729,WALK,1.8818869666378932 @@ -65,14 +65,14 @@ trip_id,person_id,household_id,primary_purpose,trip_num,outbound,trip_count,dest 1873969466,2856660,1154635,univ,2,False,4,22767,22766,117123091,eatout,11.698000750719451,,False,20.0,0,936984734,WALK,2.0354974925066145 1873969467,2856660,1154635,univ,3,False,4,22764,22767,117123091,univ,14.467091292345321,,False,26.0,0,936984735,WALK,5.113556461480974 1873969468,2856660,1154635,univ,4,False,4,22815,22764,117123091,home,,,False,30.0,0,936984736,WALK,1.8818676173433673 -1873970113,2856661,1154635,univ,1,True,2,22767,22815,117123132,eatout,24.13568322189892,,False,9.0,0,936985057,WALK,5.024093072052891 -1873970114,2856661,1154635,univ,2,True,2,22809,22767,117123132,univ,,,False,10.0,0,936985058,WALK,2.7951650320100074 -1873970121,2856661,1154635,univ,1,False,4,22809,22809,117123132,univ,22.10560655915902,22809,False,24.0,0,936985061,WALK,3.000453614136991 -1873970122,2856661,1154635,univ,2,False,4,22809,22809,117123132,univ,21.992495219718602,22809,False,24.0,0,936985062,WALK,3.000453614136991 -1873970123,2856661,1154635,univ,3,False,4,22807,22809,117123132,work,26.50952124631712,,False,25.0,0,936985063,WALK,3.007444572576448 -1873970124,2856661,1154635,univ,4,False,4,22815,22807,117123132,home,,,False,31.0,0,936985064,WALK,5.1535448290063615 +1873970113,2856661,1154635,univ,1,True,2,22767,22815,117123132,eatout,24.134848869109547,,False,9.0,0,936985057,WALK,5.024062155997833 +1873970114,2856661,1154635,univ,2,True,2,22809,22767,117123132,univ,,,False,10.0,0,936985058,WALK,2.7948861353314003 +1873970121,2856661,1154635,univ,1,False,4,22809,22809,117123132,univ,22.047248107694983,22809,False,28.0,0,936985061,WALK,3.0001790753348407 +1873970122,2856661,1154635,univ,2,False,4,22809,22809,117123132,univ,21.926856721398586,22809,False,28.0,0,936985062,WALK,3.0001790753348407 +1873970123,2856661,1154635,univ,3,False,4,22807,22809,117123132,work,26.43433572168323,,False,36.0,0,936985063,WALK,2.989646977236189 +1873970124,2856661,1154635,univ,4,False,4,22815,22807,117123132,home,,,False,39.0,0,936985064,WALK,5.130924343308374 1877439505,2861950,1156849,shopping,1,True,1,22800,22801,117339969,shopping,,,False,21.0,0,938719753,WALK,-0.49881710844895727 -1877439513,2861950,1156849,shopping,1,False,1,22801,22800,117339969,home,,,False,30.0,0,938719757,WALK,-0.49881710844895727 +1877439513,2861950,1156849,shopping,1,False,1,22801,22800,117339969,home,,,False,26.0,0,938719757,WALK,-0.49881710844895727 1877439697,2861950,1156849,univ,1,True,1,22809,22801,117339981,univ,,,False,13.0,0,938719849,WALK,2.7089529835300503 1877439705,2861950,1156849,univ,1,False,2,22766,22809,117339981,univ,22.262579096450402,22766,False,20.0,0,938719853,WALK_LOC,2.560406996243793 1877439706,2861950,1156849,univ,2,False,2,22801,22766,117339981,home,,,False,21.0,0,938719854,WALK_LOC,2.3733339088312397 @@ -81,23 +81,23 @@ trip_id,person_id,household_id,primary_purpose,trip_num,outbound,trip_count,dest 1877440362,2861951,1156849,univ,2,False,3,22767,22767,117340022,shopping,17.816995526914052,,False,12.0,0,938720182,WALK,2.62825193059268 1877440363,2861951,1156849,univ,3,False,3,22801,22767,117340022,home,,,False,13.0,0,938720183,WALK,1.890862363486975 1877441009,2861952,1156849,univ,1,True,1,22809,22801,117340063,univ,,,False,7.0,0,938720505,WALK,-0.656569218265208 -1877441017,2861952,1156849,univ,1,False,1,22801,22809,117340063,home,,,False,11.0,0,938720509,WALK,-0.656569218265208 +1877441017,2861952,1156849,univ,1,False,1,22801,22809,117340063,home,,,False,12.0,0,938720509,WALK,-0.656569218265208 1877441025,2861952,1156849,univ,1,True,1,22809,22801,117340064,univ,,,False,30.0,0,938720513,WALK,-0.656569218265208 -1877441033,2861952,1156849,univ,1,False,1,22801,22809,117340064,home,,,False,32.0,0,938720517,WALK,-0.656569218265208 +1877441033,2861952,1156849,univ,1,False,1,22801,22809,117340064,home,,,False,38.0,0,938720517,WALK,-0.656569218265208 1877508577,2862055,1156884,univ,1,True,3,22767,22804,117344286,eatout,12.979710329497422,,False,19.0,0,938754289,WALK,1.8938019500606744 1877508578,2862055,1156884,univ,2,True,3,22767,22767,117344286,work,15.06828301301832,,False,20.0,0,938754290,WALK,2.62825193059268 1877508579,2862055,1156884,univ,3,True,3,22809,22767,117344286,univ,,,False,22.0,0,938754291,WALK,-0.50518420043921 1877508585,2862055,1156884,univ,1,False,1,22804,22809,117344286,home,,,False,22.0,0,938754293,WALK,-0.44242952311569 1877509233,2862056,1156884,univ,1,True,1,22809,22804,117344327,univ,,,False,12.0,0,938754617,WALK,2.816810400707295 1877509241,2862056,1156884,univ,1,False,1,22804,22809,117344327,home,,,False,27.0,0,938754621,WALK,2.818487568540833 -1877509889,2862057,1156884,univ,1,True,1,22809,22804,117344368,univ,,,False,9.0,0,938754945,WALK,2.8149418226097684 -1877509897,2862057,1156884,univ,1,False,4,22767,22809,117344368,othdiscr,14.092132672154193,,False,29.0,0,938754949,WALK,2.8115136852150613 -1877509898,2862057,1156884,univ,2,False,4,22809,22767,117344368,univ,15.082414498585248,22809,False,29.0,0,938754950,WALK_LOC,5.421713617528955 -1877509899,2862057,1156884,univ,3,False,4,22809,22809,117344368,univ,11.07119990210677,22809,False,29.0,0,938754951,WALK,3.0039396426418254 -1877509900,2862057,1156884,univ,4,False,4,22804,22809,117344368,home,,,False,40.0,0,938754952,WALK,2.7990874824379435 +1877509889,2862057,1156884,univ,1,True,1,22809,22804,117344368,univ,,,False,9.0,0,938754945,WALK,2.8146496714631066 +1877509897,2862057,1156884,univ,1,False,4,22767,22809,117344368,othdiscr,14.092132672154193,,False,33.0,0,938754949,WALK,2.7900778639675052 +1877509898,2862057,1156884,univ,2,False,4,22809,22767,117344368,univ,15.082414498585248,22809,False,33.0,0,938754950,WALK_LOC,5.401250953593616 +1877509899,2862057,1156884,univ,3,False,4,22809,22809,117344368,univ,11.07119990210677,22809,False,33.0,0,938754951,WALK,3.0037459474665225 +1877509900,2862057,1156884,univ,4,False,4,22804,22809,117344368,home,,,False,43.0,0,938754952,WALK,2.7990874824379435 1878731969,2863920,1157823,othmaint,1,True,2,22795,22812,117420748,parking,,,False,7.0,1,939365985,DRIVEALONE,-0.09902637407657627 -1878731970,2863920,1157823,othmaint,2,True,2,22806,22795,117420748,othmaint,,,True,7.0,1,939365985,WALK,3.92788746633635 -1878731977,2863920,1157823,othmaint,1,False,7,22767,22806,117420748,eatout,11.485301584384368,,True,8.0,1,939365989,WALK,4.150955713093153 +1878731970,2863920,1157823,othmaint,2,True,2,22805,22795,117420748,othmaint,,,True,7.0,1,939365985,WALK,3.5903450329339175 +1878731977,2863920,1157823,othmaint,1,False,7,22767,22805,117420748,eatout,11.414567091292257,,True,8.0,1,939365989,WALK,3.9455031755552255 1878731978,2863920,1157823,othmaint,2,False,7,22795,22767,117420748,parking,,,True,8.0,1,939365990,WALK,4.44330039201803 1878731979,2863920,1157823,othmaint,3,False,7,22738,22795,117420748,shopping,11.358833245442405,,False,8.0,1,939365990,DRIVEALONE,-0.6103921916626766 1878731980,2863920,1157823,othmaint,4,False,7,22795,22738,117420748,parking,,,False,9.0,1,939365991,DRIVEALONE,-0.39605030270985575 @@ -130,16 +130,18 @@ trip_id,person_id,household_id,primary_purpose,trip_num,outbound,trip_count,dest 1880696393,2866915,1159236,escort,1,False,2,22796,22738,117543524,parking,,,False,10.0,1,940348197,DRIVEALONE,-0.3618327302148594 1880696394,2866915,1159236,escort,2,False,2,22796,22796,117543524,parking,,,True,10.0,1,940348197,WALK,1.067154699334263 1880696865,2866915,1159236,work,1,True,1,22801,22797,117543554,work,,,False,14.0,0,940348433,WALK,0.19014379979819185 -1880696873,2866915,1159236,work,1,False,4,22770,22801,117543554,shopping,11.568986593078103,,False,24.0,0,940348437,WALK,0.4209941097322794 +1880696873,2866915,1159236,work,1,False,4,22770,22801,117543554,shopping,11.568986593078103,,False,25.0,0,940348437,WALK,0.4209941097322794 1880696874,2866915,1159236,work,2,False,4,22771,22770,117543554,eatout,13.008322605925745,,False,25.0,0,940348438,WALK,0.6865956537757166 -1880696875,2866915,1159236,work,3,False,4,22767,22771,117543554,shopping,12.587784804165072,,False,25.0,0,940348439,WALK,0.7791172141286921 -1880696876,2866915,1159236,work,4,False,4,22797,22767,117543554,home,,,False,26.0,0,940348440,WALK,0.4989418541157284 +1880696875,2866915,1159236,work,3,False,4,22767,22771,117543554,shopping,12.58778480416507,,False,26.0,0,940348439,WALK,0.7791172141286921 +1880696876,2866915,1159236,work,4,False,4,22797,22767,117543554,home,,,False,27.0,0,940348440,WALK,0.4989418541157284 1883150833,2870656,1160939,univ,1,True,1,22764,22740,117696927,univ,,,False,9.0,0,941575417,WALK,-0.4952620689018146 1883150841,2870656,1160939,univ,1,False,1,22740,22764,117696927,home,,,False,20.0,0,941575421,SHARED2,-0.7088657694023863 -1885520561,2874269,1162627,eatout,1,True,1,22771,22758,117845035,eatout,,,False,19.0,0,942760281,WALK,0.8892845196071101 -1885520569,2874269,1162627,eatout,1,False,1,22758,22771,117845035,home,,,False,21.0,0,942760285,WALK,0.8892845196071101 -1885520961,2874269,1162627,univ,1,True,1,22766,22758,117845060,univ,,,False,33.0,0,942760481,WALK,-0.9851903695198061 -1885520969,2874269,1162627,univ,1,False,1,22758,22766,117845060,home,,,False,48.0,0,942760485,WALK,-0.9851903695198061 +1885520561,2874269,1162627,eatout,1,True,1,22771,22758,117845035,eatout,,,False,30.0,0,942760281,WALK,0.8892845196071101 +1885520569,2874269,1162627,eatout,1,False,1,22758,22771,117845035,home,,,False,31.0,0,942760285,WALK,0.8892845196071101 +1885520865,2874269,1162627,othdiscr,1,True,1,22766,22758,117845054,othdiscr,,,False,18.0,0,942760433,WALK,-0.9851903695198061 +1885520873,2874269,1162627,othdiscr,1,False,1,22758,22766,117845054,home,,,False,30.0,0,942760437,WALK,-0.9851903695198061 +1885520961,2874269,1162627,univ,1,True,1,22766,22758,117845060,univ,,,False,34.0,0,942760481,WALK,-0.9851903695198061 +1885520969,2874269,1162627,univ,1,False,1,22758,22766,117845060,home,,,False,34.0,0,942760485,WALK,-0.9851903695198061 1885521617,2874270,1162627,univ,1,True,1,22809,22758,117845101,univ,,,False,13.0,0,942760809,WALK,2.448568395465578 1885521625,2874270,1162627,univ,1,False,3,22766,22809,117845101,univ,10.064918042210902,22766,False,29.0,0,942760813,WALK,2.5591208432062635 1885521626,2874270,1162627,univ,2,False,3,22760,22766,117845101,eatout,12.726627067763937,,False,29.0,0,942760814,WALK,2.6006338904068236 @@ -150,20 +152,22 @@ trip_id,person_id,household_id,primary_purpose,trip_num,outbound,trip_count,dest 1885522283,2874271,1162627,univ,3,False,3,22758,22767,117845142,home,,,False,26.0,0,942761143,WALK,2.1084560857351926 3099151793,4724316,1944022,univ,1,True,2,22763,22765,193696987,escort,12.812689062193739,,False,26.0,0,1549575897,WALK,2.1351670996963623 3099151794,4724316,1944022,univ,2,True,2,22766,22763,193696987,univ,,,False,27.0,0,1549575898,WALK,-0.8559965323806581 -3099151801,4724316,1944022,univ,1,False,2,22767,22766,193696987,eatout,13.154682962658466,,False,29.0,0,1549575901,WALK,-0.9673991559282129 -3099151802,4724316,1944022,univ,2,False,2,22765,22767,193696987,home,,,False,29.0,0,1549575902,WALK,2.1708672114306493 +3099151801,4724316,1944022,univ,1,False,2,22767,22766,193696987,eatout,13.154682962658466,,False,30.0,0,1549575901,WALK,-0.9673991559282129 +3099151802,4724316,1944022,univ,2,False,2,22765,22767,193696987,home,,,False,30.0,0,1549575902,WALK,2.1708672114306493 3099404353,4724701,1944407,univ,1,True,1,22809,22808,193712772,univ,,,False,12.0,0,1549702177,BIKE,-0.2552725353403566 3099404361,4724701,1944407,univ,1,False,2,22766,22809,193712772,univ,11.3195538505166,22766,False,37.0,0,1549702181,BIKE,-0.7042893633777787 3099404362,4724701,1944407,univ,2,False,2,22808,22766,193712772,home,,,False,37.0,0,1549702182,BIKE,-0.6429800462056683 -3099416945,4724720,1944426,work,1,True,1,22738,22806,193713559,work,,,False,10.0,0,1549708473,WALK,3.424476741640782 -3099416953,4724720,1944426,work,1,False,1,22806,22738,193713559,home,,,False,25.0,0,1549708477,WALK,3.421200065013991 +3099416945,4724720,1944426,work,1,True,1,22738,22806,193713559,work,,,False,11.0,0,1549708473,WALK,3.424390511880516 +3099416953,4724720,1944426,work,1,False,3,22771,22738,193713559,eatout,26.40550446549438,,False,30.0,0,1549708477,WALK,3.7593007059822785 +3099416954,4724720,1944426,work,2,False,3,22747,22771,193713559,escort,28.011943124697314,,False,30.0,0,1549708478,WALK,4.829251171164033 +3099416955,4724720,1944426,work,3,False,3,22806,22747,193713559,home,,,False,31.0,0,1549708479,WALK,4.0642352465261435 3100974161,4727094,1946800,univ,1,True,2,22796,22808,193810885,parking,,,False,20.0,1,1550487081,SHARED2,-0.325497193352596 3100974162,4727094,1946800,univ,2,True,2,22809,22796,193810885,univ,,,True,20.0,1,1550487081,WALK_LOC,2.1755216717496055 3100974169,4727094,1946800,univ,1,False,1,22808,22809,193810885,home,,,True,27.0,1,1550487085,WALK,2.117177438190699 3101586209,4728027,1947733,univ,1,True,1,22764,22806,193849138,univ,,,False,10.0,0,1550793105,WALK,-1.1092692699446687 3101586217,4728027,1947733,univ,1,False,2,22767,22764,193849138,escort,13.485546584318579,,False,27.0,0,1550793109,WALK,-0.5148347167335139 3101586218,4728027,1947733,univ,2,False,2,22806,22767,193849138,home,,,False,28.0,0,1550793110,WALK,1.9818127360573472 -3109893137,4740690,1970879,univ,1,True,1,22764,22745,194368321,univ,,,False,11.0,0,1554946569,WALK,2.576602218700462 -3109893145,4740690,1970879,univ,1,False,3,22768,22764,194368321,social,26.124396751214636,,False,31.0,0,1554946573,WALK,2.8253929561140825 -3109893146,4740690,1970879,univ,2,False,3,22760,22768,194368321,othdiscr,30.225849882595227,,False,32.0,0,1554946574,WALK,4.979971583696819 -3109893147,4740690,1970879,univ,3,False,3,22745,22760,194368321,home,,,False,32.0,0,1554946575,WALK,5.801965338203763 +3109893137,4740690,1970879,univ,1,True,1,22764,22745,194368321,univ,,,False,11.0,0,1554946569,WALK,2.575948213739144 +3109893145,4740690,1970879,univ,1,False,3,22768,22764,194368321,social,26.123792094747852,,False,40.0,0,1554946573,WALK,2.786145000941733 +3109893146,4740690,1970879,univ,2,False,3,22760,22768,194368321,othdiscr,30.225743329735145,,False,40.0,0,1554946574,WALK,4.979971583696819 +3109893147,4740690,1970879,univ,3,False,3,22745,22760,194368321,home,,,False,41.0,0,1554946575,WALK,5.801947256999899 diff --git a/activitysim/examples/prototype_arc/configs/atwork_subtour_destination.yaml b/activitysim/examples/prototype_arc/configs/atwork_subtour_destination.yaml index f01236f564..f6a828b279 100644 --- a/activitysim/examples/prototype_arc/configs/atwork_subtour_destination.yaml +++ b/activitysim/examples/prototype_arc/configs/atwork_subtour_destination.yaml @@ -5,14 +5,6 @@ COEFFICIENTS: atwork_subtour_destination_coeffs.csv SAMPLE_SIZE: 30 -SIMULATE_CHOOSER_COLUMNS: - - person_id - - ptype - - home_zone_id - - tour_type - - tour_mode - - workplace_zone_id - LOGSUM_SETTINGS: tour_mode_choice.yaml # model-specific logsum-related settings diff --git a/activitysim/examples/prototype_arc/configs/joint_tour_destination.yaml b/activitysim/examples/prototype_arc/configs/joint_tour_destination.yaml index d43762c662..3b41b619d8 100644 --- a/activitysim/examples/prototype_arc/configs/joint_tour_destination.yaml +++ b/activitysim/examples/prototype_arc/configs/joint_tour_destination.yaml @@ -19,16 +19,6 @@ SEGMENTS: SAMPLE_SIZE: 30 -SIMULATE_CHOOSER_COLUMNS: - - tour_type - - home_zone_id -# - household_id - - person_id - - income_in_thousands - - num_nondriving_age_children - - is_CBD - - is_urban - LOGSUM_SETTINGS: tour_mode_choice.yaml # model-specific logsum-related settings diff --git a/activitysim/examples/prototype_arc/configs/mandatory_tour_scheduling.yaml b/activitysim/examples/prototype_arc/configs/mandatory_tour_scheduling.yaml index b1a56914f8..56a983037b 100644 --- a/activitysim/examples/prototype_arc/configs/mandatory_tour_scheduling.yaml +++ b/activitysim/examples/prototype_arc/configs/mandatory_tour_scheduling.yaml @@ -1,25 +1,4 @@ -SIMULATE_CHOOSER_COLUMNS: - - age - - is_female - - ptype - - is_income_less25K - - is_income_25K_to_60K - - is_income_60K_to_120K - - is_income_greater120K - - is_pre_drive_child_in_HH - - is_non_worker_in_HH - - auto_ownership - - is_all_adults_full_time_workers - - distance_to_school - - auto_time_home_to_school - - auto_time_home_to_work - - free_parking_at_work - - work_segment - - workplace_zone_id - - school_zone_id - - home_zone_id - LOGSUM_SETTINGS: tour_mode_choice.yaml TOUR_SPEC_SEGMENTS: diff --git a/activitysim/examples/prototype_arc/configs/non_mandatory_tour_destination.yaml b/activitysim/examples/prototype_arc/configs/non_mandatory_tour_destination.yaml index c40e2de7d9..0fe46fb392 100644 --- a/activitysim/examples/prototype_arc/configs/non_mandatory_tour_destination.yaml +++ b/activitysim/examples/prototype_arc/configs/non_mandatory_tour_destination.yaml @@ -24,15 +24,6 @@ SEGMENTS: - social - escort -SIMULATE_CHOOSER_COLUMNS: - - tour_type - - home_zone_id - - person_id - - income_in_thousands - - num_nondriving_age_children - - is_CBD - - is_urban - LOGSUM_SETTINGS: tour_mode_choice.yaml # model-specific logsum-related settings diff --git a/activitysim/examples/prototype_arc/configs/non_mandatory_tour_scheduling.yaml b/activitysim/examples/prototype_arc/configs/non_mandatory_tour_scheduling.yaml index 974b11991c..c4e5fd9985 100644 --- a/activitysim/examples/prototype_arc/configs/non_mandatory_tour_scheduling.yaml +++ b/activitysim/examples/prototype_arc/configs/non_mandatory_tour_scheduling.yaml @@ -19,24 +19,3 @@ preprocessor: - land_use - joint_tour_participants -SIMULATE_CHOOSER_COLUMNS: - - - age - - is_female - - adult - - ptype - - has_pre_school_child_with_mandatory - - has_driving_age_child_with_mandatory - - retired_adults_only_hh - - is_income_less25K - - is_income_25K_to_60K - - is_income_60K_to_120K - - auto_ownership - - num_children - - num_adults - - num_mand_tours - - num_joint_tours - - num_escort_tours - - num_non_escort_tours - - num_add_shop_maint_tours - - num_add_soc_discr_tours diff --git a/activitysim/examples/prototype_arc/configs/school_location.yaml b/activitysim/examples/prototype_arc/configs/school_location.yaml index 639a84904c..a6c59a1998 100644 --- a/activitysim/examples/prototype_arc/configs/school_location.yaml +++ b/activitysim/examples/prototype_arc/configs/school_location.yaml @@ -1,12 +1,5 @@ SAMPLE_SIZE: 30 -SIMULATE_CHOOSER_COLUMNS: - - home_zone_id - - household_id - - is_low_income - - is_very_high_income - - areatype - # model-specific logsum-related settings CHOOSER_ORIG_COL_NAME: home_zone_id ALT_DEST_COL_NAME: alt_dest diff --git a/activitysim/examples/prototype_arc/configs/tour_mode_choice.yaml b/activitysim/examples/prototype_arc/configs/tour_mode_choice.yaml index 3fa08a9296..7f1b1b627d 100644 --- a/activitysim/examples/prototype_arc/configs/tour_mode_choice.yaml +++ b/activitysim/examples/prototype_arc/configs/tour_mode_choice.yaml @@ -89,50 +89,3 @@ nontour_preprocessor: TABLES: - land_use -LOGSUM_CHOOSER_COLUMNS: - - tour_type - - household_id - - home_zone_id - - is_predrive - - is_driving_age - - is_male - - is_female - - is_age1617 - - is_age1622 - - is_ageless40 - - is_age4059 - - is_age6079 - - is_age60plus - - is_adult - - is_worker - - is_nonworker_adult - - is_k12 - - is_university - - is_hhsize1 - - is_hh_with_child_less16 - - is_hh_with_child_16plus - - is_income_less10K - - is_income_10K_20K - - is_income_20K_40K - - is_income_less50K - - is_no_income - - is_low_income - - is_medium_income - - is_high_income - - is_very_high_income - - is_CBD - - is_urban - - is_rural_or_exurban - - num_workers - - num_full - - num_part - - num_students - - number_of_participants - - tour_category - - free_parking_at_work - - auto_ownership - # FROM ZoneData Table - - PARKRATE - - I_PCTLT10K - - I_PCT10TO20 - - I_PCT20TO40 diff --git a/activitysim/examples/prototype_arc/configs/tour_scheduling_atwork.yaml b/activitysim/examples/prototype_arc/configs/tour_scheduling_atwork.yaml index f04f93b8e5..40eff6b4e5 100644 --- a/activitysim/examples/prototype_arc/configs/tour_scheduling_atwork.yaml +++ b/activitysim/examples/prototype_arc/configs/tour_scheduling_atwork.yaml @@ -9,8 +9,5 @@ preprocessor: # - land_use # - tours -SIMULATE_CHOOSER_COLUMNS: - - od_distance - CONSTANTS: time_cap: 30 \ No newline at end of file diff --git a/activitysim/examples/prototype_arc/configs/workplace_location.yaml b/activitysim/examples/prototype_arc/configs/workplace_location.yaml index 5fa2cff323..0652ec0b2f 100644 --- a/activitysim/examples/prototype_arc/configs/workplace_location.yaml +++ b/activitysim/examples/prototype_arc/configs/workplace_location.yaml @@ -1,15 +1,5 @@ SAMPLE_SIZE: 30 -SIMULATE_CHOOSER_COLUMNS: - - home_zone_id - - household_id - - is_low_income - - is_very_high_income - - is_fulltime_worker - - areatype - - auto_ownership - - num_workers - SAMPLE_SPEC: workplace_location_sample.csv SPEC: workplace_location.csv COEFFICIENTS: workplace_location_coeffs.csv diff --git a/activitysim/examples/prototype_mtc/configs/atwork_subtour_destination.yaml b/activitysim/examples/prototype_mtc/configs/atwork_subtour_destination.yaml index 3dcb67d9d6..bcbed3d8a9 100644 --- a/activitysim/examples/prototype_mtc/configs/atwork_subtour_destination.yaml +++ b/activitysim/examples/prototype_mtc/configs/atwork_subtour_destination.yaml @@ -12,11 +12,6 @@ SEGMENTS: ORIG_ZONE_ID: workplace_zone_id -SIMULATE_CHOOSER_COLUMNS: - - person_id - - income_segment - - workplace_zone_id - LOGSUM_SETTINGS: tour_mode_choice.yaml # model-specific logsum-related settings diff --git a/activitysim/examples/prototype_mtc/configs/mandatory_tour_scheduling.yaml b/activitysim/examples/prototype_mtc/configs/mandatory_tour_scheduling.yaml index c216898e42..7ef8767373 100644 --- a/activitysim/examples/prototype_mtc/configs/mandatory_tour_scheduling.yaml +++ b/activitysim/examples/prototype_mtc/configs/mandatory_tour_scheduling.yaml @@ -1,22 +1,4 @@ -SIMULATE_CHOOSER_COLUMNS: - - ptype - - hhsize - - roundtrip_auto_time_to_work - - num_workers - - income_in_thousands - - work_and_school_and_worker - - work_and_school_and_student - - workplace_in_cbd - - home_is_rural - - mandatory_tour_frequency - - is_worker - - is_student - - is_university - - workplace_zone_id - - school_zone_id - - home_zone_id - LOGSUM_SETTINGS: tour_mode_choice.yaml # school and univ have the same spec file and coefficients but are handled seperately diff --git a/activitysim/examples/prototype_mtc/configs/non_mandatory_tour_destination.yaml b/activitysim/examples/prototype_mtc/configs/non_mandatory_tour_destination.yaml index d1d19d4848..ecef95ed52 100644 --- a/activitysim/examples/prototype_mtc/configs/non_mandatory_tour_destination.yaml +++ b/activitysim/examples/prototype_mtc/configs/non_mandatory_tour_destination.yaml @@ -24,11 +24,6 @@ SEGMENTS: - social - escort -SIMULATE_CHOOSER_COLUMNS: - - tour_type - - home_zone_id - - person_id - LOGSUM_SETTINGS: tour_mode_choice.yaml # model-specific logsum-related settings diff --git a/activitysim/examples/prototype_mtc/configs/non_mandatory_tour_scheduling.yaml b/activitysim/examples/prototype_mtc/configs/non_mandatory_tour_scheduling.yaml index 82ce8056c7..8b0c54f5bc 100644 --- a/activitysim/examples/prototype_mtc/configs/non_mandatory_tour_scheduling.yaml +++ b/activitysim/examples/prototype_mtc/configs/non_mandatory_tour_scheduling.yaml @@ -11,11 +11,3 @@ preprocessor: - land_use - joint_tour_participants -SIMULATE_CHOOSER_COLUMNS: - - ptype - - num_children - - roundtrip_auto_time_to_work - - num_mand - - num_escort_tours - - num_non_escort_tours - - adult diff --git a/activitysim/examples/prototype_mtc/configs/school_location.yaml b/activitysim/examples/prototype_mtc/configs/school_location.yaml index b0a3d45f72..ed226c48a0 100644 --- a/activitysim/examples/prototype_mtc/configs/school_location.yaml +++ b/activitysim/examples/prototype_mtc/configs/school_location.yaml @@ -1,10 +1,5 @@ SAMPLE_SIZE: 30 -SIMULATE_CHOOSER_COLUMNS: - - home_zone_id - - school_segment - - household_id - # model-specific logsum-related settings CHOOSER_ORIG_COL_NAME: home_zone_id ALT_DEST_COL_NAME: alt_dest diff --git a/activitysim/examples/prototype_mtc/configs/tour_mode_choice.yaml b/activitysim/examples/prototype_mtc/configs/tour_mode_choice.yaml index eb9d7e7c4a..87764eafda 100644 --- a/activitysim/examples/prototype_mtc/configs/tour_mode_choice.yaml +++ b/activitysim/examples/prototype_mtc/configs/tour_mode_choice.yaml @@ -172,20 +172,5 @@ nontour_preprocessor: TABLES: - land_use -# to reduce memory needs filter chooser table to these fields -LOGSUM_CHOOSER_COLUMNS: - - tour_type - - hhsize - - density_index - - age - - age_16_p - - age_16_to_19 - - auto_ownership - - number_of_participants - - tour_category - - num_workers - - value_of_time - - free_parking_at_work - MODE_CHOICE_LOGSUM_COLUMN_NAME: mode_choice_logsum diff --git a/activitysim/examples/prototype_mtc/configs/workplace_location.yaml b/activitysim/examples/prototype_mtc/configs/workplace_location.yaml index 364196111d..ed9e4e94a5 100644 --- a/activitysim/examples/prototype_mtc/configs/workplace_location.yaml +++ b/activitysim/examples/prototype_mtc/configs/workplace_location.yaml @@ -1,9 +1,5 @@ SAMPLE_SIZE: 30 -SIMULATE_CHOOSER_COLUMNS: - - income_segment - - home_zone_id - SAMPLE_SPEC: workplace_location_sample.csv SPEC: workplace_location.csv COEFFICIENTS: workplace_location_coefficients.csv diff --git a/activitysim/examples/prototype_mtc_extended/configs/non_mandatory_tour_destination.yaml b/activitysim/examples/prototype_mtc_extended/configs/non_mandatory_tour_destination.yaml index 48d8ca8d96..1233120221 100644 --- a/activitysim/examples/prototype_mtc_extended/configs/non_mandatory_tour_destination.yaml +++ b/activitysim/examples/prototype_mtc_extended/configs/non_mandatory_tour_destination.yaml @@ -24,11 +24,6 @@ SEGMENTS: - social - escort -SIMULATE_CHOOSER_COLUMNS: - - tour_type - - home_zone_id - - person_id - LOGSUM_SETTINGS: tour_mode_choice.yaml annotate_tours: diff --git a/activitysim/examples/prototype_mtc_extended/configs/non_mandatory_tour_scheduling.yaml b/activitysim/examples/prototype_mtc_extended/configs/non_mandatory_tour_scheduling.yaml index 488ba6b827..3e6f0e77fe 100644 --- a/activitysim/examples/prototype_mtc_extended/configs/non_mandatory_tour_scheduling.yaml +++ b/activitysim/examples/prototype_mtc_extended/configs/non_mandatory_tour_scheduling.yaml @@ -12,11 +12,3 @@ preprocessor: - joint_tour_participants - school_escort_tours -SIMULATE_CHOOSER_COLUMNS: - - ptype - - num_children - - roundtrip_auto_time_to_work - - num_mand - - num_escort_tours - - num_non_escort_tours - - adult diff --git a/activitysim/examples/prototype_mtc_extended/configs/school_escorting.yaml b/activitysim/examples/prototype_mtc_extended/configs/school_escorting.yaml index 9ecc711f99..62677ae825 100644 --- a/activitysim/examples/prototype_mtc_extended/configs/school_escorting.yaml +++ b/activitysim/examples/prototype_mtc_extended/configs/school_escorting.yaml @@ -41,12 +41,6 @@ preprocessor_outbound_cond: - persons - tours -SIMULATE_CHOOSER_COLUMNS: - - home_zone_id - - income - - auto_ownership - - num_workers - CONSTANTS: max_bin_difference_between_departure_times: 1 mins_per_time_bin: 60 diff --git a/activitysim/examples/prototype_mtc_extended/configs/tour_mode_choice.yaml b/activitysim/examples/prototype_mtc_extended/configs/tour_mode_choice.yaml index 6550c28e5e..9c9d9bbd48 100644 --- a/activitysim/examples/prototype_mtc_extended/configs/tour_mode_choice.yaml +++ b/activitysim/examples/prototype_mtc_extended/configs/tour_mode_choice.yaml @@ -179,21 +179,6 @@ annotate_tours: TABLES: - tours -# to reduce memory needs filter chooser table to these fields -LOGSUM_CHOOSER_COLUMNS: - - tour_type - - hhsize - - density_index - - age - - age_16_p - - age_16_to_19 - - auto_ownership - - number_of_participants - - tour_category - - num_workers - - value_of_time - - free_parking_at_work - MODE_CHOICE_LOGSUM_COLUMN_NAME: mode_choice_logsum diff --git a/activitysim/examples/prototype_mwcog/configs/atwork_subtour_destination.yaml b/activitysim/examples/prototype_mwcog/configs/atwork_subtour_destination.yaml index c60ae4377d..8e18b34a5b 100644 --- a/activitysim/examples/prototype_mwcog/configs/atwork_subtour_destination.yaml +++ b/activitysim/examples/prototype_mwcog/configs/atwork_subtour_destination.yaml @@ -6,13 +6,6 @@ COEFFICIENTS: atwork_subtour_destination_coeffs.csv SAMPLE_SIZE: 30 -SIMULATE_CHOOSER_COLUMNS: - - person_id - - income_segment - - workplace_zone_id - - female - - auto_ownership - LOGSUM_SETTINGS: tour_mode_choice.yaml # model-specific logsum-related settings diff --git a/activitysim/examples/prototype_mwcog/configs/joint_tour_destination.yaml b/activitysim/examples/prototype_mwcog/configs/joint_tour_destination.yaml index 5fe0c0636a..5e7620503d 100644 --- a/activitysim/examples/prototype_mwcog/configs/joint_tour_destination.yaml +++ b/activitysim/examples/prototype_mwcog/configs/joint_tour_destination.yaml @@ -16,15 +16,6 @@ SAMPLE_SIZE: 30 # we can't use use household income_segment as this will also be set for non-workers CHOOSER_SEGMENT_COLUMN_NAME: tour_type -SIMULATE_CHOOSER_COLUMNS: - - tour_type - - TAZ - - person_id - - income_segment - - num_children - - hh_child - - auto_ownership - LOGSUM_SETTINGS: tour_mode_choice.yaml # model-specific logsum-related settings diff --git a/activitysim/examples/prototype_mwcog/configs/mandatory_tour_scheduling.yaml b/activitysim/examples/prototype_mwcog/configs/mandatory_tour_scheduling.yaml index ceda1517dc..79dbb8506d 100644 --- a/activitysim/examples/prototype_mwcog/configs/mandatory_tour_scheduling.yaml +++ b/activitysim/examples/prototype_mwcog/configs/mandatory_tour_scheduling.yaml @@ -1,26 +1,4 @@ -SIMULATE_CHOOSER_COLUMNS: - - age - - female - - ptype - - is_university - - is_income_less25K - - is_income_25K_to_60K - - is_income_60K_to_120K - - is_income_greater120K - - is_pre_drive_child_in_HH - - is_non_worker_in_HH - - auto_ownership - - is_all_adults_full_time_workers - - distance_to_school - - roundtrip_auto_time_to_work - - roundtrip_auto_time_to_school - - free_parking_at_work - - workplace_zone_id - - school_zone_id - - home_zone_id - - TAZ - LOGSUM_SETTINGS: tour_mode_choice.yaml TOUR_SPEC_SEGMENTS: diff --git a/activitysim/examples/prototype_mwcog/configs/non_mandatory_tour_destination.yaml b/activitysim/examples/prototype_mwcog/configs/non_mandatory_tour_destination.yaml index 4c5f7ef911..8e3334be73 100644 --- a/activitysim/examples/prototype_mwcog/configs/non_mandatory_tour_destination.yaml +++ b/activitysim/examples/prototype_mwcog/configs/non_mandatory_tour_destination.yaml @@ -24,21 +24,6 @@ SEGMENTS: - social - escort -SIMULATE_CHOOSER_COLUMNS: - - tour_type - - TAZ - - person_id - - income_segment - - pemploy - - is_student - - age_0_to_5 - - age_6_to_12 - - hh_child - - young - - old - - female - - auto_ownership - LOGSUM_SETTINGS: tour_mode_choice.yaml # model-specific logsum-related settings diff --git a/activitysim/examples/prototype_mwcog/configs/non_mandatory_tour_scheduling.yaml b/activitysim/examples/prototype_mwcog/configs/non_mandatory_tour_scheduling.yaml index 0411943461..8528e478cf 100644 --- a/activitysim/examples/prototype_mwcog/configs/non_mandatory_tour_scheduling.yaml +++ b/activitysim/examples/prototype_mwcog/configs/non_mandatory_tour_scheduling.yaml @@ -13,28 +13,6 @@ preprocessor: - land_use - joint_tour_participants -SIMULATE_CHOOSER_COLUMNS: - - - age - - female - - adult - - ptype - - has_pre_school_child_with_mandatory - - has_driving_age_child_with_mandatory - - retired_adults_only_hh - - is_income_less25K - - is_income_25K_to_60K - - is_income_60K_to_120K - - auto_ownership - - num_children - - num_adults - - num_mand - - num_joint_tours - - num_escort_tours - - num_non_escort_tours - - num_add_shop_maint_tours - - num_add_soc_discr_tours - #LOGSUM_SETTINGS: tour_mode_choice.yaml # map : : diff --git a/activitysim/examples/prototype_mwcog/configs/school_location.yaml b/activitysim/examples/prototype_mwcog/configs/school_location.yaml index 4a75198e0a..1598754555 100644 --- a/activitysim/examples/prototype_mwcog/configs/school_location.yaml +++ b/activitysim/examples/prototype_mwcog/configs/school_location.yaml @@ -1,16 +1,5 @@ SAMPLE_SIZE: 30 -SIMULATE_CHOOSER_COLUMNS: - - home_zone_id - - school_segment - - household_id - - is_student - - age_0_to_5 - - age_6_to_12 - - pemploy - - income_segment - - auto_ownership - # model-specific logsum-related settings CHOOSER_ORIG_COL_NAME: home_zone_id ALT_DEST_COL_NAME: alt_dest diff --git a/activitysim/examples/prototype_mwcog/configs/tour_mode_choice.yaml b/activitysim/examples/prototype_mwcog/configs/tour_mode_choice.yaml index ace2fa2875..72be7ffbef 100644 --- a/activitysim/examples/prototype_mwcog/configs/tour_mode_choice.yaml +++ b/activitysim/examples/prototype_mwcog/configs/tour_mode_choice.yaml @@ -96,19 +96,4 @@ nontour_preprocessor: TABLES: - land_use -# to reduce memory needs filter chooser table to these fields -LOGSUM_CHOOSER_COLUMNS: - - tour_type - - hhsize - - density_index - - age - - age_16_p - - age_16_to_19 - - auto_ownership - - number_of_participants - - tour_category - - num_workers - - value_of_time - - free_parking_at_work - MODE_CHOICE_LOGSUM_COLUMN_NAME: mode_choice_logsum diff --git a/activitysim/examples/prototype_mwcog/configs/tour_scheduling_atwork.yaml b/activitysim/examples/prototype_mwcog/configs/tour_scheduling_atwork.yaml index f04f93b8e5..40eff6b4e5 100644 --- a/activitysim/examples/prototype_mwcog/configs/tour_scheduling_atwork.yaml +++ b/activitysim/examples/prototype_mwcog/configs/tour_scheduling_atwork.yaml @@ -9,8 +9,5 @@ preprocessor: # - land_use # - tours -SIMULATE_CHOOSER_COLUMNS: - - od_distance - CONSTANTS: time_cap: 30 \ No newline at end of file diff --git a/activitysim/examples/prototype_mwcog/configs/workplace_location.yaml b/activitysim/examples/prototype_mwcog/configs/workplace_location.yaml index dba0fa9e96..0c46ba5d12 100644 --- a/activitysim/examples/prototype_mwcog/configs/workplace_location.yaml +++ b/activitysim/examples/prototype_mwcog/configs/workplace_location.yaml @@ -1,15 +1,5 @@ SAMPLE_SIZE: 30 -SIMULATE_CHOOSER_COLUMNS: - - income_segment - - home_zone_id - - is_student - - pemploy - - young - - old - - female - - auto_ownership - SAMPLE_SPEC: workplace_location_sample.csv SPEC: workplace_location.csv COEFFICIENTS: workplace_location_coeffs.csv diff --git a/docs/dev-guide/changes.md b/docs/dev-guide/changes.md index 345666dd2c..cf4155ca33 100644 --- a/docs/dev-guide/changes.md +++ b/docs/dev-guide/changes.md @@ -14,6 +14,30 @@ branch (i.e., the main branch on GitHub), but not yet released in a stable versi of ActivitySim. See below under the various version headings for changes in released versions. +### Deprecated `SIMULATE_CHOOSER_COLUMNS` and `LOGSUM_CHOOSER_COLUMNS` + +The `SIMULATE_CHOOSER_COLUMNS` and `LOGSUM_CHOOSER_COLUMNS` settings were added +as memory hacks, to reduce the size of the interaction dataframe for components +that combine a chooser table with an alternatives table. These settings have +been superseded by `drop_unused_columns`, which automatically drops the columns +that are not needed based on the model spec, and which is enabled by default in +the `compute_settings` for every component. As such, these settings are now +unnecessary, and they are a common source of hard-to-diagnose errors when a +column used by a spec is inadvertently omitted from the list. + +These settings are now deprecated. If either setting appears in a model +configuration file, a `DeprecationWarning` is issued and the value is ignored. +Users should remove these settings from their configuration files. Nothing else +needs to be done to take advantage of this change; unused columns continue to be +dropped automatically. + +Relatedly, `interaction_sample` (used for destination sampling) previously +skipped dropping unused columns entirely when a run had trace targets, which +could result in very large interaction dataframes for traced runs. Unused +columns are now dropped in that case as well, retaining only the columns needed +to identify the traced rows. The complete chooser and alternatives tables are +still written to the trace output before the columns are dropped. + ### Changed Default for Sharrow "Fastmath" Optimization The default setting for the "fastmath" optimization in sharrow has been changed