Commit 9f3065af by Anne Rogers

worked

parent 18c706ab
Showing with 4 additions and 3 deletions
......@@ -871,7 +871,7 @@ def make_gap_lower(districts_dict, all_tracts, num_districts, used_tracts,
'''
Use the efficiency gap to construct an optimal district plan using
the entire population. It looks through districts randomly to find
a district under "goal" or stops if has looked at districts 4500 times.
a district under "goal" or stops if has looked at districts 1000 times.
Inputs:
districts_dict: a dictionary of dictionaries containing a tract plans in the state
......@@ -890,7 +890,7 @@ def make_gap_lower(districts_dict, all_tracts, num_districts, used_tracts,
gap = calculate_efficiency_gap_from_dict(districts_dict)
goal_percent = goal / 100
print(goal_percent, gap)
while abs(gap) > goal_percent and (count - 4500):
while abs(gap) > goal_percent and (count - 10000):
count += 1
new = False
check_pop = random.choice(range(1,num_districts+1))
......@@ -943,12 +943,13 @@ def make_gap_lower(districts_dict, all_tracts, num_districts, used_tracts,
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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment