Changeset 8362 for branches/RoutePlanning
- Timestamp:
- 07/30/12 17:33:52 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/RoutePlanning/HeuristicLab.Algorithms.GraphRouting/3.3/AStarAlgorithm.cs
r8356 r8362 10 10 private Dictionary<long, long> predecessors; 11 11 private List<long> closedList; 12 private HashSet<long> closedListLookup; 12 13 //private PriorityQueueOld<float, long> openList; 13 14 private PriorityQueue<float, long> openList; … … 23 24 predecessors = new Dictionary<long, long>(); 24 25 closedList = new List<long>(); 26 closedListLookup = new HashSet<long>(); 27 25 28 //openList = new PriorityQueueOld<float, long>(); 26 openList = new PriorityQueue<float, long>(new MyComparer());29 openList = new PriorityQueue<float, long>(new Comparer()); 27 30 28 31 long currentNode = sourceNodeId; … … 41 44 Dictionary<long, float> currentNeighbors = graph.GetNeighbors(currentNode); 42 45 foreach (KeyValuePair<long, float> neighbor in currentNeighbors) { 43 if (closedList.Contains(neighbor.Key)) 46 //if (closedList.Contains(neighbor.Key)) 47 // continue; 48 if (closedListLookup.Contains(neighbor.Key)) 44 49 continue; 45 50 … … 60 65 } 61 66 closedList.Add(currentNode); 67 closedListLookup.Add(currentNode); 62 68 } 63 69 throw new Exception(string.Format("No route found from {0} to {1}", sourceNodeId, targetNodeId)); … … 92 98 } 93 99 94 class MyComparer : IComparer<float> {100 class Comparer : IComparer<float> { 95 101 public int Compare(float item1, float item2) { 96 102 return item1 > item2 ? 1 : item1 < item2 ? -1 : 0; 97 98 // inverted comparison99 //return item1 < item2 ? 1 : item1 > item2 ? -1 : 0;100 103 } 101 104 }
Note: See TracChangeset
for help on using the changeset viewer.