Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Using relative error to approximate the values of lambda and mu.
authorvelho <velho@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 4 Jul 2007 15:05:47 +0000 (15:05 +0000)
committervelho <velho@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 4 Jul 2007 15:05:47 +0000 (15:05 +0000)
In other words: error = (new_value - old_value) / new_value.

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@3658 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/surf/lagrange.c

index af1b2f9..8190dfb 100644 (file)
@@ -41,7 +41,7 @@ void lagrange_solve(lmm_system_t sys)
    * Lagrange Variables.
    */
   int max_iterations= 10000;
-  double epsilon_min_error = 1e-4;
+  double epsilon_min_error  = 1e-4;
   double dicotomi_min_error = 1e-8;
   double overall_error = 1;
 
@@ -153,9 +153,9 @@ void lagrange_solve(lmm_system_t sys)
        //uses the partial differential inverse function
        tmp = var->func_fpi(var, tmp);
 
-       //computes de overall_error
-       if(overall_error < fabs(var->value - tmp)){
-         overall_error = fabs(var->value - tmp);
+       //computes de overall_error using normalized value
+       if(overall_error <  (fabs(var->value - tmp)/tmp) ){
+         overall_error = (fabs(var->value - tmp)/tmp);
        }
        
        var->value = tmp;