Iterative implementation of the forward Anytime Dynamic A* (AD*-f) search algorithm.
* *AD* is an anytime, dynamic search algorithm. It is able to obtain suboptimal-bounded solutions, * tuning the quality of the solution based on the available search time (this is done by adjusting * the heuristic inflation parameter, epsilon). This algorithm is executed * iteratively improving the quality of the solution and reusing previous search efforts. The algorithm * also takes into account the changes produced over the graph arc costs to incrementally repair * the previous solution. AD* provides anytime results and an efficient * way to solve dynamic search problems.
* *This is the forward implementation of AD*, the algorithm starts exploring the state space * from the beginning state and trying to reach a goal state (or multiple ones).
* *Reference: * Maxim Likhachev, David Ferguson, Geoffrey Gordon, Anthony (Tony) Stentz, and Sebastian Thrun, * * "Anytime Dynamic A*: An Anytime, Replanning Algorithm" * Proceedings of the International Conference on Automated Planning and Scheduling (ICAPS), June, 2005.
* * @param class defining the action * @param* Implementation of the A* algorithm. The A* algorithm extends the original * Dijkstra's algorithm by including heuristics to improve the search. By default, * the implementation uses a {@link java.util.PriorityQueue} for the nodes, which requires * {@literal O(log n)} time for insertions. The queue can be changed to use another * type of queue, for example a fibonacci heap as a queue, which works with constant amortized * time for insertions. *
* * Original paper: * Hart, Peter E., Nils J. Nilsson, and Bertram Raphael. "A formal basis for the heuristic determination of minimum cost paths.". IEEE Transactions on Systems Science and Cybernetics 4.2 (1968): 100-107. * * @param action type. * @param* Executes the search algorithm and invokes the method * {@link SearchListener#handle(Object)} passing the current * explored node to the listener. *
* *
* {@code Hipster.createDijkstra(problem).search(new Algorithm.SearchListener() {
* @Override
* public void handle(Node node) {
* // Do something with the node.
* }
* });
* }
*
*
* @param listener listener used to receive the explored nodes.
*/
public void search(SearchListener* Optimized implementation of the Bellman-Ford algorithm. The main difference with the standard version * of Bellman-Ford is that this implementation does not relax all edges at each iteration. This implies that * the first time the goal state is reached, the cost may not be the optimal one. The optimal cost is only guaranteed * when the queue is empty (when bellmanFordIt.hasNext() == false). *
* * Original paper: * Bellman, R. "On a routing problem". Quarterly of Applied Mathematics (1958) 16: 87–90. * * @param action type. * @param* Breadth First Search (BFS) implementation. This is an uninformed algorithm that explores * first the neighbors at distance 1 (direct neighbors), then the neighbors at distance 2 * (neighbors of the neighbors), and so on. The algorithm is complete but not optimal * (it is only optimal if the cost of the problem is uniform and each transition has a cost of one). *
* * See this Wikipedia article for more information about BFS. * * @param action type. * @param* Depth First Search (DFS) is a blind algorithm that performs an exploration * of the graph in a way that always reaches the deepest node before backtracking. * The Hipster implementation is a graph-based search that can handle cycles. * This algorithm is complete (it always finds a solution if it exists) but not * optimal. *
* * For more information see this article of the Wikipedia about DFS. * * @author Pablo Rodríguez Mier <pablo.rodriguez.mier@usc.es> */ public class DepthFirstSearch> extends Algorithm { protected N initialNode; protected NodeExpander expander; // TODO; DRY common structures with other algorithms (like IDA) public DepthFirstSearch(N initialNode, NodeExpander expander) { this.expander = expander; this.initialNode = initialNode; } public class StackFrameNode { // Iterable used to compute neighbors of the current node private java.util.Iterator* In computer science maximumDepth-limited search is an algorithm to explore the vertices of a graph. * It is a modification of maximumDepth-first search and is used for example in the iterative deepening * maximumDepth-first search algorithm. *
* * For more information see this article of the Wikipedia about DLS. * * @author Gabriella Zekany */ public class DepthLimitedSearch > extends Algorithm { protected N initialNode; protected N finalNode; protected NodeExpander nodeExpander; protected int maximumDepth; protected int currentDepth; protected ArrayList* Implementation of the IDA* algorithm. Similar to Iterative DFS but using heuristics to limit * the space search and keeping a very low memory usage. *
* * Original paper: * Richard E. Korf "Depth-first Iterative-Deepening: An Optimal Admissible Tree Search.", * Artificial Intelligence, vol. 27, pp. 97-109, 1985. * * @param action type. * @paramImplementation of the multi-objective label setting algorithm described * by Martins and Santos.
* * Original paper: * Martins, E. D. Q. V., & Santos, J. L. E. (1999). "The labeling algorithm for the multiobjective shortest path problem". Departamento de Matematica, Universidade de Coimbra, Portugal, Tech. Rep. TR-99/005. * * @param action type. * @paramGraph builder assistant to create a Hipster graph. Usage example:
*
* {@code
* HipsterGraph =
* GraphBuilder.create()
* .connect("A").to("B").withEdge(4d)
* .connect("A").to("C").withEdge(2d)
* .connect("B").to("C").withEdge(5d)
* .createDirectedGraph();
* }
*
*/
public class GraphBuilder