Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Andrew Friedman
/
Fairly Draw Election Districts
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Pipelines
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
34e283c7
authored
Mar 14, 2017
by
Garrett Johnson
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of mit.cs.uchicago.edu:ajfriedman/election_district_drawing
parents
644dc4f3
75560065
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
algorithms/algorithms_new.py
algorithms/algorithms_new.py
View file @
34e283c7
...
...
@@ -941,13 +941,12 @@ def make_gap_lower(districts_dict, all_tracts, num_districts, used_tracts,
plus_total_population_D_R
(
districts_dict
,
best_district
,
best_total
,
best_dem
,
best_rep
)
minus_total_population_D_R
(
districts_dict
,
check_pop
,
best_total
,
best_dem
,
best_rep
)
gap
=
calculate_efficiency_gap_from_dict
(
districts_dict
)
printer
=
[
"lower"
,
check_pop
,
count
]
for
num
in
districts_dict
:
printer
.
append
(
districts_dict
[
num
][
"total_population"
])
printer
.
append
(
calculate_efficiency_gap_from_dict
(
districts_dict
))
print
(
printer
)
gap
=
calculate_efficiency_gap_from_dict
(
districts_dict
)
return
districts_dict
...
...
@@ -1002,6 +1001,13 @@ def completed_result(state, initial_percent_of_people=60, goal=5,
make_gap_lower
(
districts_dict
,
state_tract
,
num_districts
,
used_tracts
,
goal
,
min_pop_district
,
max_pop_district
)
copy
=
dict
(
districts_dict
)
for
district_num
in
copy
:
dist_info
=
districts_dict
[
district_num
]
dist_str
=
str
(
district_num
)
districts_dict
[
dist_str
]
=
dist_info
del
districts_dict
[
district_num
]
create_json_file
(
districts_dict
,
"district_plans/"
+
state
+
special_name
)
...
...
@@ -1111,4 +1117,4 @@ if __name__=="__main__":
create_json_file
(
district_plan
,
"district_plans/"
+
sys
.
argv
[
1
])
d
=
recover_json
(
"district_plans/"
+
"Iowa"
+
".json"
)
print
(
d
)
\ No newline at end of file
print
(
d
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment