-
Notifications
You must be signed in to change notification settings - Fork 26
Notes on UAL code merger
This document is a description of the merger of the UAL code into merger. The work was done between Feb-April of 2017 by @fscottfoti. Is is divided into sections of the type of changes that were made.
Orca test is a very useful tool to ensure certain orca attributes are available, that they're the right types, and that the values match certain ranges. In short, it's a schema checker. Unfortunately it's very slow right now, I think this is because it does multi-level joins to test foreign keys.
Currently the orca_test code is commented out of bayarea_urbansim and an issue has been opened on orca_test. So far there's been little movement on that issue. If the speed improvements don't happen in orca_test, it would be good to implement a mode where the code can be turned on and off depending on the user's needs.
A second performance bug was found and fixed in UrbanSim, which was uncovered by the UAL changes. The system now runs in about 7 minutes longer because of the UAL changes, for a total of about 80 minutes for 5 year iterations.
Does assigning tenure using the higher of rent and price really work? I mapped prices and rents over the 30 year simulation and the results seem quite good. I do think the one major problem is that the tenure of a building goes to the price/rent that is the highest in an area. This is not incorrect, but it seems like the results should be probabilistic and now be all rent or all own, but be dependent on the relative ratio of rents / prices in an area.
Given that rent/price are used to drive the tenure of new units and buildings, we also needed a mechanism to drive the relative magnitude of rents and prices. We do that be looking at the utilization of rental and owner units using this code. If rental units have a lower vacancy rate, rental rates go up, and vice versa with ownership and prices. This change is affected through the cap rate.
It also seems that using this kind of logic could leave us with vacancies at the end of the simulation in one of the rent/own segments, while at the same time we have unplaced households. Since unplaced households are not allowed in the MTC planning context, we run special HLCMs at the end which do not respect tenure in order to place any unplaced households. Luckily, at this point we have tuned the rent/price balance such that we these HLCMs do not currently place any households.
ual.py line 291 and various places use 1 and 2 to indicate whether a household or unit are rental or owner. This has been changed to the strings "rent" and "own" so that the modeler doesn't have to remember which is which. Along those lines, the hownrent attribute on both households and units has been changed to the name "tenure."
In most places, the use of the ual_ prefix has been removed. For instance, ual_owner_hlcm is just owner_hlcm. The non-UAL versions of these models have been removed. ual.py is still named the same, and most of the code is kept together in that module as a way to justify the slightly different coding styles and to give UAL credit for their excellent work.
Along those lines, the separate ual settings file has been moved to attributes in the main settings.yaml file.
This is entirely unrelated to the UAL code, but careful thinking about the rent and price sides of the model lead me to realize we should rename the attribute non_residential_price on buildings to non_residential_rent.
In a few places, there was a proliferation of modeling steps. It's a matter of taste, but I feel like orca.step should only be called a couple dozen times in a modeling run. In this case there was a model step which updated the building price from simulated unit prices and rents. I turned this into an aggregation variable rather than a separate step. In all fairness, it was likely a step in order to keep separate modeling workflows between UAL and MTC, which we decided to merge together.
drop current building-style hedonics and lcms?
initialization should be moved to baus preprocessing step
Need to verify how new hlcms segment on income, and remove baus variables for vacant affordable and market rate units and replace with new version.
Need to move treatment of deed restricted units into new hlcm models and attach to units
If we drop the old model sequence we can clean up the two simulations types in baus.py
I actually like reconcile_placed_households to keep building_id and unit_id in sync. If we’re going that far, can we add parcel_id too? We could simplify a lot of 2-level joins and make them 1-level. If we drop building_ids, we will need 3-level joins. (Decided to leave this one as-is.)
There are now three cap rates in play - one is in ual_settings, one is here and one is implicit here - also it’s a good idea to clean up the building price calculations to include the new difference between owner and rental housing, and a better computation of land price
The core urbansim crashes when doing an lcm with no alternatives, which is a problem when running the unplaced hlcm on the renter side (no unplaced renters)
deed restricted units were moved to the unit table