worked on disjkstra and a*
This commit is contained in:
@@ -49,7 +49,7 @@ public:
|
||||
// runs until all nodes were evaluated
|
||||
(void) end;
|
||||
|
||||
Log::add("Dijkstra", "calculating dijkstra from " + (std::string)*start + " to ALL OTHER nodes", false);
|
||||
Log::add("Dijkstra", "calculating dijkstra from " + (std::string)*start + " to " + ((end)?((std::string)*end):"ALL OTHER nodes"), true);
|
||||
Log::tick();
|
||||
|
||||
// cleanup previous runs
|
||||
@@ -75,10 +75,10 @@ public:
|
||||
DijkstraNode<T>* dnSrc = toBeProcessedNodes.pop();
|
||||
|
||||
// when an end is given, stop when end was reached
|
||||
if (end != nullptr && dnSrc->element == end) {break;}
|
||||
if (end != nullptr && dnSrc->element == end) {Log::add("Dijkstra", "reached target node"); break;}
|
||||
|
||||
// when a maximum weight is given, stop when current cum-dist > maxWeight
|
||||
if (maxWeight != 0 && dnSrc->cumWeight > maxWeight) {break;}
|
||||
if (maxWeight != 0 && dnSrc->cumWeight > maxWeight) {Log::add("Dijkstra", "reached distance limit"); break;}
|
||||
|
||||
// visit (and maybe update) each neighbor of the current element
|
||||
for (int i = 0; i < acc.getNumNeighbors(*dnSrc->element); ++i) {
|
||||
@@ -113,8 +113,8 @@ public:
|
||||
|
||||
}
|
||||
|
||||
Log::add("Dijkstra", "processed " + std::to_string(nodes.size()) + " nodes", false);
|
||||
Log::tock();
|
||||
Log::add("Dijkstra", "processed " + std::to_string(nodes.size()) + " nodes");
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user