Compare commits
3 Commits
bed5fb8f22
...
47479936e0
Author | SHA1 | Date | |
---|---|---|---|
47479936e0 | |||
7c73089916 | |||
69634746c6 |
@ -54,9 +54,20 @@ void Graph::PrintGraph(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PrintSolution(std::vector<Vertex*> solution) {
|
void PrintSolution(std::vector<Vertex*> solution) {
|
||||||
|
int cost = 0;
|
||||||
std::cout << "Path: ";
|
std::cout << "Path: ";
|
||||||
for (Vertex* i : solution) { std::cout << i->nodeNumber << ' '; }
|
Vertex* lastVertex = solution.front();
|
||||||
|
for (Vertex* i : solution) {
|
||||||
|
std::cout << i->nodeNumber << ' ';
|
||||||
|
for (Edge j : lastVertex->edges) {
|
||||||
|
if (j.destination->nodeNumber == i->nodeNumber) {
|
||||||
|
cost += j.weight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lastVertex = i;
|
||||||
|
}
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
|
std::cout << "Cost: " << cost << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UCBFS(Graph graph, int start) {
|
void UCBFS(Graph graph, int start) {
|
||||||
|
Loading…
Reference in New Issue
Block a user