Tracker::Tracker(int nb_time_steps, int nb_locations) {
_nb_locations = nb_locations;
_nb_time_steps = nb_time_steps;
+
_detection_score = allocate_array<scalar_t>(_nb_time_steps, _nb_locations);
_allowed_motion = allocate_array<int>(_nb_locations, _nb_locations);
+
_entrances = new int[_nb_locations];
_exits = new int[_nb_locations];
}
}
+ for(int t = 0; t < _nb_time_steps; t++) {
+ for(int l = 0; l < _nb_locations; l++) {
+ _detection_score[t][l] = 0.0;
+ }
+ }
+
_edge_lengths = 0;
_graph = 0;
}
}
void Tracker::set_allowed_motion(int from_location, int to_location, int v) {
+ ASSERT(from_location >= 0 && from_location < _nb_locations &&
+ to_location >= 0 && to_location < _nb_locations);
_allowed_motion[from_location][to_location] = v;
}
void Tracker::set_as_entrance(int location, int v) {
+ ASSERT(location >= 0 && location < _nb_locations);
_entrances[location] = v;
}
void Tracker::set_as_exit(int location, int v) {
+ ASSERT(location >= 0 && location < _nb_locations);
_exits[location] = v;
}
void Tracker::set_detection_score(int time, int location, scalar_t score) {
+ ASSERT(time >= 0 && time < _nb_time_steps &&
+ location >= 0 && location < _nb_locations);
_detection_score[time][location] = score;
}
}
}
- // We put the other edges after
for(int l = 0; l < _nb_locations; l++) {
node_from[e] = source;
node_to[e] = 1 + l + 0 * _nb_locations;
}
void Tracker::print_dot_graph(ostream *os) {
+ int e = 0;
+ for(int t = 0; t < _nb_time_steps; t++) {
+ for(int l = 0; l < _nb_locations; l++) {
+ _edge_lengths[e++] = - _detection_score[t][l];
+ }
+ }
_graph->print_dot(os);
}