Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
An integer seems good enough to handle priorities, and is not subject to rounding...
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 4 Apr 2023 15:08:57 +0000 (17:08 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 4 Apr 2023 15:08:57 +0000 (17:08 +0200)
src/mc/api/State.cpp
src/mc/api/State.hpp
src/mc/api/strategy/BasicStrategy.hpp
src/mc/api/strategy/Strategy.hpp
src/mc/api/strategy/WaitStrategy.hpp

index 69fae98..b5f8eba 100644 (file)
@@ -121,7 +121,7 @@ aid_t State::next_transition() const
   return -1;
 }
 
-std::pair<aid_t, double> State::next_transition_guided() const
+std::pair<aid_t, int> State::next_transition_guided() const
 {
   return strategy_->next_transition();
 }
index 2b2a625..6d98437 100644 (file)
@@ -62,9 +62,9 @@ public:
   /* Returns a positive number if there is another transition to pick, or -1 if not */
   aid_t next_transition() const; // this function should disapear as it is redundant with the next one
 
-  /* Same as next_transition, but choice is now guided, and a double corresponding to the
+  /* Same as next_transition, but choice is now guided, and an integer corresponding to the
    internal cost of the transition is returned */
-  std::pair<aid_t, double> next_transition_guided() const;
+  std::pair<aid_t, int> next_transition_guided() const;
 
   /* Explore a new path on the remote app; the parameter 'next' must be the result of a previous call to
    * next_transition() */
index dfdbd5d..93ebd6c 100644 (file)
@@ -16,7 +16,7 @@ public:
     return;
   }
 
-  std::pair<aid_t, double> next_transition() const override
+  std::pair<aid_t, int> next_transition() const override
   {
     for (auto const& [aid, actor] : actors_to_run_) {
       /* Only consider actors (1) marked as interleaving by the checker and (2) currently enabled in the application */
@@ -24,9 +24,9 @@ public:
         continue;
       }
 
-      return std::make_pair(aid, 1.0);
+      return std::make_pair(aid, 1);
     }
-    return std::make_pair(-1, 0.0);
+    return std::make_pair(-1, 0);
   }
   void execute_next(aid_t aid, RemoteApp& app) override { return; }
 
index c1bf76b..ef5b87f 100644 (file)
@@ -23,9 +23,9 @@ public:
     return;
   }
 
-  virtual std::pair<aid_t, double> next_transition() const = 0;
-  virtual void execute_next(aid_t aid, RemoteApp& app)     = 0;
-  virtual void consider_best()                             = 0;
+  virtual std::pair<aid_t, int> next_transition() const = 0;
+  virtual void execute_next(aid_t aid, RemoteApp& app)  = 0;
+  virtual void consider_best()                          = 0;
 
   // Mark the first enabled and not yet done transition as todo
   // If there's already a transition marked as todo, does nothing
index edf75b2..e2d466b 100644 (file)
@@ -13,8 +13,8 @@ namespace simgrid::mc {
 /** Wait MC guiding class that aims at minimizing the number of in-fly communication.
  *  When possible, it will try to take the wait transition. */
 class WaitStrategy : public Strategy {
-  double taken_wait_ = 0;
-  bool taking_wait_  = false;
+  int taken_wait_   = 0;
+  bool taking_wait_ = false;
 
 public:
   void operator=(const WaitStrategy& guide) { taken_wait_ = guide.taken_wait_; }
@@ -25,9 +25,9 @@ public:
            type == Transition::Type::MUTEX_WAIT or type == Transition::Type::SEM_WAIT;
   }
 
-  std::pair<aid_t, double> next_transition() const override
+  std::pair<aid_t, int> next_transition() const override
   {
-    std::pair<aid_t, double> if_no_wait = std::make_pair(-1, 0.0);
+    std::pair<aid_t, int> if_no_wait = std::make_pair(-1, 0);
     for (auto const& [aid, actor] : actors_to_run_) {
       if (not actor.is_todo() || not actor.is_enabled() || actor.is_done())
         continue;