Esempio n. 1
0
def main():

    puzzles = [
        ((4, 4), (1, 3), (3, 0)),
        ((6, 5), (0, 4), (5, 0)),
        ((8, 8), (1, 7), (7, 0))
    ]

    for puzzle in puzzles:
        problem = SwitchboardProblem(puzzle[0], 3, 2, puzzle[1], puzzle[2])
        solution = simulated_annealing.search(problem, schedule)

        image = SwitchboardImage(64, 3, puzzle[1], puzzle[2], solution.data)
        image.save('../SwitchboardSolutions/'
                   + str(puzzles.index(puzzle)) + '_.png')
        print('Done with ', puzzle)
Esempio n. 2
0
def main():

    puzzles = [
        (5, 5, 2),
        (6, 6, 2),
        (8, 8, 1),
        (10, 10, 3),
        (15, 15, 4)
    ]

    for puzzle in puzzles:
        problem = EggCartonProblem(puzzle[0], puzzle[1], puzzle[2])
        solution = simulated_annealing.search(problem, schedule)

        image = EggCartonImage(puzzle[0], puzzle[1], 64, 3, solution.data)

        image.save('../EggSolutions/' + str(puzzle[0]) + 'x' \
                   + str(puzzle[1]) + '_' + str(puzzle[2]) + '.png')