From eded836910fd54dcc621cea82c758761f0e636f9 Mon Sep 17 00:00:00 2001 From: Francois Fleuret Date: Fri, 7 Sep 2012 11:45:06 +0200 Subject: [PATCH] Added the stress test. Ignore disconnected nodes when checking the residual error. --- Makefile | 11 +++++++++-- mtp_graph.cc | 15 +++++++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index aecad04..edb6eb6 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,7 @@ endif CXXFLAGS = -Wall $(OPTIMIZE_FLAG) $(PROFILE_FLAG) $(VERBOSE_FLAG) -all: mtp mtp_example +all: mtp mtp_example mtp_stress_test mtp: \ path.o \ @@ -57,10 +57,17 @@ mtp_example: \ mtp_example.o $(CXX) $(CXXFLAGS) -o $@ $^ $(LDFLAGS) +mtp_stress_test: \ + path.o \ + mtp_graph.o \ + mtp_tracker.o \ + mtp_stress_test.o + $(CXX) $(CXXFLAGS) -o $@ $^ $(LDFLAGS) + Makefile.depend: *.h *.cc Makefile $(CC) $(CXXFLAGS) -M *.cc > Makefile.depend clean: - \rm -f mtp mtp_example *.o Makefile.depend + \rm -f mtp mtp_example mtp_stress_test *.o Makefile.depend -include Makefile.depend diff --git a/mtp_graph.cc b/mtp_graph.cc index 2dd145d..ecbbab5 100644 --- a/mtp_graph.cc +++ b/mtp_graph.cc @@ -191,10 +191,21 @@ void MTPGraph::force_positivized_lengths() { #endif for(int k = 0; k < _nb_edges; k++) { Edge *e = _edges + k; + if(e->positivized_length < 0) { + #ifdef VERBOSE - residual_error -= e->positivized_length; - max_error = max(max_error, - e->positivized_length); + if((e->origin_vertex->last_change < 0 && e->terminal_vertex->last_change >= 0) || + (e->origin_vertex->last_change >= 0 && e->terminal_vertex->last_change < 0)) { + cout << "Inconsistent non-connexity (this should never happen)." << endl; + abort(); + } + if(e->origin_vertex->last_change >= 0 && + e->terminal_vertex->last_change >= 0 && + e->positivized_length < 0) { + residual_error -= e->positivized_length; + max_error = max(max_error, - e->positivized_length); + } #endif e->positivized_length = 0.0; } -- 2.39.5