Skip to content

Commit

Permalink
fixed boundary case in supply and demand
Browse files Browse the repository at this point in the history
We protect against the boundary case of having no choosers in the predict method, but this gets circumvented and is still a problem with the supply and demand code.

I was hoping to protect against this outside of urbansim, but we dont't know how many choosers there are until the predict_filters gets run, and that happens in urbansim.
  • Loading branch information
fscottfoti committed Apr 11, 2017
1 parent 5736667 commit 38f2635
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions urbansim/models/dcm.py
Original file line number Diff line number Diff line change
Expand Up @@ -1135,6 +1135,9 @@ def summed_probabilities(self, choosers, alternatives):
Summed probabilities from each segment added together.
"""
if len(alternatives) == 0 or len(choosers) == 0:
return pd.Series()

logger.debug(
'start: calculate summed probabilities in LCM group {}'.format(
self.name))
Expand Down

0 comments on commit 38f2635

Please sign in to comment.