Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Don't modify variable twice in the same expression.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Wed, 9 Mar 2022 09:42:05 +0000 (10:42 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Wed, 9 Mar 2022 10:05:00 +0000 (11:05 +0100)
src/kernel/lmm/bmf.cpp

index 777f252..59acf0c 100644 (file)
@@ -41,7 +41,7 @@ bool AllocationGenerator::next(std::vector<int>& next_alloc)
   auto n_resources = A_.rows();
   size_t idx      = 0;
   while (idx < alloc_.size()) {
   auto n_resources = A_.rows();
   size_t idx      = 0;
   while (idx < alloc_.size()) {
-    alloc_[idx] = (++alloc_[idx]) % n_resources;
+    alloc_[idx] = (alloc_[idx] + 1) % n_resources;
     if (alloc_[idx] == 0) {
       idx++;
       continue;
     if (alloc_[idx] == 0) {
       idx++;
       continue;
@@ -222,7 +222,6 @@ bool BmfSolver::get_alloc(const Eigen::VectorXd& fair_sharing, const allocation_
 
       double share = fair_sharing[cnst_idx] / A_(cnst_idx, player_idx);
       if (min_share == -1 || share < min_share) {
 
       double share = fair_sharing[cnst_idx] / A_(cnst_idx, player_idx);
       if (min_share == -1 || share < min_share) {
-
         selected_resource = cnst_idx;
         min_share         = share;
       }
         selected_resource = cnst_idx;
         min_share         = share;
       }