From abf309725f0dd849c2321317e746c19a64efd3aa Mon Sep 17 00:00:00 2001
From: Oliver Sander <sander@igpm.rwth-aachen.de>
Date: Tue, 4 Sep 2007 08:47:15 +0000
Subject: [PATCH] look at relative decrease when trying to detect rounding
 problems

[[Imported from SVN: r1635]]
---
 src/rodsolver.cc | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/rodsolver.cc b/src/rodsolver.cc
index 5be307b4..de2f58ac 100644
--- a/src/rodsolver.cc
+++ b/src/rodsolver.cc
@@ -367,10 +367,13 @@ void RodSolver<GridType>::solve()
         hessianMatrix_->umv(corr, tmp);
         double modelDecrease = (rhs*corr) - 0.5 * (corr*tmp);
         
-        if (this->verbosity_ == FULL)
-            std::cout << "Model decrease: " << modelDecrease 
+        if (this->verbosity_ == FULL) {
+            std::cout << "Absolute model decrease: " << modelDecrease 
                       << ",  functional decrease: " << oldEnergy - energy << std::endl;
-        
+            std::cout << "Relative model decrease: " << modelDecrease / energy
+                      << ",  functional decrease: " << (oldEnergy - energy)/energy << std::endl;
+        }            
+
         assert(modelDecrease >= 0);
         
         if (energy >= oldEnergy) {
@@ -378,14 +381,16 @@ void RodSolver<GridType>::solve()
                 printf("Richtung ist keine Abstiegsrichtung!\n");
         }
 
-        if (std::abs(oldEnergy-energy) < 1e-12 || modelDecrease < 1e-10) {
+#if 1
+        if (std::abs(oldEnergy-energy)/energy < 1e-9 || modelDecrease/energy < 1e-9) {
             if (this->verbosity_ == FULL)
                 std::cout << "Suspecting rounding problems" << std::endl;
 
             if (this->verbosity_ != QUIET)
                 std::cout << i+1 << " trust-region steps were taken." << std::endl;
-            break;
+            //break;
         }
+#endif
 
         // //////////////////////////////////////////////
         //   Check for acceptance of the step
-- 
GitLab