-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
69 lines (59 loc) · 2.92 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import housing
def main():
num_trials = 10
adams_1_score, adams_2_score, currier_score, dunster_score = 0, 0, 0, 0
adams_1_sd_total, adams_2_sd_total, currier_sd_total, dunster_sd_total = 0, 0, 0, 0
adams_1_time_total, adams_2_time_total, currier_time_total, dunster_time_total = 0, 0, 0, 0
adams_1_unallocated, adams_2_unallocated = 0, 0
for i in range(num_trials):
print("ITERATION {}".format(i))
house = housing.Housing()
house.randomly_generate_rooms()
house.randomly_generate_blocking_groups()
house.set_bg_room_prefs()
adams_1_unallocated += house.run_adams(is_random_rg_config = False)
adams_1_avg, adams_1_sd, adams_1_time = house.print_lottery_statistics()
adams_1_score += adams_1_avg
adams_1_sd_total += adams_1_sd
adams_1_time_total += adams_1_time
adams_2_unallocated += house.run_adams(is_random_rg_config = True)
adams_2_avg, adams_2_sd, adams_2_time = house.print_lottery_statistics()
adams_2_score += adams_2_avg
adams_2_sd_total += adams_2_sd
adams_2_time_total += adams_2_time
house.run_currier()
currier_avg, currier_sd, currier_time = house.print_lottery_statistics()
currier_score += currier_avg
currier_sd_total += currier_sd
currier_time_total += currier_time
house.run_dunster()
dunster_avg, dunster_sd, dunster_time = house.print_lottery_statistics()
dunster_score += dunster_avg
dunster_sd_total += dunster_sd
dunster_time_total += dunster_time
print
print("+++++ global averages +++++")
print("== ADAMS w/ opt RG configs")
print("==== average: %.6f" % (float(adams_1_score) / float(num_trials)))
print("==== std dev: %.6f" % (float(adams_1_sd_total) / float(num_trials)))
print("==== time: %.6f" % (float(adams_1_time_total) / float(num_trials)))
print("==== unallocated ct: %.6f" % (float(adams_1_unallocated) / float(num_trials)))
print
print("== ADAMS w/ random RG configs")
print("==== average: %.6f" % (float(adams_2_score) / float(num_trials)))
print("==== std dev: %.6f" % (float(adams_2_sd_total) / float(num_trials)))
print("==== time: %.6f" % (float(adams_2_time_total) / float(num_trials)))
print("==== unallocated ct: %.6f" % (float(adams_2_unallocated) / float(num_trials)))
print
print("== CURRIER")
print("==== average: %.6f" % (float(currier_score) / float(num_trials)))
print("==== std dev: %.6f" % (float(currier_sd_total) / float(num_trials)))
print("==== time: %.6f" % (float(currier_time_total) / float(num_trials)))
print
print("== DUNSTER")
print("==== average: %.6f" % (float(dunster_score) / float(num_trials)))
print("==== std dev: %.6f" % (float(dunster_sd_total) / float(num_trials)))
print("==== time: %.6f" % (float(dunster_time_total) / float(num_trials)))
print
if __name__== "__main__":
main()