Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Move maxmin solver from system
[simgrid.git] / src / kernel / lmm / bmf.hpp
index afe62cb..c4f1f55 100644 (file)
@@ -3,12 +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 <boost/container_hash/hash.hpp>
-#include <eigen3/Eigen/Dense>
+#include "src/kernel/lmm/System.hpp"
+#include <Eigen/Dense>
 #include <unordered_set>
 
 namespace simgrid {
@@ -177,11 +176,11 @@ private:
   std::vector<bool> C_shared_; //!< shared_j Resource j is shared or not
   Eigen::VectorXd phi_;        //!< phi_i bound for each player
 
-  std::unordered_set<std::vector<int>, boost::hash<std::vector<int>>> allocations_;
+  std::set<std::vector<int>> allocations_; //!< set of already tested allocations, since last identified loop
   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
 };
 
 /**
@@ -225,10 +224,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
@@ -248,7 +247,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
    *
@@ -268,4 +267,4 @@ private:
 } // namespace kernel
 } // namespace simgrid
 
-#endif
\ No newline at end of file
+#endif