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

Avoid Inf Loop in Joint Tour Participation #62

Open
wants to merge 4 commits into
base: BayDAG
Choose a base branch
from
Open
Changes from 3 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
7 changes: 7 additions & 0 deletions activitysim/abm/models/joint_tour_participation.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,13 @@ def participants_chooser(probs, choosers, spec, trace_label):
probs[choice_col] = np.where(probs[choice_col] > 0, 1, 0)
non_choice_col = [col for col in probs.columns if col != choice_col][0]
probs[non_choice_col] = 1 - probs[choice_col]
if iter > MAX_ITERATIONS + 1:
raise RuntimeError(
f"{num_tours_remaining} tours could not be satisfied even with forcing participation."
" This is likely due to some inconsistency between the tour frequency & composition model"
" and the joint tour participation model, e.g. overlapping time windows with mandatory tours."
" It could also be inconsistencies in the data if run in estimation mode."
)
else:
raise RuntimeError(
f"{num_tours_remaining} tours could not be satisfied after {iter} iterations"
Expand Down