public void Push(T item, float Score) { var NewKey = new HeapKey(Guid.NewGuid(), Score, item); this.heap.Add(NewKey); }
public void Replace(SearchNode inOpenList, SearchNode newNode) { _hashByState[inOpenList.State].Remove(inOpenList); _hashByState[newNode.State].Add(newNode); var oldKey = new HeapKey(inOpenList, _compareNodes); if (_heap.ContainsKey(oldKey)) { _heap[oldKey].Remove(inOpenList); } var newKey = new HeapKey(newNode, _compareNodes); if (!_heap.ContainsKey(newKey)) { _heap[newKey] = new List <SearchNode>(); } _heap[newKey].Add(newNode); }
public void Push(SearchNode node) { var key = new HeapKey(node, _compareNodes); // add to heap if (!_heap.ContainsKey(key)) { _heap[key] = new List <SearchNode>(); } _heap[key].Add(node); // add to state hash if (!_hashByState.ContainsKey(node.State)) { _hashByState[node.State] = new List <SearchNode>(); } _hashByState[node.State].Add(node); // increment count Count++; }