Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some zones sometimes reopen while using shadow pricing simulation #820

Open
jpn-- opened this issue Feb 26, 2024 · 3 comments
Open

Some zones sometimes reopen while using shadow pricing simulation #820

jpn-- opened this issue Feb 26, 2024 · 3 comments
Assignees
Labels
Bug Something isn't working/bug f

Comments

@jpn--
Copy link
Member

jpn-- commented Feb 26, 2024

Describe the bug
In investigating #815, I discovered that the shadow pricing simulation algorithm sometimes re-opens zones that were previously closed.

image

To Reproduce
Steps to reproduce the behavior:

  • Use main branch @ff3e96b.
  • Run full size prototype mtc extended model with 100% household.
  • Trace hh id 1098914
  • Compare shadow_price_utility_adjustment column from trace/school_location/i*/sample/interaction_sample/alternatives-*.csv

Expected behavior
Once the shadow price simulation algorithm closes a zone, it should stay closed. Re-opening a closed zone probably doesn't completely void the results here -- in all cases I observe, it then gets closed again on the next iteration, but it probably prolongs convergence as workers or students will certainly just re-oversubscribe that zone again.

@jpn-- jpn-- added the Bug Something isn't working/bug f label Feb 26, 2024
@dhensle
Copy link
Contributor

dhensle commented Feb 29, 2024

The simulation-based constraint algorithm selects people to re-simulate based on the probability of sprice = 1 - (desired_share / modeled_share), but the "shadow price" of the zone set to -999 is calculated as np.where((sprice <= 1 + percent_tolerance / 100), -999, 0). (See it in the code here.)

Notice how the percent tolerance shows up in turning the zone on-and-off, but not in the selection of people to re-simulate. I think this is the source of the discrepancy.... In other words, I can have a 5% tolerance, with a zone that has 100 enrollment. If 103 students select that zone, the sprice is > 1 and I can choose people from the zone to re-simulate, but it is within the percent tolerance and the shadow price is -999. If the 3% probability selection just so happens to choose more than 3 people to resimulate, then the zone will open back up in the next iteration.

If my logic is correct here, I see a couple ways forward:

  1. Just leave it as is. I don't think this is necessarily a "bug" but rather a side effect of having a tolerance.
  2. Update the sampling logic to say that if people are within the tolerance for the zone, they will just remain there.

cc: @aletzdy, @jfdman

@bettinardi
Copy link

bettinardi commented Feb 29, 2024

I like option 2

@joecastiglione
Copy link
Contributor

joecastiglione commented Feb 29, 2024 via email

@dhensle dhensle self-assigned this Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working/bug f
Projects
Status: Todo
Development

No branches or pull requests

4 participants