Some time ago I came up with what I believe to be the perfect way to draw congressional districts:
- Choose, at random, a voting precinct anywhere in the state.
- Choose, at random, any precinct contiguous to the first. Compute the total population. Choose another one contiguous to the set consisting of the first two. Recompute the total population.
- Continue as above until the total population reaches or exceeds that specified for congressional districts, within some tolerance. This is District 1.
- Choose, at random, an as-yet-unchosen voting precinct and repeat the process for District 2. Repeat again for District 3, etc.
- After all precincts have been assigned to congressional districts, perform an annealing step: using contiguity as the primary cost function and population as a secondary cost function, trade precincts back and forth until all of the districts are contiguous and more or less the same size, population-wise.
A third-year computer-science student could write this as a class
(But: who will bell the cat?)