From 5518ca4584050995d7e59b8eed27bef8a8877f3f Mon Sep 17 00:00:00 2001 From: David Hensle Date: Fri, 15 Dec 2023 16:41:59 -0800 Subject: [PATCH] error out of infinite loop --- activitysim/abm/models/joint_tour_participation.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/activitysim/abm/models/joint_tour_participation.py b/activitysim/abm/models/joint_tour_participation.py index 4c6691ec1..ac8afdce0 100644 --- a/activitysim/abm/models/joint_tour_participation.py +++ b/activitysim/abm/models/joint_tour_participation.py @@ -214,6 +214,10 @@ def participants_chooser( 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" + ) else: raise RuntimeError( f"{num_tours_remaining} tours could not be satisfied after {iter} iterations"