def part2(): '''Completes one pass of homework 6's part 2.''' write("Executing part 2") runDict = {} for i in range(100): sol, steps = mc.min_conflicts(vars, domains, constraints, neighbors) points = bonusPoints(sol) runDict[points] = (sol, steps) highest = None for k in runDict: if highest == None or highest < k: highest = k print "" print "The solution with least violations/most preferences was found" display(runDict[highest][0], runDict[highest][1], highest)
def part1(): '''Completes one pass of homework 6's part 1.''' write("Executing part 1") sol, steps = mc.min_conflicts(vars, domains, constraints, neighbors) write(sol), write(len(sol)) display(sol, steps)