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

fix for lottery choice bug for empty alts table #75

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions choicemodels/tools/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,9 @@ def iterative_lottery_choices(
if max_iter is not None:
if (iter > max_iter):
break
if alts[capacity].max() < choosers[size].min():
if (alts[capacity].max() < choosers[size].min()) or (len(alts) == 0):
print("{} choosers cannot be allocated.".format(len(choosers)))
print("\nRemaining capacity on alternatives but not enough to accodomodate choosers' sizes")
print("\nRemaining capacity on alternatives but not enough to accommodate choosers' sizes")
break
if chooser_batch_size is None or chooser_batch_size > len(choosers):
mct = mct_callable(
Expand Down