View Javadoc

1   package cz.cuni.amis.utils.astar;
2   
3   import java.util.Collection;
4   
5   /**
6    * This class represents the search space for A* algorithm
7    * 1) we need to know which neighbours the node has
8    * 2) we need to know the travel cost between two nodes (edge cost)
9    */
10  public interface AStarMap<NODE> {
11  	
12  	/**
13  	 * General cost of having this node at your path. This allows you to say how every node appeals to the agent, 
14  	 * it may specify "this is a cool node, try to get it on your path" (negative cost) or "this is neutral node"
15  	 * (zero cost) or "this is a bad node to have on your path" (positive cost).
16  	 * 
17  	 * @param node
18  	 * @return
19  	 */
20  	public int getNodeCost(NODE node);
21  	
22  	/**
23  	 * Should return the distance from nodeFrom to nodeTo
24       * You can be sure that nodeTo is among the neighbours of nodeFrom.
25  	 * @param nodeFrom
26  	 * @param nodeTo
27  	 * @return cost of an edge
28  	 */
29  	public int getEdgeCost(NODE nodeFrom, NODE nodeTo);
30  	
31  	/**
32  	 * This should return a collection of nodes which are connected to this one.
33  	 */
34  	public Collection<NODE> getNodeNeighbours(NODE node);
35  }