Exemple #1
0
def main():
    # print("Solving using DFS:")
    # search.DepthFirstSearch().solve(puzzle33)

    # print("Solving using UCS:")
    # search.UniformCostSearch().solve(puzzle33)

    print("Solving using A* (# colors heuristic):")
    informed_search.AStarSearch(informed_search.num_colors_heuristic).solve(puzzle33)

    print("Solving using A* (color distance heuristic):")
    informed_search.AStarSearch(informed_search.color_distance_heuristic).solve(puzzle33)
    def test_puzzle6_solve(self):
        print("Solving using DFS:")
        search.DepthFirstSearch().solve(self.puzzle6)

        print("Solving using UCS:")
        search.UniformCostSearch().solve(self.puzzle6)

        print("Solving using A* (# colors heuristic):")
        informed_search.AStarSearch(
            informed_search.num_colors_heuristic).solve(self.puzzle6)

        # informed_search.color_distance_heuristic(self.puzzle6_step0)

        print("Solving using A* (color distance heuristic):")
        informed_search.AStarSearch(
            informed_search.color_distance_heuristic).solve(self.puzzle6)
Exemple #3
0
def main():
    # print("Solving using DFS:")
    # search.DepthFirstSearch().solve(puzzle54)

    # print("Solving using UCS:")
    # search.UniformCostSearch().solve(puzzle54)

    # print("Solving using A* (# colors heuristic):")
    # informed_search.AStarSearch(informed_search.num_colors_heuristic).solve(puzzle54)

    # num states explored: 952, actions:  [(4, 'y'), (16, 'r'), (24, 'r'), (30, 'r'), (30, 'y'), (30, 'dg'), (30, 'g')]
    print("Solving using A* (color distance heuristic):")
    informed_search.AStarSearch(informed_search.color_distance_heuristic).solve(puzzle54)
Exemple #4
0
def main():
    # print("Solving using DFS:")
    # search.DepthFirstSearch().solve(puzzle72)

    # print("Solving using UCS:")
    # search.UniformCostSearch().solve(puzzle72)

    # print("Solving using A* (# colors heuristic):")
    # informed_search.AStarSearch(informed_search.num_colors_heuristic).solve(puzzle72)

    # 26 states explored, solution: [(3, 'y'), (62, 'y'), (62, 'r'), (62, 't'), (62, 'y'), (62, 'g')]
    print("Solving using A* (color distance heuristic):")
    informed_search.AStarSearch(informed_search.color_distance_heuristic).solve(puzzle72)