예제 #1
0
def run_all_tests(search_problem):
    print(search_problem.maze)
    print(bfs_search(search_problem))
    print(astar_search(search_problem, null_heuristic))
    print(astar_search(search_problem, search_problem.state_len_heuristic))
    print(astar_search(search_problem, search_problem.opt_state_len_heuristic))
    print(astar_search(search_problem, search_problem.uniq_x_y_heuristic))
예제 #2
0
# Created by Ningxiang He on 01/08/2019

from CannibalProblem import CannibalProblem
from uninformed_search import bfs_search
from uninformed_search import dfs_search
from uninformed_search import ids_search

# Create a few test problems:
problem331 = CannibalProblem((3, 3, 1))
problem541 = CannibalProblem((5, 4, 1))
problem551 = CannibalProblem((5, 5, 1))

# Run the searches.
#  Each of the search algorithms should return a SearchSolution object,
#  even if the goal was not found. If goal not found, len() of the path
#  in the solution object should be 0.

print(bfs_search(problem331))
print(dfs_search(problem331))
print(ids_search(problem331))

print(bfs_search(problem551))
print(dfs_search(problem551))
print(ids_search(problem551))

print(bfs_search(problem541))
print(dfs_search(problem541))
print(ids_search(problem541))
예제 #3
0
from CannibalProblem import CannibalProblem
from uninformed_search import bfs_search, dfs_search, ids_search

# Create a few test problems:
problem331 = CannibalProblem((3, 3, 1))
problem541 = CannibalProblem((5, 4, 1))
problem551 = CannibalProblem((5, 5, 1))

# Run the searches.
#  Each of the search algorithms should return a SearchSolution object,
#  even if the goal was not found. If goal not found, len() of the path
#  in the solution object should be 0.

#print(bfs_search(problem331))
#print(dfs_search(problem331))
#print(ids_search(problem331))

#print(bfs_search(problem551))
#print(dfs_search(problem551))
#print(ids_search(problem551))

print(bfs_search(problem541))
#print(dfs_search(problem541))
print(ids_search(problem541))
예제 #4
0
def run_all_tests(search_problem):
    print(search_problem.maze)
    print(bfs_search(search_problem))
    print(astar_search(search_problem, null_heuristic))
    print(astar_search(search_problem, search_problem.manhattan_heuristic))
    print(astar_search(search_problem, search_problem.straight_line_heuristic))
예제 #5
0
#Outline provided
#No Code Additions - Himadri Narasimhamurthy
#CS76 - 19W - M&C

from CannibalProblem import CannibalProblem
from uninformed_search import bfs_search, dfs_search, ids_search

# Create a few test problems:
problem331 = CannibalProblem((3, 3, 1))
problem541 = CannibalProblem((5, 4, 1))
problem551 = CannibalProblem((5, 5, 1))

# Run the searches.
#  Each of the search algorithms should return a SearchSolution object,
#  even if the goal was not found. If goal not found, len() of the path
#  in the solution object should be 0.

print(bfs_search(problem331, False))
print(bfs_search(problem331, True))
print(dfs_search(problem331))
print(ids_search(problem331))

print(bfs_search(problem551, False))
print(dfs_search(problem551))
print(ids_search(problem551))

print(bfs_search(problem541, False))
print(dfs_search(problem541))
print(ids_search(problem541))
예제 #6
0
 def wavefront_planning(self, table, maze, goal_loc):
     current_search = self
     goal_loc = (0, ) + goal_loc
     table = bfs_search(current_search, table, goal_loc)
     return table