Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def uniformCostSearch(problem):
- closedset = set()
- fringle = util.PriorityQueue()
- fringle.push((problem.getStartState(),[]),0)
- while fringle.isEmpty() == False:
- state, path = fringle.pop()
- if (problem.isGoalState(state)):
- return path
- if (state not in closedset):
- closedset.add(state)
- for i in problem.getSuccessors(state):
- fringle.push((i[0], path + [i[1]]),((problem.getCostOfActions(),[])))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement