+
+ if(argc < 2) {
+ cerr << argv[0] << " <graph file>" << endl;
+ exit(EXIT_FAILURE);
+ }
+
+ ifstream *file = new ifstream(argv[1]);
+
+ int nb_edges, nb_vertices;
+ int source, sink;
+
+ if(file->good()) {
+
+ (*file) >> nb_vertices >> nb_edges;
+ (*file) >> source >> sink;
+
+ cout << "INPUT nb_edges " << nb_edges << endl;
+ cout << "INPUT nb_vertices " << nb_vertices << endl;
+ cout << "INPUT source " << source << endl;
+ cout << "INPUT sink " << sink << endl;
+
+ scalar_t *el = new scalar_t[nb_edges];
+ int *ea = new int[nb_edges];
+ int *eb = new int[nb_edges];
+ int *edge_occupation = new int[nb_edges];
+
+ for(int e = 0; e < nb_edges; e++) {
+ (*file) >> ea[e] >> eb[e] >> el[e];
+ cout << "INPUT_EDGE " << ea[e] << " " << eb[e] << " " << el[e] << endl;
+ }
+
+ find_best_paths(nb_vertices, nb_edges, el, ea, eb, source, sink,
+ edge_occupation);
+
+#ifdef VERBOSE
+ // Sanity check on the overall resulting score (the edge lengths
+ // have been changed, hence should be the opposite of the sum of
+ // the path lengths)
+ scalar_t s = 0;
+ for(int e = 0; e < nb_edges; e++) {
+ if(edge_occupation[e]) s += el[e];
+ }
+ cout << "RESULT_SANITY_CHECK_SCORE " << s << endl;
+#endif
+
+ for(int e = 0; e < nb_edges; e++) {
+ if(edge_occupation[e]) {
+ cout << "RESULT_OCCUPIED_EDGE " << ea[e] << " " << eb[e] << endl;
+ }
+ }
+
+ delete[] edge_occupation;
+ delete[] el;
+ delete[] ea;
+ delete[] eb;
+
+ } else {
+
+ cerr << "Can not open " << argv[1] << endl;
+
+ delete file;
+ exit(EXIT_FAILURE);
+
+ }
+
+ delete file;
+ exit(EXIT_SUCCESS);