有人知道用于路径查找算法测试的工具吗?我能在2D网格上测试我的自己编写的路径查找算法。 类似这个http://topfat.blogspot.com/,但是我需要写和运行我的自己的算法。我可以使用任何编程语言进行调整。
有人知道用于路径查找算法测试的工具吗?我能在2D网格上测试我的自己编写的路径查找算法。 类似这个http://topfat.blogspot.com/,但是我需要写和运行我的自己的算法。我可以使用任何编程语言进行调整。
public interface PathFindingAlgorithm {
/**
* Method for finding path from given start point to goal point
* using Map object. Found path (if any) depends on path finding algorithm
* class that overrides this method.
*
* @param start the point where the search begins
* @param goal the goal point
* @param map Map object the path finding algorithm uses
* @return SearchResult object containing path and possibly other relevant information
* about the search and <code>null</code> if no path is found.
*/
public SearchResult findPath(Point start, Point goal, Graph graph);
你可以在这个类中添加你的算法 (http://code.google.com/p/topfat/source/browse/trunk/src/algorithms/PathFindingAlgorithms.java):
public class PathFindingAlgorithms {
private Vector<PathFindingAlgorithm> algorithms;
public PathFindingAlgorithms() {
this.algorithms = new Vector<PathFindingAlgorithm>();
addAlgorithm(new AStarAlgorithm());
addAlgorithm(new DijkstraStyleAlgorithm());
}
public Vector<PathFindingAlgorithm> getAlgorithms() {
return algorithms;
}
public void addAlgorithm(PathFindingAlgorithm algorithm) {
if (! this.algorithms.contains(algorithm)) {
this.algorithms.add(algorithm);
}
}
public void removeAlgorithm(PathFindingAlgorithm algorithm) {
this.algorithms.remove(algorithm);
}
我不确定这是否也添加了GUI所需的所有内容。我们是几年前做的,所以代码(当然)不完美。在此应用程序中,最简单的情况是Dijkstra算法,如果您需要更复杂的内容,请查看A*算法。
您可以从Google Code http://code.google.com/p/topfat/ 进行检出。如果您想提交一些内容,我们也可以为您添加写入权限。