misc changes

This commit is contained in:
eugenep 2021-04-26 11:13:29 +02:00
parent 23d60003df
commit c2268fefc3

View File

@ -19,10 +19,6 @@ class PlanRoute():
self.puddles = puddles self.puddles = puddles
def actions(self, state): def actions(self, state):
""" Return the actions that can be executed in the given state.
The result would be a list, since there are only three possible actions
in any given state of the environment """
possible_actions = ['Forward', 'Left', 'Right'] possible_actions = ['Forward', 'Left', 'Right']
x, y = state.get_location() x, y = state.get_location()
orientation = state.get_orientation() orientation = state.get_orientation()
@ -104,12 +100,6 @@ class PlanRoute():
return state.get_location() == self.goal.get_location() return state.get_location() == self.goal.get_location()
def path_cost(self, c, state1, action, state2): def path_cost(self, c, state1, action, state2):
"""Return the cost of a solution path that arrives at state2 from
state1 via action, assuming cost c to get up to state1. If the problem
is such that the path doesn't matter, this function will only look at
state2. If the path does matter, it will consider c and maybe state1
and action. The default method costs 1 for every step in the path."""
if action == "Forward" or action == "Left" or action == "Right": if action == "Forward" or action == "Left" or action == "Right":
@ -430,13 +420,6 @@ class SweeperAgent:
@staticmethod @staticmethod
#def best_first_graph_search(problem, f, display=False): #def best_first_graph_search(problem, f, display=False):
def best_first_graph_search(problem, f, display=True): def best_first_graph_search(problem, f, display=True):
"""Search the nodes with the lowest f scores first.
You specify the function f(node) that you want to minimize; for example,
if f is a heuristic estimate to the goal, then we have greedy best
first search; if f is node.depth then we have breadth-first search.
There is a subtlety: the line "f = memoize(f, 'f')" means that the f
values will be cached on the nodes as they are computed. So after doing
a best first search you can examine the f values of the path returned."""
#f = memoize(f, 'f') #f = memoize(f, 'f')
"""TODO""" """TODO"""