Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of https://framagit.org/mwapl/simgrid
authormlaurent <mathieu.laurent@ens-rennes.fr>
Mon, 5 Jun 2023 18:56:26 +0000 (20:56 +0200)
committermlaurent <mathieu.laurent@ens-rennes.fr>
Mon, 5 Jun 2023 18:56:26 +0000 (20:56 +0200)
src/mc/api/strategy/BasicStrategy.hpp
src/mc/transition/TransitionAny.cpp
src/mc/transition/TransitionAny.hpp

index 67c1ac8..42676d4 100644 (file)
@@ -38,18 +38,18 @@ public:
     }
     return std::make_pair(-1, depth_);
   }
-  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;
-      }
-    }
+    for (auto& [_, actor] : actors_to_run_) 
+       if (actor.is_todo())
+           return;
+
+    for (auto& [_, actor] : actors_to_run_) 
+       if (actor.is_enabled() and not actor.is_done()) 
+           actor.mark_todo();
+      
+    
   }
 };
 
index f532369..220b7cb 100644 (file)
@@ -27,9 +27,11 @@ TestAnyTransition::TestAnyTransition(aid_t issuer, int times_considered, std::st
 }
 std::string TestAnyTransition::to_string(bool verbose) const
 {
-  auto res = xbt::string_printf("TestAny");
-  for (auto const* t : transitions_)
+  auto res = xbt::string_printf("TestAny(%s){ ", this->result() ? "TRUE" : "FALSE");
+  for (auto const* t : transitions_) {
     res += t->to_string(verbose);
+    res += "; ";
+  }
   res += " }";
   return res;
 }
index df5954e..b064811 100644 (file)
@@ -8,6 +8,7 @@
 
 #include "src/kernel/actor/SimcallObserver.hpp"
 #include "src/mc/transition/Transition.hpp"
+#include "src/mc/transition/TransitionComm.hpp"
 
 #include <sstream>
 #include <string>
@@ -23,6 +24,15 @@ public:
   bool depends(const Transition* other) const override;
 
   Transition* get_current_transition() const { return transitions_.at(times_considered_); }
+  bool result() const
+  {
+    for (Transition* transition : transitions_) {
+      CommTestTransition* tested_transition = static_cast<CommTestTransition*>(transition);
+      if (tested_transition->get_sender() != -1 and tested_transition->get_receiver() != -1)
+        return true;
+    }
+    return false;
+  }
 };
 
 class WaitAnyTransition : public Transition {