【问题标题】:Tool for path finding algorithm testing寻路算法测试工具
【发布时间】:2012-04-30 08:02:49
【问题描述】:

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

【问题讨论】:

    标签: algorithm testing path


    【解决方案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/ 进行结帐。如果您做了您想做的事情,我们也可以为您添加写入权限。

    【讨论】:

    • 我正在大学学习并从事与寻路算法相关的项目。我在互联网上搜索了类似的程序,但找不到。所以我问也许已经有这样的程序。现在我只是在检查可行的选项和替代方案。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-03-11
    • 1970-01-01
    • 2011-02-05
    • 2015-07-23
    • 1970-01-01
    相关资源
    最近更新 更多