activitysim
activitysim copied to clipboard
Shadow pricing not working as it used to for the `ctramp` and `daysim` method
Describe the bug
In ActivitySim, work and school location choices are doubly constrained. Shadow prices are constants applied to destination zones to constrain the model, so that work and school location choice models do not assign more workers or students to any zone than the available opportunities in that zone.
A bit of background first. You can skip to the Issue section below if you prefer
Prior to v1.2, ActivitySim's shadow prices could be calculated using either the ctramp or daysim method. Work and school location choice models are typically applied by segments, e.g., income segments for work, school grade segments for school. Instead of employments, destination choice size terms are calculated as targets by segment by zone. Shadow prices are then derived using these size terms along with the modeled workers (students) by segment by zone. When running shadow pricing, the size terms are also scaled to the sample population, ensuring that the destination choice results from a sample population run closely resemble those from a full population run. This is particularly useful when performing tasks such as calibration or global iterations with a sample population.
In Phase 7, a new shadow pricing method, simulation was added to ActivitySim. Instead of comparing the modeled workers to the size terms by segment by zone, the simulation method compares the modeled workers directly to the total employment by zone to ensure the final workers match total jobs. The simulation method saves run time compared to the other two methods because it only re-simulates workers and zones that are over assigned in the previous iteration.
As of release v1.3.4, users can choose their desired shadow pricing method among daysim, ctramp, and simulation. If a model was implemented using the ctramp method, a non-trivial effort would be required to switch to the simulation method, and vice-versa. Currently, there are still regions using the ctramp method. Therefore, it makes sense for ActivitySim to continue supporting the ctramp method.
Issue
However, in PR #635, shadow pricing is changed to be disabled when running a sample population under the ctramp and daysim method. This change has caused issues in some regions' ActivitySim implementation when not running the full population. Model results do not make sense (because no shadow pricing is applied) unless running the full population.
I don't recall whether this change was discussed, apologies if I missed it. If it was, could someone please document the rationale? If the change was made for compatibility with disaggregate accessibility, perhaps we should address that directly than disabling shadow pricing, since not all regions use disagg accessibility. Otherwise, it might make sense to re-enable shadow pricing for sample population and scale the size terms accordingly.
To Reproduce Steps to reproduce the behavior:
- Go to '...'
- Click on '....'
- Scroll down to '....'
- See error
Expected behavior
Shadow pricing performs as it used to for ctramp and daysim methods, to ensure backward compatibility.
Screenshots If applicable, add screenshots to help explain your problem.
Additional context Add any other context about the problem here.