From: Francois Fleuret Date: Wed, 22 Aug 2012 05:19:07 +0000 (-0700) Subject: Cosmetics. X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=commitdiff_plain;h=468580db238e44d27dcc91f6313511bf9a054c81;p=mtp.git Cosmetics. --- diff --git a/mtp.cc b/mtp.cc index e330ce3..044fefa 100644 --- a/mtp.cc +++ b/mtp.cc @@ -49,8 +49,8 @@ void find_best_paths(int nb_vertices, ////////////////////////////////////////////////////////////////////// int main(int argc, char **argv) { - int nb_locations = 4; - int nb_time_steps = 3; + int nb_locations = 6; + int nb_time_steps = 5; { Tracker tracker(nb_time_steps, nb_locations); @@ -64,10 +64,10 @@ int main(int argc, char **argv) { for(int t = 0; t < nb_time_steps; t++) { for(int l = 0; l < nb_locations; l++) { tracker.set_detection_score(t, l, - (drand48() < 0.95 ? -1.0 : 1.0) + drand48() * 0.1 - 0.05); + (drand48() < 0.9 ? -1.0 : 1.0) + drand48() * 0.1 - 0.05); } tracker.set_detection_score(t, 0, - (drand48() < 0.95 ? 1.0 : -1.0) + drand48() * 0.1 - 0.05); + (drand48() < 0.9 ? 1.0 : -1.0) + drand48() * 0.1 - 0.05); } tracker.build_graph(); diff --git a/mtp_graph.cc b/mtp_graph.cc index c2a7fa3..c7e6b98 100644 --- a/mtp_graph.cc +++ b/mtp_graph.cc @@ -84,15 +84,6 @@ void MTPGraph::print_dot() { cout << "}" << endl; } - -void dot_print(int nb_vertices, - int nb_edges, int *ea, int *eb, scalar_t *el, - int _source, int _sink, - int *edge_occupation) { - for(int e = 0; e < nb_edges; e++) { - } - cout << "}" << endl; -} MTPGraph::MTPGraph(int nb_vertices, int nb_edges, int *from, int *to, int src, int snk) { @@ -101,6 +92,8 @@ MTPGraph::MTPGraph(int nb_vertices, int nb_edges, edges = new Edge[_nb_edges]; vertices = new Vertex[_nb_vertices]; + _front = new Vertex *[_nb_vertices]; + _new_front = new Vertex *[_nb_vertices]; _source = &vertices[src]; _sink = &vertices[snk]; @@ -116,8 +109,6 @@ MTPGraph::MTPGraph(int nb_vertices, int nb_edges, edges[e].terminal_vertex = &vertices[to[e]]; } - _front = new Vertex *[_nb_vertices]; - _new_front = new Vertex *[_nb_vertices]; } MTPGraph::~MTPGraph() { @@ -141,7 +132,7 @@ void MTPGraph::initialize_work_lengths() { } } -void MTPGraph::update_work_length() { +void MTPGraph::update_work_lengths() { for(int n = 0; n < _nb_vertices; n++) { scalar_t d = vertices[n].distance_from_source; for(Edge *e = vertices[n].root_edge; e; e = e->next) { @@ -228,7 +219,7 @@ void MTPGraph::find_best_paths(scalar_t *lengths, int *result_edge_occupation) { do { total_length = 0.0; find_shortest_path(_front, _new_front); - update_work_length(); + update_work_lengths(); // Do we reach the _sink? if(_sink->pred_edge) { diff --git a/mtp_graph.h b/mtp_graph.h index 699ee16..75e48ee 100644 --- a/mtp_graph.h +++ b/mtp_graph.h @@ -26,7 +26,7 @@ class Edge; class MTPGraph { void initialize_work_lengths(); - void update_work_length(); + void update_work_lengths(); void find_shortest_path(Vertex **front, Vertex **new_front); int _nb_vertices, _nb_edges;