-void Graph::initialize_work_lengths() {
- scalar_t length_min = 0;
- for(int n = 0; n < nb_vertices; n++) {
- for(Edge *e = vertices[n].root_edge; e; e = e->next) {
- length_min = min(e->length, length_min);
- }
- }
- for(int n = 0; n < nb_vertices; n++) {
- for(Edge *e = vertices[n].root_edge; e; e = e->next) {
- e->work_length = e->length - length_min;
- }
- }
-}
-
-void Graph::update_work_length() {
- for(int n = 0; n < nb_vertices; n++) {
- scalar_t d = vertices[n].distance_from_source;
- for(Edge *e = vertices[n].root_edge; e; e = e->next) {
- e->work_length += d - e->terminal_vertex->distance_from_source;
- }
- }
-}
-
-void Graph::find_shortest_path(Vertex **front, Vertex **new_front) {
- Vertex **tmp_front;
- int tmp_front_size;
- Vertex *v, *tv;
- scalar_t d;
-
-#ifdef VERBOSE
- cout << "find_shortest_path" << endl;
-#endif
-
-#ifdef DEBUG
- scalar_t residual_error = 0.0;
-#endif
- for(int n = 0; n < nb_vertices; n++) {
- for(Edge *e = vertices[n].root_edge; e; e = e->next) {
- if(e->work_length < 0) {
-#ifdef DEBUG
- residual_error -= e->work_length;
-#endif
- e->work_length = 0.0;
- }
- }
+void do_tracking(istream *in_tracker) {
+ timeval start_time, end_time;
+ MTPTracker *tracker = new MTPTracker();
+
+ if(verbose) { cout << "Reading the tracking parameters." << endl; }
+ tracker->read(in_tracker);
+
+ if(verbose) { cout << "Building the graph ... "; cout.flush(); }
+ gettimeofday(&start_time, 0);
+ tracker->build_graph();
+ gettimeofday(&end_time, 0);
+ if(verbose) { cout << "done (" << diff_in_second(&start_time, &end_time) << "s)." << endl; }
+
+ if(verbose) { cout << "Tracking ... "; cout.flush(); }
+ gettimeofday(&start_time, 0);
+ tracker->track();
+ gettimeofday(&end_time, 0);
+ if(verbose) { cout << "done (" << diff_in_second(&start_time, &end_time) << "s)." << endl; }
+
+ if(strcmp(trajectory_filename, "")) {
+ ofstream out_traj(trajectory_filename);
+ tracker->write_trajectories(&out_traj);
+ if(verbose) { cout << "Wrote " << trajectory_filename << "." << endl; }
+ } else {
+ tracker->write_trajectories(&cout);