Advertisement
Guest User

Untitled

a guest
Apr 27th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.63 KB | None | 0 0
  1.   public static void backup(SMANode node, SearchableGraph map, OpenQueue open){
  2.     if(completed(node, map, open) && node.parent != null){
  3.       double lowestFcost = Double.POSITIVE_INFINITY;
  4.  
  5.       //find lowest fcost of Successors
  6.       for(String link : map.getLinks(node.label)){
  7.         double childFcost = node.cost +
  8.             map.getPathCost(node.label,link) +
  9.             map.getHeuristic(link);
  10.         if(childFcost < lowestFcost){
  11.           lowestFcost = childFcost;
  12.         }
  13.       }
  14.  
  15.       if(node.fcost != lowestFcost){
  16.         node.fcost = lowestFcost;
  17.         backup(node.parent, map, open);
  18.       }
  19.     }
  20.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement