ActivitySim / activitysim

An Open Platform for Activity-Based Travel Modeling
https://activitysim.github.io
BSD 3-Clause "New" or "Revised" License
194 stars 99 forks source link

Joint Tour Chunking - Household Participants Need to Remain in Same Chunk #288

Closed danielsclint closed 4 years ago

danielsclint commented 4 years ago

In the joint tour participation model, its possible for the chunker to split potential joint tour participants from the same household across two different chunks. This will create an endless loop and eventual assertion error in the joint tour participation model.

https://github.com/ActivitySim/activitysim/blob/7b57c94e12d27a23f86c8988117e885ae754c44e/activitysim/core/chunk.py#L217-L229

If a household is split, so only one person is chosen in the chunk, the following code will never evaluate to true, because x.participants > 1 will always evaluate to False. Or... x.participants > x.adults will always evaluate to False.

https://github.com/ActivitySim/activitysim/blob/7b57c94e12d27a23f86c8988117e885ae754c44e/activitysim/abm/models/joint_tour_participation.py#L86-L87

Eventually, the mode will crash in the following set of code after the maximum number of iterations for finding participants occurs.

https://github.com/ActivitySim/activitysim/blob/7b57c94e12d27a23f86c8988117e885ae754c44e/activitysim/abm/models/joint_tour_participation.py#L158-L165

toliwaga commented 4 years ago

fixed this in develop by adding chunking by chunk_id, and updated tests to catch such errors in the future by forcing singleton full model run test to use minimal chunk size.

This is provisional code as the multiple_zone branch has more extensive changes to chunking (adaptive chunking).

bstabler commented 4 years ago

@danielsclint to now test

danielsclint commented 4 years ago

I see the new method in chunk to chunk by chunk id, but I don't see any changes to the joint tour participation code in develop. As this be merged with the main repo or in some other working version of develop?

toliwaga commented 4 years ago

Oops! Sorry! It helps to push - which I just did.