Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion activitysim/abm/tables/shadow_pricing.py
Original file line number Diff line number Diff line change
Expand Up @@ -860,10 +860,20 @@ def update_shadow_prices(self, state):
sprice.replace([np.inf, -np.inf], 0, inplace=True)

# shadow prices are set to -999 if overassigned or 0 if the zone still has room for this segment
self.shadow_prices[segment] = np.where(
old_shadow_prices = self.shadow_prices[segment].values
new_shadow_prices = np.where(
(sprice <= 1 + percent_tolerance / 100), -999, 0
)

# the conditions above allow for zones to be reopened, but we want to prevent such behavior
new_shadow_prices = np.where(
(old_shadow_prices == -999) & (new_shadow_prices != -999),
old_shadow_prices,
new_shadow_prices,
)

self.shadow_prices[segment] = new_shadow_prices

zonal_sample_rate = 1 - sprice
overpredicted_zones = self.shadow_prices[
self.shadow_prices[segment] == -999
Expand Down
Loading
Loading