New Memory bounded A* Algorithm
def astar(start, goal): opened = [[start, 0]] # List of open nodes closed = [] # List of closed nodes visited = set() # Set of visited nodes while opened: val, min_cost = opened.pop(0) if val == goal: break visited.add(val) for neighbor, cost in nodes[val]: if neighbor not in visited: new_cost = min_cost + cost opened.append([neighbor, new_cost]) else: continue ...






Comments
Post a Comment