MCPcopy Create free account
hub / github.com/Stream-AD/MIDAS / main

Function main

example/Reproducible.cpp:25–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23using namespace std::chrono;
24
25int main(int argc, char* argv[]) {
26 // Parameter
27 // --------------------------------------------------------------------------------
28
29 const auto pathMeta = SOLUTION_DIR"data/DARPA/darpa_shape.txt";
30 const auto pathData = SOLUTION_DIR"data/DARPA/darpa_processed.csv";
31 const auto pathGroundTruth = SOLUTION_DIR"data/DARPA/darpa_ground_truth.csv";
32
33 // Random seed
34 // --------------------------------------------------------------------------------
35
36 const unsigned seed = time(nullptr);
37 printf("Seed = %u\t// In case of reproduction\n", seed);
38 srand(seed); // Many rand(), need to init
39
40 // Read meta (total number of records)
41 // --------------------------------------------------------------------------------
42 // PreprocessData.py will generate those meta files
43
44 const auto fileMeta = fopen(pathMeta, "r");
45 int n;
46 fscanf(fileMeta, "%d", &n);
47 fclose(fileMeta);
48
49 // Read dataset
50 // --------------------------------------------------------------------------------
51
52 const auto fileData = fopen(pathData, "r");
53 const auto source = new int[n];
54 const auto destination = new int[n];
55 const auto timestamp = new int[n];
56 for (int i = 0; i < n; i++)
57 fscanf(fileData, "%d,%d,%d", &source[i], &destination[i], &timestamp[i]);
58 fclose(fileData);
59 printf("# Records = %d\t// Dataset is loaded\n", n);
60
61 // Do the magic
62 // --------------------------------------------------------------------------------
63 // Of course, I can merge loading and processing together, but this demo is also for benchmarking.
64
65 // MIDAS::NormalCore midas(2, 1024);
66 // midas.numCurrent.param1[0] = midas.numTotal.param1[0] = 2;
67 // midas.numCurrent.param1[1] = midas.numTotal.param1[1] = 3;
68 // midas.numCurrent.param2[0] = midas.numTotal.param2[0] = 5;
69 // midas.numCurrent.param2[1] = midas.numTotal.param2[1] = 7;
70 // MIDAS::RelationalCore midas(2, 1024);
71 // midas.numCurrentSource.param1[0] = midas.numTotalSource.param1[0] = 2;
72 // midas.numCurrentSource.param1[1] = midas.numTotalSource.param1[1] = 3;
73 // midas.numCurrentSource.param2[0] = midas.numTotalSource.param2[0] = 5;
74 // midas.numCurrentSource.param2[1] = midas.numTotalSource.param2[1] = 7;
75 // midas.numCurrentDestination.param1[0] = midas.numTotalDestination.param1[0] = 11;
76 // midas.numCurrentDestination.param1[1] = midas.numTotalDestination.param1[1] = 13;
77 // midas.numCurrentDestination.param2[0] = midas.numTotalDestination.param2[0] = 17;
78 // midas.numCurrentDestination.param2[1] = midas.numTotalDestination.param2[1] = 19;
79 // midas.numCurrentEdge.param1[0] = midas.numTotalEdge.param1[0] = 23;
80 // midas.numCurrentEdge.param1[1] = midas.numTotalEdge.param1[1] = 29;
81 // midas.numCurrentEdge.param2[0] = midas.numTotalEdge.param2[0] = 31;
82 // midas.numCurrentEdge.param2[1] = midas.numTotalEdge.param2[1] = 37;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected