From: Francois Fleuret Date: Fri, 7 Sep 2012 09:45:06 +0000 (+0200) Subject: Added the stress test. Ignore disconnected nodes when checking the residual error. X-Git-Url: https://www.fleuret.org/cgi-bin/gitweb/gitweb.cgi?p=mtp.git;a=commitdiff_plain;h=eded836910fd54dcc621cea82c758761f0e636f9 Added the stress test. Ignore disconnected nodes when checking the residual error. --- 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; }