forked from Berkeley-CS170/project-fa20-skeleton
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
33 lines (28 loc) · 1.1 KB
/
test.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
from breakout import *
from parse import *
from utils import *
def generate_dic_from_lists(rooms):
dic = {}
for i in range(len(rooms)):
for student in rooms[i]:
dic[student] = i
return dic
G, stress_budget = read_input_file("inputs/medium-1.in")
# print(true_random(G, stress_budget))
problem = BreakoutProblem(G, stress_budget, load="outputs/medium-1.out")
problem.updates = 1000
zoom, happiness = problem.anneal()
print(zoom.rooms, happiness)
"""
def fun(lst):
graph, stress_budget = read_input_file("in/50.in")
dic = {}
for i in range(len(lst)):
dic[i] = lst[i]
if is_valid_solution(convert_dictionary(dic), graph, stress_budget, len(lst)):
return -1 * calculate_happiness(convert_dictionary(dic), graph)
else: # does not meet stress requirement
return 1
# return max(0, (-1 * self.state.stress_happiness_score()) / 100)
print(fun([[2, 7, 8, 13, 15, 16, 18, 19, 20, 21, 23, 24, 25, 26, 32, 34, 35, 36, 38, 39, 41, 43, 44, 45, 46, 47, 49], [0, 1, 3, 4, 5, 6, 9, 10, 11, 12, 14, 17, 22, 27, 28, 29, 30, 31, 33, 37, 40, 42, 48]]))
"""