Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Make func_f/fp/fpi static methods of lmm::Lagrange.
[simgrid.git] / src / kernel / lmm / maxmin.cpp
index c3b1668..0b27a67 100644 (file)
@@ -33,6 +33,11 @@ typedef std::vector<int> dyn_light_t;
 int Variable::Global_debug_id   = 1;
 int Constraint::Global_debug_id = 1;
 
+System* make_new_maxmin_system(bool selective_update)
+{
+  return new System(selective_update);
+}
+
 int Element::get_concurrency() const
 {
   // Ignore element with weight less than one (e.g. cross-traffic)
@@ -152,7 +157,6 @@ System::System(bool selective_update) : selective_update_active(selective_update
 
   variable_mallocator =
       xbt_mallocator_new(65536, System::variable_mallocator_new_f, System::variable_mallocator_free_f, nullptr);
-  solve_fun = &lmm_solve;
 }
 
 System::~System()
@@ -486,7 +490,7 @@ void System::print() const
   }
 }
 
-void System::solve()
+void System::lmm_solve()
 {
   if (modified) {
     XBT_IN("(sys=%p)", this);
@@ -494,14 +498,14 @@ void System::solve()
      * constraints that changed are considered. Otherwise all constraints with active actions are considered.
      */
     if (selective_update_active)
-      solve(modified_constraint_set);
+      lmm_solve(modified_constraint_set);
     else
-      solve(active_constraint_set);
+      lmm_solve(active_constraint_set);
     XBT_OUT();
   }
 }
 
-template <class CnstList> void System::solve(CnstList& cnst_list)
+template <class CnstList> void System::lmm_solve(CnstList& cnst_list)
 {
   double min_usage = -1;
   double min_bound = -1;
@@ -536,7 +540,7 @@ template <class CnstList> void System::solve(CnstList& cnst_list)
 
         elem.make_active();
         simgrid::kernel::resource::Action* action = static_cast<simgrid::kernel::resource::Action*>(elem.variable->id);
-        if (modified_set_ && not action->isLinkedModifiedSet())
+        if (modified_set_ && not action->is_within_modified_set())
           modified_set_->push_back(*action);
       }
     }
@@ -690,11 +694,6 @@ template <class CnstList> void System::solve(CnstList& cnst_list)
   delete[] cnst_light_tab;
 }
 
-void lmm_solve(System* sys)
-{
-  sys->solve();
-}
-
 /** \brief Attribute the value bound to var->bound.
  *
  *  \param var the Variable*
@@ -726,9 +725,6 @@ void Variable::initialize(simgrid::kernel::resource::Action* id_value, double sh
   visited           = visited_value;
   mu                = 0.0;
   new_mu            = 0.0;
-  func_f            = func_f_def;
-  func_fp           = func_fp_def;
-  func_fpi          = func_fpi_def;
 
   xbt_assert(not variable_set_hook.is_linked());
   xbt_assert(not saturated_variable_set_hook.is_linked());
@@ -817,12 +813,12 @@ void System::on_disabled_var(Constraint* cnstr)
   if (not numelem)
     return;
 
-  lmm_element_t elem = &cnstr->disabled_element_set.front();
+  Element* elem = &cnstr->disabled_element_set.front();
 
   // Cannot use foreach loop, because System::enable_var() will modify disabled_element_set.. within the loop
   while (numelem-- && elem) {
 
-    lmm_element_t nextelem;
+    Element* nextelem;
     if (elem->disabled_element_set_hook.is_linked()) {
       auto iter = std::next(cnstr->disabled_element_set.iterator_to(*elem));
       nextelem  = iter != std::end(cnstr->disabled_element_set) ? &*iter : nullptr;