本文整理汇总了C++中Searcher::initializeSingleSource方法的典型用法代码示例。如果您正苦于以下问题:C++ Searcher::initializeSingleSource方法的具体用法?C++ Searcher::initializeSingleSource怎么用?C++ Searcher::initializeSingleSource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Searcher
的用法示例。
在下文中一共展示了Searcher::initializeSingleSource方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testSearchLeadsToCorrectSolution
void SearcherTest::testSearchLeadsToCorrectSolution(Searcher searcher, std::string algorithm) {
searcher.setAlgorithm(algorithm);
searcher.initializeSingleSource();
searcher.heapInsertAll();
searcher.search();
int* path = searcher.getPath();
int* distance = searcher.getDistance();
assert(path[16] == 3 && distance[16] == 1);
assert(path[20] == 19 && distance[20] == 5);
assert(path[62] == 49 && distance[62] == 11);
assert(path[69] == 70 && distance[69] == 18);
assert(path[95] == 82 && distance[95] == 20);
}
示例2: testInitializeSingleSourceSetsDistanceAndPathRight
void SearcherTest::testInitializeSingleSourceSetsDistanceAndPathRight(Searcher searcher) {
searcher.initializeSingleSource();
int* path = searcher.getPath();
int* distance = searcher.getDistance();
int inf = infinity;
for (int row = 0; row < 8; row++) {
for (int col = 0; col < 13; col++) {
int location[2] = {row, col};
int node = searcher.locationToNode(location);
assert(path[node] == -1);
if (row == startLocation[0] && col == startLocation[1]) assert(distance[node] == 0);
else assert(distance[node] == inf);
}
}
}