Remove SIMULATE_CHOOSER_COLUMNS memory hacks and expose global constants#5
Open
asiripanich wants to merge 3 commits into
Open
Remove SIMULATE_CHOOSER_COLUMNS memory hacks and expose global constants#5asiripanich wants to merge 3 commits into
asiripanich wants to merge 3 commits into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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