]> AND Public Git Repository - simgrid.git/blobdiff - src/kernel/lmm/maxmin.hpp
Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Drop simgrid::xbt::demangle and use boost::core::demangle instead.
[simgrid.git] / src / kernel / lmm / maxmin.hpp
index 4244c994d3f09a2beee87f709684340a2560f692..605bc1271012b45015d3cefa55d369e4a5ee7993 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2004-2019. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2004-2021. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -15,6 +15,7 @@
 #include <boost/intrusive/list.hpp>
 #include <cmath>
 #include <limits>
+#include <memory>
 #include <vector>
 
 namespace simgrid {
@@ -313,7 +314,7 @@ public:
   Constraint* get_constraint(unsigned num) const { return num < cnsts_.size() ? cnsts_[num].constraint : nullptr; }
 
   /**
-   * @brief Get the weigth of the numth constraint associated to the variable
+   * @brief Get the weight of the numth constraint associated to the variable
    * @param num The rank of constraint we want to get
    * @return The numth constraint
    */
@@ -337,7 +338,7 @@ public:
   /** @brief Check if a variable can be enabled
    * Make sure to set staged_penalty before, if your intent is only to check concurrency
    */
-  int can_enable() const { return staged_penalty_ > 0 && get_min_concurrency_slack() >= concurrency_share_; }
+  bool can_enable() const { return staged_penalty_ > 0 && get_min_concurrency_slack() >= concurrency_share_; }
 
   /* hookup to system */
   boost::intrusive::list_member_hook<> variable_set_hook_;
@@ -439,7 +440,7 @@ public:
   /** @brief Update a constraint bound */
   void update_constraint_bound(Constraint * cnst, double bound);
 
-  int constraint_used(Constraint* cnst) { return cnst->active_constraint_set_hook_.is_linked(); }
+  int constraint_used(const Constraint* cnst) const { return cnst->active_constraint_set_hook_.is_linked(); }
 
   /** @brief Print the lmm system */
   void print() const;
@@ -505,8 +506,8 @@ private:
    */
   void update(Constraint * cnst, Variable * var, double value);
 
-  void update_modified_set(Constraint * cnst);
-  void update_modified_set_rec(Constraint * cnst);
+  void update_modified_set(Constraint* cnst);
+  void update_modified_set_rec(const Constraint* cnst);
 
   /** @brief Remove all constraints of the modified_constraint_set. */
   void remove_all_modified_set();
@@ -529,11 +530,11 @@ public:
                                                                    &Constraint::saturated_constraint_set_hook_>>
       saturated_constraint_set;
 
-  resource::Action::ModifiedSet* modified_set_ = nullptr;
+  std::unique_ptr<resource::Action::ModifiedSet> modified_set_ = nullptr;
 
 private:
-  typedef std::vector<int> dyn_light_t;
-  
+  using dyn_light_t = std::vector<int>;
+
   //Data used in lmm::solve
   std::vector<ConstraintLight> cnst_light_vec;
   dyn_light_t saturated_constraints;
@@ -553,16 +554,13 @@ private:
 
 class XBT_PUBLIC FairBottleneck : public System {
 public:
-  explicit FairBottleneck(bool selective_update) : System(selective_update) {}
+  using System::System;
   void solve() final { bottleneck_solve(); }
 
 private:
   void bottleneck_solve();
 };
 
-XBT_PUBLIC System* make_new_maxmin_system(bool selective_update);
-XBT_PUBLIC System* make_new_fair_bottleneck_system(bool selective_update);
-
 /** @} */
 } // namespace lmm
 } // namespace kernel