Skip to content

Remove SIMULATE_CHOOSER_COLUMNS memory hacks and expose global constants#5

Open
asiripanich wants to merge 3 commits into
mainfrom
globals-and-chooser-cols
Open

Remove SIMULATE_CHOOSER_COLUMNS memory hacks and expose global constants#5
asiripanich wants to merge 3 commits into
mainfrom
globals-and-chooser-cols

Conversation

@asiripanich
Copy link
Copy Markdown
Owner

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

asiripanich and others added 3 commits May 11, 2026 10:02
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>
When SIMULATE_CHOOSER_COLUMNS was removed, the tours/persons_merged merge
in run_destination_sample, run_destination_simulate, run_destination_logsums,
run_location_logsums, and run_od_logsums could produce _x/_y suffixed
duplicates for shared columns (e.g. household_id). drop_unused_columns then
couldn't match these against spec variable names, causing wrong/missing
column values and divergent results in integration tests.

Fix: before each merge/join, drop from the right-side DataFrame any columns
that already exist in the left-side DataFrame, giving the left side priority
(which matches the original behaviour of tours/sample column taking precedence
over persons_merged values).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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