Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Move the surf::As* classes into their own files
[simgrid.git] / src / surf / maxmin.cpp
index 7d48a90..978745f 100644 (file)
@@ -35,7 +35,7 @@ static int Global_debug_id = 1;
 static int Global_const_debug_id = 1;
 
 static void lmm_var_free(lmm_system_t sys, lmm_variable_t var);
-static XBT_INLINE void lmm_cnst_free(lmm_system_t sys,
+static inline void lmm_cnst_free(lmm_system_t sys,
                                      lmm_constraint_t cnst);
 
 static void lmm_on_disabled_var(lmm_system_t sys, lmm_constraint_t cnstr);
@@ -120,9 +120,7 @@ void lmm_system_free(lmm_system_t sys)
 
   
   while ((var = (lmm_variable_t) extract_variable(sys))) {
-    XBT_WARN
-        ("Variable %p (%d) still in  system when freing it: this may be a bug",
-         var, var->id_int);
+    XBT_WARN("Variable %d still in system when freing it: this may be a bug", var->id_int);
     lmm_var_free(sys, var);
   }
 
@@ -133,7 +131,7 @@ void lmm_system_free(lmm_system_t sys)
   free(sys);
 }
 
-static XBT_INLINE void lmm_variable_remove(lmm_system_t sys, lmm_variable_t var)
+static inline void lmm_variable_remove(lmm_system_t sys, lmm_variable_t var)
 {
   int i;
   int nelements;
@@ -185,7 +183,7 @@ static void lmm_var_free(lmm_system_t sys, lmm_variable_t var)
   xbt_mallocator_release(sys->variable_mallocator, var);
 }
 
-static XBT_INLINE void lmm_cnst_free(lmm_system_t sys,
+static inline void lmm_cnst_free(lmm_system_t sys,
                                      lmm_constraint_t cnst)
 {
   make_constraint_inactive(sys, cnst);
@@ -258,7 +256,7 @@ int lmm_constraint_sharing_policy(lmm_constraint_t cnst)
  * Apparently, this call was designed assuming that constraint would no more have elements in it. 
  * If this is not the case, assertion will fail, and you need to add calls e.g. to lmm_shrink before effectively removing it.
  */
-XBT_INLINE void lmm_constraint_free(lmm_system_t sys,
+inline void lmm_constraint_free(lmm_system_t sys,
                                     lmm_constraint_t cnst)
 {
   xbt_assert(!xbt_swag_size(&(cnst->active_element_set)),"Removing constraint but it still has active elements");
@@ -612,7 +610,7 @@ void *lmm_variable_id(lmm_variable_t var)
   return var->id;
 }
 
-static XBT_INLINE void saturated_constraint_set_update(double usage,
+static inline void saturated_constraint_set_update(double usage,
                                                       int cnst_light_num,
                                                       dyn_light_t saturated_constraint_set,
                                                       double *min_usage)
@@ -634,7 +632,7 @@ static XBT_INLINE void saturated_constraint_set_update(double usage,
   }
 }
 
-static XBT_INLINE void saturated_variable_set_update(
+static inline void saturated_variable_set_update(
     s_lmm_constraint_light_t *cnst_light_tab,
     dyn_light_t saturated_constraint_set,
     lmm_system_t sys)
@@ -751,9 +749,12 @@ void lmm_print(lmm_system_t sys)
     }
     XBT_DEBUG("%s", trace_buf);
     trace_buf[0] = '\000';
-    xbt_assert(!double_positive(sum - cnst->bound, cnst->bound*sg_maxmin_precision),
-                "Incorrect value (%f is not smaller than %f): %g",
-                sum, cnst->bound, sum - cnst->bound);
+       xbt_assert(!double_positive(sum - cnst->bound, cnst->bound*sg_maxmin_precision),
+               "Incorrect value (%f is not smaller than %f): %g",
+                 sum, cnst->bound, sum - cnst->bound);
+       //if(double_positive(sum - cnst->bound, cnst->bound*sg_maxmin_precision))
+       //XBT_ERROR("Incorrect value (%f is not smaller than %f): %g",sum, cnst->bound, sum - cnst->bound);
+      
   }
 
   XBT_DEBUG("Variables");
@@ -841,7 +842,7 @@ void lmm_solve(lmm_system_t sys)
           sys->keep_track->push_back(*action);
       }
     }
-    XBT_DEBUG("Constraint '%d' usage: %f remaining: %f ", cnst->id_int, cnst->usage, cnst->remaining);
+    XBT_DEBUG("Constraint '%d' usage: %f remaining: %f concurrency: %i<=%i<=%i", cnst->id_int, cnst->usage, cnst->remaining,cnst->concurrency_current,cnst->concurrency_maximum,cnst->concurrency_limit);
     /* Saturated constraints update */
 
     if(cnst->usage > 0) {
@@ -891,7 +892,8 @@ void lmm_solve(lmm_system_t sys)
       if (min_bound < 0) {
   //If no variable could reach its bound, deal iteratively the constraints usage ( at worst one constraint is saturated at each cycle) 
         var->value = min_usage / var->weight;
-        XBT_DEBUG("Setting %p (%d) value to %f\n", var, var->id_int, var->value);
+       // XBT_DEBUG("Setting %p (%d) value to %f\n", var, var->id_int, var->value);
+        XBT_DEBUG("Setting var (%d) value to %f\n", var->id_int, var->value);
       } else {
   //If there exist a variable that can reach its bound, only update it (and other with the same bound) for now.
       if (double_equals(min_bound, var->bound*var->weight, sg_maxmin_precision)){
@@ -921,8 +923,10 @@ void lmm_solve(lmm_system_t sys)
           if(!double_positive(cnst->usage,sg_maxmin_precision) || !double_positive(cnst->remaining,cnst->bound*sg_maxmin_precision)) {
             if (cnst->cnst_light) {
               int index = (cnst->cnst_light-cnst_light_tab);
-              XBT_DEBUG("index: %d \t cnst_light_num: %d \t || \t cnst: %p \t cnst->cnst_light: %p \t cnst_light_tab: %p usage: %f remaining: %f bound: %f  ",
-      index,cnst_light_num, cnst, cnst->cnst_light, cnst_light_tab, cnst->usage, cnst->remaining, cnst->bound);
+              XBT_DEBUG("index: %d \t cnst_light_num: %d \t || usage: %f remaining: %f bound: %f  ",
+             index,cnst_light_num, cnst->usage, cnst->remaining, cnst->bound);
+             //              XBT_DEBUG("index: %d \t cnst_light_num: %d \t || \t cnst: %p \t cnst->cnst_light: %p \t cnst_light_tab: %p usage: %f remaining: %f bound: %f  ",
+             //index,cnst_light_num, cnst, cnst->cnst_light, cnst_light_tab, cnst->usage, cnst->remaining, cnst->bound);
               cnst_light_tab[index]=cnst_light_tab[cnst_light_num-1];
               cnst_light_tab[index].cnst->cnst_light = &cnst_light_tab[index];
               cnst_light_num--;
@@ -1236,13 +1240,13 @@ int lmm_constraint_used(lmm_system_t sys, lmm_constraint_t cnst)
   return xbt_swag_belongs(cnst, &(sys->active_constraint_set));
 }
 
-XBT_INLINE lmm_constraint_t lmm_get_first_active_constraint(lmm_system_t
+inline lmm_constraint_t lmm_get_first_active_constraint(lmm_system_t
                                                             sys)
 {
   return (lmm_constraint_t)xbt_swag_getFirst(&(sys->active_constraint_set));
 }
 
-XBT_INLINE lmm_constraint_t lmm_get_next_active_constraint(lmm_system_t
+inline lmm_constraint_t lmm_get_next_active_constraint(lmm_system_t
                                                            sys,
                                                            lmm_constraint_t
                                                            cnst)
@@ -1250,14 +1254,6 @@ XBT_INLINE lmm_constraint_t lmm_get_next_active_constraint(lmm_system_t
   return (lmm_constraint_t)xbt_swag_getNext(cnst, (sys->active_constraint_set).offset);
 }
 
-#ifdef HAVE_LATENCY_BOUND_TRACKING
-XBT_PUBLIC(int) lmm_is_variable_limited_by_latency(lmm_variable_t var)
-{
-  return (double_equals(var->bound, var->value, var->bound*sg_maxmin_precision));
-}
-#endif
-
-
 /** \brief Update the constraint set propagating recursively to
  *  other constraints so the system should not be entirely computed.
  *