Skip to content

Remove SIMULATE_CHOOSER_COLUMNS memory hacks and expose global constants in utility expressions#1075

Closed
asiripanich wants to merge 1 commit intoActivitySim:mainfrom
asiripanich:globals-and-chooser-cols
Closed

Remove SIMULATE_CHOOSER_COLUMNS memory hacks and expose global constants in utility expressions#1075
asiripanich wants to merge 1 commit intoActivitySim:mainfrom
asiripanich:globals-and-chooser-cols

Conversation

@asiripanich
Copy link
Copy Markdown
Contributor

Summary

  • Remove manual chooser-column filtering (SIMULATE_CHOOSER_COLUMNS / LOGSUM_CHOOSER_COLUMNS memory hacks): all FIXME - MEMORY HACK blocks and household_id patch-ups are deleted from location_choice.py, tour_destination.py, tour_od.py, tour_scheduling.py, and school_escorting.py. Memory pruning is now handled automatically by ComputeSettings.drop_unused_columns (default True) inside interaction_sample / interaction_sample_simulate.
  • Deprecate SIMULATE_CHOOSER_COLUMNS and LOGSUM_CHOOSER_COLUMNS in all settings classes (TourLocationComponentSettings, TourModeComponentSettings, SchoolEscortSettings, TourSchedulingSettings) — existing YAML configs emit a DeprecationWarning instead of failing.
  • Expose global constants in utility expressions: state.get_global_constants() is now injected into locals_d at every utility-evaluation site (_location_sample, run_location_simulate, _destination_sample, run_destination_simulate, _od_sample, run_od_simulate, _schedule_tours) so global constants are available in @-prefixed CSV spec expressions.

Closes #1017

Test plan

  • uv run pytest activitysim/core/test activitysim/abm/test activitysim/abm/models/util/test — 103 passed, 0 failed
  • uv run black --check . — no formatting issues
  • uv run ruff check . — no new errors in changed files
  • Verify grep -rn "filter_chooser_columns" activitysim/ returns zero results
  • Verify grep -rn "Drop this when PR #1017" activitysim/ returns zero results

🤖 Generated with Claude Code

Manual chooser-column filtering (SIMULATE/LOGSUM_CHOOSER_COLUMNS) was a
memory workaround that is now redundant: drop_unused_columns in
ComputeSettings (default True) prunes DataFrame columns automatically
one layer beneath each model function.  Remove all the FIXME blocks and
the household_id patch-ups they contained.

Deprecate SIMULATE_CHOOSER_COLUMNS and LOGSUM_CHOOSER_COLUMNS in all
settings classes so existing YAML configs emit DeprecationWarning instead
of failing.

Also wire state.get_global_constants() into locals_d at every utility-
evaluation site (_location_sample, run_location_simulate, _destination_sample,
run_destination_simulate, _od_sample, run_od_simulate, _schedule_tours)
so global constants are available in @ expressions in CSV specs.

Closes ActivitySim#1017

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@asiripanich
Copy link
Copy Markdown
Contributor Author

Whoops! wrong git remote! apologies :)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant