X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=blobdiff_plain;f=mtp.cc;h=88e65571f0aa2baa85f221336cb60eb5fe993cf8;hb=602e16c62c2663af64854b758645f8d419a6c5a3;hp=b4006503dac3e37d760666a03c15ab0bc9cdd749;hpb=3fe1f714514a55322e22717eeddf76f9f019c658;p=mtp.git diff --git a/mtp.cc b/mtp.cc index b400650..88e6557 100644 --- a/mtp.cc +++ b/mtp.cc @@ -22,7 +22,7 @@ // EXAMPLE: ./mtp ./graph2.txt | dot -T pdf -o- | xpdf - -// #define VERBOSE +#define VERBOSE #include #include @@ -167,16 +167,25 @@ void Graph::find_shortest_path(Vertex **front, Vertex **new_front) { Vertex *v, *tv; scalar_t d; +#ifdef VERBOSE + cout << "find_shortest_path" << endl; +#endif + #ifdef DEBUG + scalar_t residual_error = 0.0; +#endif for(int n = 0; n < nb_vertices; n++) { for(Edge *e = vertices[n].root_edge; e; e = e->next) { if(e->work_length < 0) { - cerr << "DEBUG error in find_shortest_path: Edge work lengths have to be positive." - << endl; - abort(); +#ifdef DEBUG + residual_error -= e->work_length; +#endif + e->work_length = 0.0; } } } +#ifdef DEBUG + cout << "DEBUG residual_error " << residual_error << endl; #endif for(int v = 0; v < nb_vertices; v++) { @@ -327,10 +336,10 @@ int main(int argc, char **argv) { source, sink, result_edge_occupation); - dot_print(nb_vertices, nb_edges, - vertex_from, vertex_to, edge_lengths, - source, sink, - result_edge_occupation); + // dot_print(nb_vertices, nb_edges, + // vertex_from, vertex_to, edge_lengths, + // source, sink, + // result_edge_occupation); delete[] result_edge_occupation; delete[] edge_lengths;