2012-04-18 84 views
4

任何人都知道,一些路徑發現算法測試工具。 我可以在2D網格上測試我自己寫的路徑查找算法。 類似這樣http://topfat.blogspot.com/ 但是,我可以寫和運行我自己的算法。它可以使用任何編程語言。 我可以將我的代碼幾乎調整爲任何編程語言。路徑發現算法測試工具

回答

1

您是否檢查了Tool for Path Finding算法的源代碼?我是開發人員之一,工具是開源(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 Code http://code.google.com/p/topfat/結賬。如果你做了一些你想提交的內容,我們也可以爲你添加寫作權限。

+0

我在大學學習,在與路徑尋找算法相關的項目中工作。我在互聯網上搜索這樣的程序,找不到。所以我問,可能那裏已經有這樣的程序。現在我只是檢查可選的選項和替代品。 – macro 2012-04-20 13:48:00