Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Activate the stdobject test now that it works
[simgrid.git] / src / mc / api / guide / BasicGuide.hpp
index 631db3360b5011250aa9fe7058212f3112a8c780..c55067523aa93db43a5a64a68de4b98e8d1dbb16 100644 (file)
@@ -12,8 +12,31 @@ namespace simgrid::mc {
 // Not Yet fully implemented
 class BasicGuide : public GuidedState {
 public:
-  std::pair<aid_t, double> next_transition() const override { return std::make_pair(0, 0); }
-  virtual void execute_next(aid_t aid) override { return; }
+  std::pair<aid_t, double> 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 */
+      if (not actor.is_todo() || not actor.is_enabled() || actor.is_done()) {
+        continue;
+      }
+
+      return std::make_pair(aid, 1.0);
+    }
+    return std::make_pair(-1, 0.0);
+  }
+  void execute_next(aid_t aid, RemoteApp& app) override { return; }
+
+  void consider_best() override
+  {
+    for (auto& [_, actor] : actors_to_run_) {
+      if (actor.is_todo())
+        return;
+      if (actor.is_enabled() and not actor.is_done()) {
+        actor.mark_todo();
+        return;
+      }
+    }
+  }
 };
 
 } // namespace simgrid::mc