3 * mtp is the ``Multi Tracked Paths'', an implementation of the
4 * k-shortest paths algorithm for multi-target tracking.
6 * Copyright (c) 2012 Idiap Research Institute, http://www.idiap.ch/
7 * Written by Francois Fleuret <francois.fleuret@idiap.ch>
9 * This file is part of mtp.
11 * mtp is free software: you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License version 3 as
13 * published by the Free Software Foundation.
15 * mtp is distributed in the hope that it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
17 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
18 * License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with selector. If not, see <http://www.gnu.org/licenses/>.
40 // Set the distance_from_source fields to the number of DP
41 // iterations needed to update it. Abort if the graph is not a DAG.
42 int compute_dp_ranks();
44 // Uses the estimated vertex distances to the source to make all the
45 // edge lengths positive, resulting in an identical added value to
46 // all the paths from the same initial node to the same final node
47 // (in particular from source to sink)
48 void update_positivized_lengths();
50 // It may happen that numerical errors in update_positivized_lengths
51 // make the resulting lengths negative, albeit very small. The
52 // following method forces all negative lengths to zero, and prints
53 // the total correction when compiled in VERBOSE mode.
54 void force_positivized_lengths();
56 // Visit the vertices according to _dp_order and update their
57 // distance from the source
58 void dp_compute_distances();
60 // Set in every vertex pred_edge_toward_source correspondingly to
61 // the path of shortest length. The current implementation is
62 // Dijkstra with a Binary Heap (and not with Fibonnaci heap (yet))
63 void find_shortest_path();
65 // Follows the path starting on edge e and returns the number of
66 // nodes to reach the sink. If path is non-null, stores in it the
67 // nodes met along the path, and computes path->length properly.
68 int retrieve_one_path(Edge *e, Path *path);
70 int _nb_vertices, _nb_edges;
71 Vertex *_source, *_sink;
80 // Updating the distances from the source in that order will work in
81 // the original graph (which has to be a DAG)
86 // These variables are filled when retrieve_disjoint_paths is called
90 MTPGraph(int nb_vertices, int nb_edges, int *vertex_from, int *vertex_to,
91 int source, int sink);
95 // Compute the family of paths with minimum total length, set the
96 // edge occupied fields accordingly.
97 void find_best_paths(scalar_t *lengths);
99 // Retrieve the paths corresponding to the occupied edges, and save
100 // the result in the nb_paths and paths fields.
101 void retrieve_disjoint_paths();
103 void print(ostream *os);
104 void print_dot(ostream *os);