- for(int t = 0; t < nb_time_steps; t++) {
- for(int l = 0; l < nb_locations; l++) {
- tracker->set_detection_score(t, l,
- (drand48() < 0.95 ? -1.0 : 1.0) + drand48() * 0.1 - 0.05);
- }
- tracker->set_detection_score(t, nb_locations/2,
- (drand48() < 0.95 ? 1.0 : -1.0) + drand48() * 0.1 - 0.05);
- }
+ 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);
+ }
+
+ if(strcmp(graph_filename, "") != 0) {
+ ofstream out_dot(graph_filename);
+ tracker->print_graph_dot(&out_dot);
+ if(verbose) { cout << "Wrote " << graph_filename << "." << endl; }
+ }
+
+ delete tracker;
+}
+
+static struct option long_options[] = {
+ { "trajectory-file", 1, 0, 't' },
+ { "graph-file", 1, 0, 'g' },
+ { "help", no_argument, 0, 'h' },
+ { "verbose", no_argument, 0, 'v' },
+ { 0, 0, 0, 0 }
+};
+
+int main(int argc, char **argv) {
+ int c;
+ int error = 0, show_help = 0;
+
+ strncpy(trajectory_filename, "", FILENAME_SIZE);
+ strncpy(graph_filename, "", FILENAME_SIZE);
+ verbose = 0;
+
+ while ((c = getopt_long(argc, argv, "t:g:hv",
+ long_options, NULL)) != -1) {
+
+ switch(c) {
+
+ case 't':
+ strncpy(trajectory_filename, optarg, FILENAME_SIZE);
+ break;
+
+ case 'g':
+ strncpy(graph_filename, optarg, FILENAME_SIZE);
+ break;