Skip to content

Notes on UAL code merger

Fletcher Foti edited this page May 1, 2017 · 9 revisions

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.

Performance

Orca Test

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 because it does multi-level joins to test foreign keys. Currently the orca test code is comment out 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.

Second performance bug

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.

Verification

does assigning tenure using higher of rent and price really work? map and exploratory analysis of the hedonic results, especially over time?

related issue, we do supply and demand for each of rent and own, but not across rent and own. If we want to use price/rent to pick tenure, don’t we need demand to drive price/rent.

Seems like using rent vs price to allocate unit tenure w/o considering demand can leave unplaced households. Good from a modeling perspective, bad from MTC’s perspective. Similar question to running hlcms before developer - running after guarantees placement at the end of the run… We should make a test in summary.py or similar that all households and jobs get placed. From an MTC perspective, that’s an error.

Small tweaks

Use of ints to indicate tenure changes to strings

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."

Naming convention

In most places, the use of the ual_ prefix everywhere has been removed. For instance, ual_owner_hlcm is just owner_hlcm. The non-UAL versions of these models have just been removed. The ual.py is still called ual.py and most of the code is kept together in that module as a way to justify the slightly different coding styles and to give the UAL credit for their excellent work.

ual_settings.yaml

Along those lines, the separate ual settings file has just been moved to attribute in the main settings.yaml file.

non_residential_price -> non_residential_price

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 be calling the attribute non_residential_price on buildings non_residential_rent.

ual_update_building_residential_price

In a few places, there was a proliferation of modeling steps. I took a few of these out. 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.

Clean up

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

Clone this wiki locally