geoss / censumander

A tool to improve the usability of census data via "good" gerrymandering
http://journals.plos.org/plosone/article?id=10.1371/journal.pone.0115626#abstract0
Other
29 stars 10 forks source link

Speeding up compactness #2

Open ljwolf opened 6 years ago

ljwolf commented 6 years ago

@dfolch and I chatted at AAG about ways to speed up the compactness measure computation.

  1. Seems like every time you're computing a new unary union for each region; can't that be cached & only updated if there's a deletion?
  2. you can use the sum of the attribute * the squared distance to the center of mass as an attribute-weighted compactness metric, from Weaver & Hess (1963). This is the main idea underwriting those other metrics we talked about. You'd need distances one time (to find the initial center of mass), but after that it can always be updated iteratively using the current center of mass & the addition/deletion. It's not normalized between zero and one, but you just need a score, and this one is quite well behaved.
  3. Related to that logic, people still use the Openshaw centroid assignment method, which prioritizes assigning the atomic unit with the closest centroid, and that usually works alright when ranking the local choice set. You could even just randomly select from the closest X if you wanted to make it a little more stochastic.