View Javadoc

1   package cz.cuni.amis.utils.astar;
2   
3   /**
4    * Evaluator is extending a functionality of {@link AStarHeuristic} allowing 
5    * you to additionally specified which NODEs can't be visited at all or assign
6    * extra cost to edges between nodes which is added to {@link AStarMap#getEdgeCost(Object, Object)}
7    * when computing distances between them.
8    * 
9    * @author Jimmy
10   *
11   * @param <NODE>
12   */
13  public interface AStarEvaluator<NODE> extends AStarHeuristic<NODE> {
14  
15  	 /**
16  	  * Returns true if A* can use this node (e.g. to step on this type of floor)
17        * You can use it to forbid some specific nodes	  
18  	  */
19  	 public boolean isNodeOpened(NODE node); 
20  
21  	 /**
22  	  * Returns extra cost to add to value when trying to go
23        * nodeFrom to nodeTo ... of course it can depends only on nodeTo 
24        * (some special kind of a floor for instance)
25        * 
26        * Don't worry about the edge cost to become negative, A* ensures that
27        * that the least cost is 0 (Algorithm can't work over graphs with negative
28        * costs.)
29        * 
30  	  * @return extra cost of edge for nodeFrom -> nodeTo
31  	  */
32  	 public int getExtraCost(NODE nodeFrom, NODE nodeTo);
33  	
34  }