1 /* Copyright (c) 2004-2022. The SimGrid Team. All rights reserved. */
3 /* This program is free software; you can redistribute it and/or modify it
4 * under the terms of the license (GNU LGPL) which comes with this package. */
9 #include "src/kernel/lmm/maxmin.hpp"
10 #include <eigen3/Eigen/Dense>
16 class XBT_PUBLIC BmfSystem : public System {
19 void solve() final { bottleneck_solve(); }
22 void bottleneck_solve();
25 std::unordered_map<int, std::vector<int>> get_alloc(const Eigen::VectorXd& fair_sharing) const;
26 Eigen::VectorXd equilibrium(const std::unordered_map<int, std::vector<int>>& alloc) const;
28 void set_fair_sharing(const std::unordered_map<int, std::vector<int>>& alloc, const Eigen::VectorXd& rho,
29 Eigen::VectorXd& fair_sharing) const;
31 template <typename T> std::string debug_eigen(const T& obj) const;
32 template <typename T> std::string debug_vector(const std::vector<T>& vector) const;
33 std::string debug_alloc(const std::unordered_map<int, std::vector<int>>& alloc) const;
35 * @brief Check if allocation is BMF
37 * To be a bmf allocation it must:
38 * - respect the capacity of all resources
39 * - saturate at least 1 resource
40 * - every player receives maximum share in at least 1 saturated resource
41 * @param rho Allocation
42 * @return true if BMF false otherwise
44 bool is_bmf(const Eigen::VectorXd& rho) const;
46 int max_iteration_ = 10;
48 Eigen::MatrixXd maxA_;
49 std::unordered_map<int, Variable*> idx2Var_;
51 std::unordered_map<const Constraint*, int> cnst2idx_;
56 } // namespace simgrid