synthicity/urbansim — pull request #102 by bridwell (2014-08-18 17:47:10+00:00)
Title: transition model updates

Made some changes to the transition model. These include:

1) Update _updated_linked_table method to use pandas merge:

I was hitting a performance bottle-neck when adding a large number of agents (and therefore linked agents). I was adding ~70k agents and 194K linked agents and this was taking around ~34 seconds. Changing the code to use the merge reduced this to ~4 seconds.

2) Add ability to control to a count provided by an 'accounting' column:

This was a feature that MAG had added to the old opus code. For example, we may want to sample from households but the control we want to hit exactly is household population. I added a new sampling file to the utilities folder to handle most of the heavy lifting w/ the idea that maybe this functionality could be of use outside the transition model as well. Changes were then made to add and remove rows methods and each of the transition classes to accommodate this.

I've tested this, and everything seems to be working fine. But I get that this is addressing pretty core functionality so if you are not comfortable bringing this in right now I'm cool w/ mirroring the transition file (something like mag_transition?). We could also leave in this in our specific urbansim implementation but I thought it might be of use to other agencies.