Open bixiou opened 6 years ago
I am trying to treat the second point. First step, I found what function should be changed in the code: it's mutate
, in solutions.DistrictMap. Here's how the function must be changed:
// I recall that vtd=atom=ward=IRIS
// Useful variables: pop_per_seat, vtd.population, vtds.get(i)
// Temp variables to create: district_pop, last_district, current_district, nb_districts_created
// Functions to create: unaffected_neighbors(vtd), unaffected_neighbors(district), hole(), unaffected_districts, candidate_vtd
1. create district while nb_districts_created < num_districts
1.0 if last_district exists, take one vtd in unaffected_neighbors(last_district), else assign first vtd
1.1 add unaffected neighbors to current_district while district_pop < pop_per_seat (cond P)
1.2 while (P) find unaffected_neighbors of the proto-district and add them while (P) if it doesn't create a hole
1.3 if candidate_vtd.pop < 2*(pop_per_seat - proto-district.pop), add it
2. allocate remaining unaffected vtd no neighboring districts
The function solutions.District.addAllConnected()
can help writing unaffected_neighbors.
i've implemented the second item in v 1.32.
these really should be split up into multiple cards... that way the status of the individual items can be updated.
I used autoredistrict to propose an redistricting of French legislative circonscriptions with equal population. One can see the result here: https://medium.com/@lesgrains/pour-un-redécoupage-égalitaire-des-circonscriptions-4de7c4efea88 (the last two links give access to the code and all files, in French though). I really enjoyed using autoredistrict, and I am very thankful to @happyjack27 for their help and reactivity. Now, I propose how the software could be enhanced: