X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=blobdiff_plain;f=tracker.cc;fp=tracker.cc;h=47460d371315a3dee43605853df00cf49ff69cd5;hb=598184c893e63ddd5b473aee104a9c2d1af07830;hp=3a311cd006246d6f01b3b358bd57a706aa964bb2;hpb=fda29b3422f4850d77e4b8f4916251509789d3ac;p=mtp.git diff --git a/tracker.cc b/tracker.cc index 3a311cd..47460d3 100644 --- a/tracker.cc +++ b/tracker.cc @@ -86,7 +86,7 @@ void Tracker::build_graph() { int nb_edges = _nb_locations * 2 + - _nb_time_steps * (nb_exits + nb_entrances) + + (_nb_time_steps - 2) * (nb_exits + nb_entrances) + (_nb_time_steps - 1) * nb_motions + _nb_locations * _nb_time_steps; @@ -137,7 +137,7 @@ void Tracker::build_graph() { } } - for(int t = 0; t < _nb_time_steps; t++) { + for(int t = 1; t < _nb_time_steps-1; t++) { for(int l = 0; l < _nb_locations; l++) { if(_entrances[l]) { node_from[e] = source; @@ -147,7 +147,7 @@ void Tracker::build_graph() { } if(_exits[l]) { node_from[e] = 1 + (2 * (t + 0) + 1) * _nb_locations + l; - node_from[e] = sink; + node_to[e] = sink; _edge_lengths[e] = 0.0; e++; } @@ -176,6 +176,15 @@ void Tracker::track() { _graph->find_best_paths(_edge_lengths); _graph->retrieve_disjoint_paths(); + + // for(int p = 0; p < _graph->nb_paths; p++) { + // Path *path = _graph->paths[p]; + // cout << "PATH " << p << " [length " << path->length << "] " << path->nodes[0]; + // for(int n = 1; n < path->length; n++) { + // cout << " -> " << path->nodes[n]; + // } + // cout << endl; + // } } int Tracker::nb_trajectories() {