int main(int argc, char *argv[]) { // Profiling observation: Using int instead of double cost provides marginal improvement (~10%) GenericSearchGraphDescriptor<myNode,double> myGraph; // We describe the graph, cost function, heuristics, and the start & goal in this block // ------------------------------------------------------------------------------------ // Set the functions myGraph.getHashBin_fp = &getHashBin; myGraph.isAccessible_fp = &isAccessible; myGraph.getSuccessors_fp = &getSuccessors; myGraph.getHeuristics_fp = &getHeuristics; // Set other variables myGraph.hashTableSize = 212; // Since in this problem, "getHashBin" can return a max of value 201. myGraph.hashBinSizeIncreaseStep = 512; // By default it's 128. For this problem, we choose a higher value. myNode tempNode; tempNode.x = -150; tempNode.y = -150; // Start node myGraph.SeedNode = tempNode; tempNode.x = 150; tempNode.y = 150; // Goal node myGraph.TargetNode = tempNode; // ------------------------------------------------------------------------------------ // Planning A_star_planner<myNode,double> planner; planner.setParams(1.0, 10); // optional. planner.init(myGraph); planner.plan(); std::vector< std::vector< myNode > > paths = planner.getPlannedPaths(); printf("\nNumber of paths: %d\nPath coordinates: \n[ ", paths.size()); for (int a=0; a<paths[0].size(); a++) printf("[%d, %d]; ", paths[0][a].x, paths[0][a].y); printf(" ]\n\n"); tempNode.x = -100; tempNode.y = -100; printf("Testing 'getNodeInfo': g-value of (%d,%d): %f\n\n", tempNode.x, tempNode.y, planner.getNodeInfo(tempNode).g); }