誰もが知っている、パス検索アルゴリズムのテスト用のツールです。2D グリッドで独自の書き込みパス検索アルゴリズムをテストできる場所。このhttp://topfat.blogspot.com/のようなもの ですが、独自のアルゴリズムを作成して実行できる場所。任意のプログラミング言語を使用できます。コードをほぼすべてのプログラミング言語に合わせて調整できます。
質問する
1265 次
1 に答える
0
Tool for Path Finding アルゴリズムのソース コードを確認しましたか? 私は開発者の 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 Code http://code.google.com/p/topfat/からチェックアウトできます。コミットしたいことを行う場合は、書き込み権限も追加できます。
于 2012-04-20T06:13:29.990 に答える