-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
50 lines (45 loc) · 1.03 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include <chrono>
#include <cstdio>
#include "algo/search.h"
#include "common/global.h"
#include "utils/utils.h"
using namespace std;
void print_result(const Result &result) {
cout << "<" << result.second;
cout << ",";
cout << result.first << ",[";
print_words(objects[result.second].words);
cout << "]> ";
}
void output(MinHeap<Result> &results) {
int i = 1;
while (!results.empty()) {
auto &result = results.top();
cout << i++ << ". ";
print_result(result);
results.pop();
cout << endl;
}
cout << endl;
}
void run(Index &index) {
Searcher searcher;
for (auto &query : queries) {
auto result = searcher.search(index, query);
output(result);
}
}
int main(int argc, char *argv[]) {
string temp;
string data_set(argv[1]);
string query_set(argv[2]);
int k = stoi(argv[3]);
double max_dist = stod(argv[4]);
double alpha = stod(argv[5]);
double delta = stod(argv[6]);
load_objects(data_set);
load_queries(query_set, k, alpha, delta, max_dist);
Index index;
run(index);
return 0;
}