X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/f0534a5e2af72c36c12d55f7ea323040e6e9bf36..0e6845546f978a7391692a2dc0e9fd2527132241:/src/mc/api/strategy/BasicStrategy.hpp diff --git a/src/mc/api/strategy/BasicStrategy.hpp b/src/mc/api/strategy/BasicStrategy.hpp index 42676d437d..175425252e 100644 --- a/src/mc/api/strategy/BasicStrategy.hpp +++ b/src/mc/api/strategy/BasicStrategy.hpp @@ -13,12 +13,12 @@ namespace simgrid::mc { /** Basic MC guiding class which corresponds to no guide. When asked for different states * it will follow a depth first search politics to minize the number of opened states. */ class BasicStrategy : public Strategy { - int depth_ = 100000; // Arbitrary starting point. next_transition must return a positiv value to work with threshold in DFSExplorer + int depth_ = _sg_mc_max_depth; // Arbitrary starting point. next_transition must return a positiv value to work with threshold in DFSExplorer public: void copy_from(const Strategy* strategy) override { - const BasicStrategy* cast_strategy = static_cast(strategy); + const BasicStrategy* cast_strategy = dynamic_cast(strategy); xbt_assert(cast_strategy != nullptr); depth_ = cast_strategy->depth_ - 1; xbt_assert(depth_ > 0, "The exploration reached a depth greater than 100000. We will stop here to prevent weird interaction with DFSExplorer."); @@ -26,31 +26,22 @@ public: BasicStrategy() = default; ~BasicStrategy() override = default; - std::pair 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()) { + std::pair best_transition(bool must_be_todo) 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() && must_be_todo) || not actor.is_enabled() || actor.is_done()) { continue; } return std::make_pair(aid, depth_); } return std::make_pair(-1, depth_); + } + - void consider_best() override - { - 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(); - + void execute_next(aid_t aid, RemoteApp& app) override { return; } - } }; } // namespace simgrid::mc