-void Tracker::set_allowed_motion(int from_location, int to_location, int v) {
- _allowed_motion[from_location][to_location] = v;
+void Tracker::read(istream *is) {
+ int nb_locations, nb_time_steps;
+
+ (*is) >> nb_locations >> nb_time_steps;
+
+ allocate(nb_time_steps, nb_locations);
+
+ for(int l = 0; l < _nb_locations; l++) {
+ for(int m = 0; m < _nb_locations; m++) {
+ (*is) >> allowed_motion[l][m];
+ }
+ }
+
+ for(int l = 0; l < _nb_locations; l++) {
+ (*is) >> entrances[l];
+ }
+
+ for(int l = 0; l < _nb_locations; l++) {
+ (*is) >> exits[l];
+ }
+
+ for(int t = 0; t < _nb_time_steps; t++) {
+ for(int l = 0; l < _nb_locations; l++) {
+ (*is) >> detection_scores[t][l];
+ }
+ }
+}
+
+void Tracker::write_trajectories(ostream *os) {
+ for(int t = 0; t < nb_trajectories(); t++) {
+ (*os) << t
+ << " " << trajectory_entrance_time(t)
+ << " " << trajectory_duration(t)
+ << " " << trajectory_score(t);
+ for(int u = 0; u < trajectory_duration(t); u++) {
+ (*os) << " " << trajectory_location(t, u);
+ }
+ (*os) << endl;
+ }
+}
+
+Tracker::Tracker() {
+ _nb_locations = 0;
+ _nb_time_steps = 0;
+
+ detection_scores = 0;
+ allowed_motion = 0;
+
+ entrances = 0;
+ exits = 0;
+
+ _edge_lengths = 0;
+ _graph = 0;