Update.
[mtp.git] / mtp.cc
diff --git a/mtp.cc b/mtp.cc
index b400650..9fa61aa 100644 (file)
--- a/mtp.cc
+++ b/mtp.cc
@@ -22,7 +22,7 @@
 
 // EXAMPLE: ./mtp ./graph2.txt  | dot -T pdf -o- | xpdf -
 
-// #define VERBOSE
+#define VERBOSE
 
 #include <iostream>
 #include <fstream>
@@ -167,16 +167,21 @@ void Graph::find_shortest_path(Vertex **front, Vertex **new_front) {
   Vertex *v, *tv;
   scalar_t d;
 
-#ifdef DEBUG
+#ifdef VERBOSE
+  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 VERBOSE
+        residual_error -= e->work_length;
+#endif
+        e->work_length = 0.0;
       }
     }
   }
+#ifdef VERBOSE
+  cout << "residual_error " << residual_error << endl;
 #endif
 
   for(int v = 0; v < nb_vertices; v++) {