Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Df parameter of Low models is replaced by weight because it means the same to maxmin...
authorvelho <velho@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 16 Oct 2008 14:31:54 +0000 (14:31 +0000)
committervelho <velho@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 16 Oct 2008 14:31:54 +0000 (14:31 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@5994 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/include/surf/maxmin.h
src/surf/lagrange.c
src/surf/maxmin.c
src/surf/maxmin_private.h
src/surf/network.c
testsuite/surf/lmm_usage.c

index d4356ac..240ad93 100644 (file)
@@ -72,11 +72,6 @@ void lmm_update_variable_bound(lmm_system_t sys, lmm_variable_t var,
                               double bound);
 
 
                               double bound);
 
 
-XBT_PUBLIC(void) lmm_update_variable_latency(lmm_system_t sys, lmm_variable_t var,
-                                double delta);
-
-
-
 XBT_PUBLIC(void) lmm_update_variable_weight(lmm_system_t sys, lmm_variable_t var,
                                double weight);
 double lmm_get_variable_weight(lmm_variable_t var);
 XBT_PUBLIC(void) lmm_update_variable_weight(lmm_system_t sys, lmm_variable_t var,
                                double weight);
 double lmm_get_variable_weight(lmm_variable_t var);
index 479a91a..a9a1535 100644 (file)
@@ -101,7 +101,7 @@ static double new_value(lmm_variable_t var)
   }
   if (var->bound > 0)
     tmp += var->mu;
   }
   if (var->bound > 0)
     tmp += var->mu;
-  DEBUG3("\t Working on var (%p). cost = %e; Df = %e", var, tmp, var->df);
+  DEBUG3("\t Working on var (%p). cost = %e; Weight = %e", var, tmp, var->weight);
   //uses the partial differential inverse function
   return var->func_fpi(var, tmp);
 }
   //uses the partial differential inverse function
   return var->func_fpi(var, tmp);
 }
@@ -229,7 +229,7 @@ void lagrange_solve(lmm_system_t sys)
        var->new_mu = 2.0;
        var->value = new_value(var);
       }
        var->new_mu = 2.0;
        var->value = new_value(var);
       }
-      DEBUG2("#### var(%p) ->df :  %e", var, var->df);
+      DEBUG2("#### var(%p) ->weight :  %e", var, var->weight);
       DEBUG2("#### var(%p) ->mu :  %e", var, var->mu);
       DEBUG2("#### var(%p) ->weight: %e", var, var->weight);
       DEBUG2("#### var(%p) ->bound: %e", var, var->bound);
       DEBUG2("#### var(%p) ->mu :  %e", var, var->mu);
       DEBUG2("#### var(%p) ->weight: %e", var, var->weight);
       DEBUG2("#### var(%p) ->bound: %e", var, var->bound);
@@ -559,19 +559,19 @@ lmm_set_default_protocol_function(double (*func_f)
 double func_vegas_f(lmm_variable_t var, double x)
 {
   xbt_assert1(x > 0.0, "Don't call me with stupid values! (%1.20f)", x);
 double func_vegas_f(lmm_variable_t var, double x)
 {
   xbt_assert1(x > 0.0, "Don't call me with stupid values! (%1.20f)", x);
-  return VEGAS_SCALING * var->df * log(x);
+  return VEGAS_SCALING * var->weight * log(x);
 }
 
 double func_vegas_fp(lmm_variable_t var, double x)
 {
   xbt_assert1(x > 0.0, "Don't call me with stupid values! (%1.20f)", x);
 }
 
 double func_vegas_fp(lmm_variable_t var, double x)
 {
   xbt_assert1(x > 0.0, "Don't call me with stupid values! (%1.20f)", x);
-  return VEGAS_SCALING * var->df / x;
+  return VEGAS_SCALING * var->weight / x;
 }
 
 double func_vegas_fpi(lmm_variable_t var, double x)
 {
   xbt_assert1(x > 0.0, "Don't call me with stupid values! (%1.20f)", x);
 }
 
 double func_vegas_fpi(lmm_variable_t var, double x)
 {
   xbt_assert1(x > 0.0, "Don't call me with stupid values! (%1.20f)", x);
-  return var->df / (x / VEGAS_SCALING);
+  return var->weight / (x / VEGAS_SCALING);
 }
 
 /*
 }
 
 /*
@@ -582,27 +582,27 @@ double func_vegas_fpi(lmm_variable_t var, double x)
 #define RENO_SCALING 1.0
 double func_reno_f(lmm_variable_t var, double x)
 {
 #define RENO_SCALING 1.0
 double func_reno_f(lmm_variable_t var, double x)
 {
-  xbt_assert0(var->df > 0.0, "Don't call me with stupid values!");
+  xbt_assert0(var->weight > 0.0, "Don't call me with stupid values!");
 
 
-  return RENO_SCALING * sqrt(3.0 / 2.0) / var->df * atan(sqrt(3.0 / 2.0) *
-                                                        var->df * x);
+  return RENO_SCALING * sqrt(3.0 / 2.0) / var->weight * atan(sqrt(3.0 / 2.0) *
+                                                        var->weight * x);
 }
 
 double func_reno_fp(lmm_variable_t var, double x)
 {
 }
 
 double func_reno_fp(lmm_variable_t var, double x)
 {
-  return RENO_SCALING * 3.0 / (3.0 * var->df * var->df * x * x + 2.0);
+  return RENO_SCALING * 3.0 / (3.0 * var->weight * var->weight * x * x + 2.0);
 }
 
 double func_reno_fpi(lmm_variable_t var, double x)
 {
   double res_fpi;
 
 }
 
 double func_reno_fpi(lmm_variable_t var, double x)
 {
   double res_fpi;
 
-  xbt_assert0(var->df > 0.0, "Don't call me with stupid values!");
+  xbt_assert0(var->weight > 0.0, "Don't call me with stupid values!");
   xbt_assert0(x > 0.0, "Don't call me with stupid values!");
 
   res_fpi =
   xbt_assert0(x > 0.0, "Don't call me with stupid values!");
 
   res_fpi =
-      1.0 / (var->df * var->df * (x / RENO_SCALING)) -
-      2.0 / (3.0 * var->df * var->df);
+      1.0 / (var->weight * var->weight * (x / RENO_SCALING)) -
+      2.0 / (3.0 * var->weight * var->weight);
   if (res_fpi <= 0.0)
     return 0.0;
 /*   xbt_assert0(res_fpi>0.0,"Don't call me with stupid values!"); */
   if (res_fpi <= 0.0)
     return 0.0;
 /*   xbt_assert0(res_fpi>0.0,"Don't call me with stupid values!"); */
@@ -612,19 +612,19 @@ double func_reno_fpi(lmm_variable_t var, double x)
 
 /* Implementing new Reno-2
  * For Reno-2:  $f(x)   = U_f(x_f) = \frac{{2}{D_f}}*ln(2+x*D_f)$
 
 /* Implementing new Reno-2
  * For Reno-2:  $f(x)   = U_f(x_f) = \frac{{2}{D_f}}*ln(2+x*D_f)$
- * Therefore:   $fp(x)  = 2/(Df*x + 2)
- * Therefore:   $fpi(x) = (2*Df)/x - 4
+ * Therefore:   $fp(x)  = 2/(Weight*x + 2)
+ * Therefore:   $fpi(x) = (2*Weight)/x - 4
  */
 #define RENO2_SCALING 1.0
 double func_reno2_f(lmm_variable_t var, double x)
 {
  */
 #define RENO2_SCALING 1.0
 double func_reno2_f(lmm_variable_t var, double x)
 {
-  xbt_assert0(var->df > 0.0, "Don't call me with stupid values!");
-  return RENO2_SCALING * (1.0/var->df) * log((x*var->df)/(2.0*x*var->df+3.0));
+  xbt_assert0(var->weight > 0.0, "Don't call me with stupid values!");
+  return RENO2_SCALING * (1.0/var->weight) * log((x*var->weight)/(2.0*x*var->weight+3.0));
 }
 
 double func_reno2_fp(lmm_variable_t var, double x)
 {
 }
 
 double func_reno2_fp(lmm_variable_t var, double x)
 {
-  return RENO2_SCALING * 3.0/(var->df*x*(2.0*var->df*x+3.0));
+  return RENO2_SCALING * 3.0/(var->weight*x*(2.0*var->weight*x+3.0));
 }
 
 double func_reno2_fpi(lmm_variable_t var, double x)
 }
 
 double func_reno2_fpi(lmm_variable_t var, double x)
@@ -633,7 +633,7 @@ double func_reno2_fpi(lmm_variable_t var, double x)
   double tmp;
 
   xbt_assert0(x > 0.0, "Don't call me with stupid values!");
   double tmp;
 
   xbt_assert0(x > 0.0, "Don't call me with stupid values!");
-  tmp= x*var->df*var->df;
+  tmp= x*var->weight*var->weight;
   res_fpi= tmp*(9.0*x+24.0);
   
   if (res_fpi <= 0.0)
   res_fpi= tmp*(9.0*x+24.0);
   
   if (res_fpi <= 0.0)
index 250e3e7..08109bd 100644 (file)
@@ -183,7 +183,7 @@ lmm_variable_t lmm_variable_new(lmm_system_t sys, void *id,
   var->weight = weight;
   var->bound = bound;
   var->value = 0.0;
   var->weight = weight;
   var->bound = bound;
   var->value = 0.0;
-  var->df = 0.0;
+
 
   var->func_f = func_f_def;
   var->func_fp = func_fp_def;
 
   var->func_f = func_f_def;
   var->func_fp = func_fp_def;
@@ -607,24 +607,6 @@ void lmm_update_variable_bound(lmm_system_t sys, lmm_variable_t var,
   var->bound = bound;
 }
 
   var->bound = bound;
 }
 
-/** \brief Add the value delta to var->df (the sum of latencies).
- * 
- *  \param sys the lmm_system_t associated
- *  \param var the lmm_variable_t which need to updated
- *  \param delta the variation of the latency
- * 
- *  Add the value delta to var->df (the sum of latencys associated to the
- *  flow). Whenever this function is called a change is  signed in the system. To
- *  avoid false system changing detection it is a good idea to test 
- *  (delta != 0) before calling it.
- *
- */
-void lmm_update_variable_latency(lmm_system_t sys, lmm_variable_t var,
-                                double delta)
-{
-  sys->modified = 1;
-  var->df += delta;
-}
 
 void lmm_update_variable_weight(lmm_system_t sys, lmm_variable_t var,
                                double weight)
 
 void lmm_update_variable_weight(lmm_system_t sys, lmm_variable_t var,
                                double weight)
index cfdf61b..0049b7f 100644 (file)
@@ -57,7 +57,6 @@ typedef struct lmm_variable {
   /* \begin{For Lagrange only} */
   double mu;
   double new_mu;
   /* \begin{For Lagrange only} */
   double mu;
   double new_mu;
-  double df; /* Total delay of flow */
   double (* func_f)  (struct lmm_variable *var, double x);  /* (f)    */
   double (* func_fp)  (struct lmm_variable *var, double x);  /* (f')    */
   double (* func_fpi)  (struct lmm_variable *var, double x);  /* (f')^{-1}    */
   double (* func_f)  (struct lmm_variable *var, double x);  /* (f)    */
   double (* func_fp)  (struct lmm_variable *var, double x);  /* (f')    */
   double (* func_fpi)  (struct lmm_variable *var, double x);  /* (f')^{-1}    */
index 8555a3a..7acfc6f 100644 (file)
@@ -459,8 +459,7 @@ static void update_resource_state(void *id,
       if (!(action->suspended))
        lmm_update_variable_weight(network_maxmin_system, action->variable,
                                   action->lat_current);
       if (!(action->suspended))
        lmm_update_variable_weight(network_maxmin_system, action->variable,
                                   action->lat_current);
-      lmm_update_variable_latency(network_maxmin_system, action->variable,
-                                 delta);
+
     }
   } else if (event_type == nw_link->state_event) {
     if (value > 0)
     }
   } else if (event_type == nw_link->state_event) {
     if (value > 0)
@@ -573,8 +572,6 @@ static surf_action_t communicate(void *src, void *dst, double size,
       lmm_update_variable_bound(network_maxmin_system, action->variable,
                                action->rate);
   }
       lmm_update_variable_bound(network_maxmin_system, action->variable,
                                action->rate);
   }
-  lmm_update_variable_latency(network_maxmin_system, action->variable,
-                             action->latency);
 
   for (i = 0; i < route_size; i++)
     lmm_expand(network_maxmin_system, route[i]->constraint,
 
   for (i = 0; i < route_size; i++)
     lmm_expand(network_maxmin_system, route[i]->constraint,
index c44fe71..3b534d9 100644 (file)
@@ -134,10 +134,10 @@ void test1(method_t method)
   R_2 = lmm_variable_new(Sys, (void *) "R 2", 1.0, -1.0, 1);
   R_3 = lmm_variable_new(Sys, (void *) "R 3", 1.0, -1.0, 1);
 
   R_2 = lmm_variable_new(Sys, (void *) "R 2", 1.0, -1.0, 1);
   R_3 = lmm_variable_new(Sys, (void *) "R 3", 1.0, -1.0, 1);
 
-  lmm_update_variable_latency(Sys, R_1_2_3, 1.0);
-  lmm_update_variable_latency(Sys, R_1, 1.0);
-  lmm_update_variable_latency(Sys, R_2, 1.0);
-  lmm_update_variable_latency(Sys, R_3, 1.0);
+  lmm_update_variable_weight(Sys, R_1_2_3, 1.0);
+  lmm_update_variable_weight(Sys, R_1, 1.0);
+  lmm_update_variable_weight(Sys, R_2, 1.0);
+  lmm_update_variable_weight(Sys, R_3, 1.0);
 
   lmm_expand(Sys, L1, R_1_2_3, 1.0);
   lmm_expand(Sys, L2, R_1_2_3, 1.0);
 
   lmm_expand(Sys, L1, R_1_2_3, 1.0);
   lmm_expand(Sys, L2, R_1_2_3, 1.0);
@@ -263,8 +263,8 @@ void test2(method_t method)
   T1 = lmm_variable_new(Sys, (void *) "T1", 1.0, -1.0, 1);
   T2 = lmm_variable_new(Sys, (void *) "T2", 1.0, -1.0, 1);
 
   T1 = lmm_variable_new(Sys, (void *) "T1", 1.0, -1.0, 1);
   T2 = lmm_variable_new(Sys, (void *) "T2", 1.0, -1.0, 1);
 
-  lmm_update_variable_latency(Sys, T1, 1.0);
-  lmm_update_variable_latency(Sys, T2, 1.0);
+  lmm_update_variable_weight(Sys, T1, 1.0);
+  lmm_update_variable_weight(Sys, T2, 1.0);
 
 
   lmm_expand(Sys, CPU1, T1, 1.0);
 
 
   lmm_expand(Sys, CPU1, T1, 1.0);
@@ -432,7 +432,7 @@ void test3(method_t method)
     tmp_name[i + j] = bprintf("X_%03d", j);
     tmp_var[j] =
        lmm_variable_new(Sys, (void *) tmp_name[i + j], 1.0, -1.0, 15);
     tmp_name[i + j] = bprintf("X_%03d", j);
     tmp_var[j] =
        lmm_variable_new(Sys, (void *) tmp_name[i + j], 1.0, -1.0, 15);
-    lmm_update_variable_latency(Sys, tmp_var[j], 1.0);
+    lmm_update_variable_weight(Sys, tmp_var[j], 1.0);
   }
 
   /*
   }
 
   /*