- // Puts two target with the typical local minimum (i.e. the optimal
- // single path would track the first target on the first half and
- // the second on the second half, while the optimal two paths would
- // each follow one of the target properly)
-
- // for(int t = 0; t < nb_time_steps; t++) {
- // int a = nb_time_steps/2 - abs(t - nb_time_steps/2);
- // int b = nb_locations - 1 - a;
- // if(a > nb_locations/2 - 1) a = nb_locations/2 - 1;
- // if(b < nb_locations/2 + 1) b = nb_locations/2 + 1;
- // if(t < nb_time_steps/2) {
- // tracker->detection_score[t][a] = 10.0;
- // tracker->detection_score[t][b] = 1.0;
- // } else {
- // tracker->detection_score[t][a] = 1.0;
- // tracker->detection_score[t][b] = 10.0;
- // }
- // }
-
- tracker->track();
-
- for(int t = 0; t < tracker->nb_trajectories(); t++) {
- cout << "TRAJECTORY "
- << t
- << " [starting " << tracker->trajectory_entrance_time(t)
- << ", score " << tracker->trajectory_score(t) << "]";
- for(int u = 0; u < tracker->trajectory_duration(t); u++) {
- cout << " " << tracker->trajectory_location(t, u);
- }
- cout << endl;
- }
+ cout << "Building the graph ... "; cout.flush();
+ gettimeofday(&start_time, 0);
+ tracker->build_graph();
+ gettimeofday(&end_time, 0);
+ cout << "done (" << diff_in_second(&start_time, &end_time) << "s)." << endl;
+
+ cout << "Tracking ... "; cout.flush();
+ gettimeofday(&start_time, 0);
+ tracker->track();
+ gettimeofday(&end_time, 0);
+ cout << "done (" << diff_in_second(&start_time, &end_time) << "s)." << endl;
+
+ ofstream out_traj("result.trj");
+ tracker->write_trajectories(&out_traj);
+ cout << "Wrote result.trj" << endl;
+
+ ofstream out_dot("graph.dot");
+ tracker->print_graph_dot(&out_dot);
+ cout << "Wrote graph.dot" << endl;
+
+ delete tracker;
+
+ } else {
+
+ cerr << "Can not open " << argv[1] << endl;
+ exit(EXIT_FAILURE);