Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Avoid negative rate
[simgrid.git] / src / kernel / lmm / bmf.hpp
index 4ae56f9..7077bc8 100644 (file)
@@ -3,11 +3,11 @@
 /* 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. */
 
-#ifndef SURF_BMF_HPP
-#define SURF_BMF_HPP
+#ifndef SIMGRID_KERNEL_LMM_BMF_HPP
+#define SIMGRID_KERNEL_LMM_BMF_HPP
 
-#include "src/kernel/lmm/maxmin.hpp"
-#include <eigen3/Eigen/Dense>
+#include "src/kernel/lmm/System.hpp"
+#include <Eigen/Dense>
 #include <unordered_set>
 
 namespace simgrid {
@@ -92,6 +92,13 @@ private:
    * @return Actual resource capacity
    */
   double get_resource_capacity(int resource, const std::vector<int>& bounded_players) const;
+  /**
+   * @brief Get maxmin share of the resource
+   *
+   * @param resource Internal index of resource in C_ vector
+   * @return maxmin share
+   */
+  double get_maxmin_share(int resource) const;
   /**
    * @brief Auxiliary method to get list of bounded player from allocation
    *
@@ -180,7 +187,7 @@ private:
   AllocationGenerator gen_;
   std::vector<int> allocations_age_;
   static constexpr int NO_RESOURCE = -1;                    //!< flag to indicate player has selected no resource
-  int max_iteration_               = sg_bmf_max_iterations; //!< number maximum of iterations of BMF algorithm
+  int max_iteration_;                                       //!< number maximum of iterations of BMF algorithm
 };
 
 /**
@@ -224,10 +231,10 @@ private:
 class XBT_PUBLIC BmfSystem : public System {
 public:
   using System::System;
-  /** @brief Implements the solve method to calculate a BMF allocation */
-  void solve() final;
 
 private:
+  /** @brief Implements the solve method to calculate a BMF allocation */
+  void do_solve() final;
   using allocation_map_t = std::unordered_map<int, std::unordered_set<int>>;
   /**
    * @brief Solve equation system to find a fair-sharing of resources
@@ -247,7 +254,7 @@ private:
    * @param maxA Max subflow consumption matrix (OUTPUT)
    * @param phi Bounds for variables
    */
-  void get_flows_data(int number_cnsts, Eigen::MatrixXd& A, Eigen::MatrixXd& maxA, Eigen::VectorXd& phi);
+  void get_flows_data(Eigen::Index number_cnsts, Eigen::MatrixXd& A, Eigen::MatrixXd& maxA, Eigen::VectorXd& phi);
   /**
    * @brief Builds the vector C_ with resource's capacity
    *
@@ -267,4 +274,4 @@ private:
 } // namespace kernel
 } // namespace simgrid
 
-#endif
\ No newline at end of file
+#endif