-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy patholdStuff.py
24 lines (24 loc) · 1.82 KB
/
oldStuff.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
(nextState,score,class_stars,GPA,course) = max([(self.InitialState.generateSuccessor(course,self.credit_limit),\
(course.class_stars/5.0*3.66)+course.GPA,course.class_stars,course.GPA,course)\
for course in self.courses if self.InitialState.generateSuccessor(course,self.credit_limit) != None and course.credit<=category[0]],key=itemgetter(1))
(nextState,score,class_stars,GPA,course) = max([(self.InitialState.generateSuccessor(course,self.credit_limit),\
(course.class_stars/5.0*3.66)+course.GPA,course.class_stars,course.GPA,course)\
for course in self.courses if self.InitialState.generateSuccessor(course,self.credit_limit) != None],key=itemgetter(1))
print nextState.distrib, nextState.rule_out
nextState.distrib = checkRuleOut(self.courses, course, nextState.distrib, nextState.rule_out)
print nextState.distrib, nextState.rule_out
while True:
try:
(nextState,score,class_stars,GPA,course) = max([(nextState.generateSuccessor(course,self.credit_limit),\
(course.class_stars/5.0*3.66)+course.GPA,course.class_stars,course.GPA,course)\
for course in self.courses if nextState.generateSuccessor(course,self.credit_limit) != None],key=itemgetter(1))
print nextState.distrib, nextState.rule_out
nextState.distrib = checkRuleOut(self.courses, course, nextState.distrib, nextState.rule_out)
print nextState.distrib, nextState.rule_out
for c in nextState.taken:
for t in c.time:
index = "%i,%i" % (int(t[1]), (int(ord(t[0])-65)))
self.var[index] = c.name
except:
print "Greedy finished!!!"
break