Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Results for France and enhancements #204

Open
bixiou opened this issue Dec 31, 2017 · 2 comments
Open

Results for France and enhancements #204

bixiou opened this issue Dec 31, 2017 · 2 comments

Comments

@bixiou
Copy link

bixiou commented Dec 31, 2017

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:

  • allow starting from an existing map (rather than from a random one). That would allow closing the program and re-running it from its previous final redistricting, as well as modifying existing districts with fewer changes and a better first map (for contiguity e.g.) ;
  • instead of drawing random maps, draw maps that are contiguous and with few population imbalance (start with allocating one random atom to a district, then add neighboring atoms without creating holes until the average population of a district is attained ; continue this process with an unaffected atom neighboring already allocated ones) ;
  • display the scores, among which global population imbalance and number of discontinuous districts ;
  • allow an automatic end of the algorithm when some criteria are reached (expressed in terms of population imbalance and contiguity for example) ;
  • save explored maps, so that one can go back into previous solutions from the graphical window (or save at least the best maps along each criterion) ;
  • when saving the data, place in a new column the new districts (i.e. keep the original info of the district column).
    Please inform me if the first or the second propositions are implemented (I don't have time to do it myself, sorry).
@bixiou
Copy link
Author

bixiou commented Apr 28, 2018

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.

@happyjack27
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants