我有以下 python 代碼: import heapq heapq.heappush(openList, currentSearchNode) #NOTE List of nodes that have been checked closedList = [] while openList: #NOTE Pop the lowest fscore (to-go + been from or gScore + hScore) and set it as current currentSearchNode = heapq.heappop(openList)...我需要將其轉(zhuǎn)換為 C++14,我嘗試了以下方法:#include <functional>#include <queue>priority_queue <Node, vector<Node>, greater<Node>> min_heap;vector<Node> openList, closeList;Node currentNode = Node(start, euclidean(start, end), 0);min_heap.emplace(openList, currentNode);while (!openList.empty()) { currentNode = min_heap.pop(openList);...}Visual Studio 中唯一以紅色彈出的問(wèn)題是這一行,currentNode = min_heap.pop(openList);正如您所看到的,它表示彈出的參數(shù)太多。如何以正確的方式做到這一點(diǎn)?
優(yōu)先級(jí)隊(duì)列作為最小堆c ++與python中的heapq
拉丁的傳說(shuō)
2023-07-05 10:29:32