Path: Math/AStar
% Finds the optimal path using A*. This function requires that you supply three functions cost = PathCostFunction( startNode, goalNode, d.myData ) cost = TraverseCostFunction( node, newNode, d.myData ) nodes = SuccessorNodes( node, parentNode, d.myData ) Locations are denoted by an index. You use it in your functions to compute the costs. -------------------------------------------------------------------------- Form: path = AStarSearch( startNode, goalNode, d ) -------------------------------------------------------------------------- ------ Inputs ------ startNode (1,1) Id of start location goalNode (1,1) Id of goal location d (1,1) Data structure .traverseCostFunction (1,:) Name of traverse cost function .pathCostEstimateFunction (1,:) Name of path cost function .successorNodesFunction (1,:) Name of path cost function .myData (1,1) Data structure with your data .nodes (1,:) List of nodes ------- Outputs ------- path (1,:) List of nodes in path -------------------------------------------------------------------------- Reference: Stout, W. Bryan, "The Basics of A* for Path Planning," Game Programming Gems, DeLoura, M. editor. Charles River Media, pp. 254-263, --------------------------------------------------------------------------
Back to the Math Module page