From: Francois Fleuret Date: Thu, 23 Aug 2012 15:07:36 +0000 (-0700) Subject: Cosmetics. X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=commitdiff_plain;h=924a2d8b5313d1bbe84515fc262db3c7e7d50355;p=mtp.git Cosmetics. --- diff --git a/tracker.cc b/tracker.cc index 37fbfe2..0e6ed6a 100644 --- a/tracker.cc +++ b/tracker.cc @@ -25,8 +25,10 @@ using namespace std; Tracker::Tracker(int nb_time_steps, int nb_locations) { _nb_locations = nb_locations; _nb_time_steps = nb_time_steps; + _detection_score = allocate_array(_nb_time_steps, _nb_locations); _allowed_motion = allocate_array(_nb_locations, _nb_locations); + _entrances = new int[_nb_locations]; _exits = new int[_nb_locations]; @@ -38,6 +40,12 @@ Tracker::Tracker(int nb_time_steps, 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; } @@ -52,18 +60,24 @@ Tracker::~Tracker() { } 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; } @@ -107,7 +121,6 @@ void Tracker::build_graph() { } } - // 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; @@ -161,6 +174,12 @@ void Tracker::build_graph() { } 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); }