RSGInc/SOABM

KnR TAZ coding error

Closed this issue · 2 comments

We are trying to deploy the SOABM code in another region and it's failing as it is processing KnR trips. As best as I can tell there are two issues.

  1. It looks like the code assumes a TAZ position number but is given a TAZ name (non-sequential):
    This line gets a non-sequential taz name:
    https://github.com/RSGInc/SOABM/blob/master/template/scripts/Master_Runner.py#L1431

This line seems to be using that taz name as a sequential vector position:
https://github.com/RSGInc/SOABM/blob/master/template/scripts/Master_Runner.py#L1433

The second issue is that the destination is pulling an MAZ sequential number, but feeding it into a taz look up:
https://github.com/RSGInc/SOABM/blob/master/template/scripts/Master_Runner.py#L1432
https://github.com/RSGInc/SOABM/blob/master/template/scripts/Master_Runner.py#L1434

@binnympaul - I'm hoping you can help me confirm that this is an error (not sure if this is your code or not, but I believe you are best positioned to help me figure out what I am looking at.

My guess is that the pnr and knr pieces have always been incorrect (including in the SOABM implementation. It's just that it's such a small share of the trips that we never saw this until now - when we tried to migrate this to a new area and we no longer were accidentally making it through without an error. Can you help me confirm my thought.

No this is not my code. I however updated the walk-transit part at one point to model the transit-everywhere scenario.

I looked at the code more closely and I can confirm that there is a bug in the pnr and knr portions. The bug however seems slightly different than what you described. An error message can help confirm that. Here is my understanding:

  1. Line (https://github.com/RSGInc/SOABM/blob/master/template/scripts/Master_Runner.py#L1431) gets the TAZ name as you mentioned in your comment. This needs to be converted to 0-index TAZ ID
  2. Line (https://github.com/RSGInc/SOABM/blob/master/template/scripts/Master_Runner.py#L1433) intends to convert TAZ name to 0-index TAZ ID using tazIds array. The tazIds array gives the 0-index TAZ ID for a given sequential MAZ ID. This worked error-free for SOABM because the max TAZ number (2393) is less than the length of the tazIDs array (2570) but the resulting answer is wrong.
  3. Line 1433 should be replaced with this: o = uniqTazs.index(o)
  4. Lines 1432 (https://github.com/RSGInc/SOABM/blob/master/template/scripts/Master_Runner.py#L1432) and 1434 (https://github.com/RSGInc/SOABM/blob/master/template/scripts/Master_Runner.py#L1434) seem to be okay. Line 1432 gets the sequential MAZ ID from CT-RAMP output, which is used to get the 0-index TAZ ID in line 1434 using tazIds array
  5. The bug needs to be fixed for pnr and knr on both outbound and inbound directions and for individual and joint trips

This seemed to work perfectly @binnympaul
Thank you for your review and support with this issue - it's greatly appreciated.