From: mlaurent Date: Fri, 31 Mar 2023 19:08:51 +0000 (+0200) Subject: Try to copy penalties correctly X-Git-Tag: v3.34~41^2~12^2~1 X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/79f5715c0a10bc16b68dc7d686d716c647dbf6ed Try to copy penalties correctly --- diff --git a/src/mc/api/State.cpp b/src/mc/api/State.cpp index e5eacf34fd..9a637e765e 100644 --- a/src/mc/api/State.cpp +++ b/src/mc/api/State.cpp @@ -50,6 +50,9 @@ State::State(RemoteApp& remote_app, std::shared_ptr parent_state) remote_app.get_actors_status(strategy_->actors_to_run_); + for (auto const& [aid, _] : strategy_->actors_to_run_) + strategy_->penalties_[aid] = parent_state_->strategy_->penalties_[aid]; + /* Stateful model checking */ if ((_sg_mc_checkpoint > 0 && (num_ % _sg_mc_checkpoint == 0)) || _sg_mc_termination) system_state_ = std::make_shared(num_, remote_app.get_page_store(), @@ -99,7 +102,6 @@ aid_t State::next_transition() const { XBT_DEBUG("Search for an actor to run. %zu actors to consider", strategy_->actors_to_run_.size()); for (auto const& [aid, actor] : strategy_->actors_to_run_) { - XBT_DEBUG("Current penalty for actor %ld:%f", aid, strategy_->penalties_[aid]); /* 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()) { if (not actor.is_todo()) @@ -121,9 +123,15 @@ aid_t State::next_transition() const std::pair State::next_transition_guided() const { + + for (auto const& [aid, penalty] : strategy_->penalties_) + XBT_DEBUG("Current penalty for actor %ld:%f", aid, strategy_->penalties_[aid]); + for (auto const& [aid, actor] : strategy_->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()) { + if (not actor.is_todo()) XBT_DEBUG("Can't run actor %ld because it is not todo", aid); diff --git a/src/mc/api/strategy/BasicStrategy.hpp b/src/mc/api/strategy/BasicStrategy.hpp index e2177fc04f..ca5b3ed353 100644 --- a/src/mc/api/strategy/BasicStrategy.hpp +++ b/src/mc/api/strategy/BasicStrategy.hpp @@ -45,8 +45,8 @@ public: void execute_next(aid_t aid, RemoteApp& app) override { auto actor = actors_to_run_.at(aid); - if (actor.get_transition(actor.get_times_considered())->type_ != Transition::Type::TESTANY) - penalties_[aid] += 1.0; + if (actor.get_transition(actor.get_times_considered())->type_ == Transition::Type::TESTANY) + penalties_[aid] = penalties_[aid] + 1.0; return; }