路径查找算法测试工具

时间:2012-04-18 20:22:51

标签: algorithm testing path

任何人都知道,一些用于路径查找算法测试的工具。 我可以在2d网格上测试我自己的写入路径查找算法。 像这样http://topfat.blogspot.com/ 但是我可以编写并运行自己的算法。 它可以使用任何编程语言。 我几乎可以将我的代码调整为任何编程语言。

1 个答案:

答案 0 :(得分:1)

您是否检查过路径搜索工具算法的源代码?我是开发人员之一,工具是开源(Java)。例如,您的算法应该实现的接口是

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代码http://code.google.com/p/topfat/。如果你做了一些你想要提交的事情,我们也可以为你添加写作权限。