#include "src/mc/explo/Exploration.hpp"
#include "src/mc/mc_config.hpp"
+#include <algorithm>
#include <boost/range/algorithm.hpp>
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_state, mc, "Logging specific to MC states");
else
THROW_IMPOSSIBLE;
- recipe_ = std::list<Transition*>();
-
remote_app.get_actors_status(strategy_->actors_to_run_);
#if SIMGRID_HAVE_STATEFUL_MC
}
State::State(RemoteApp& remote_app, std::shared_ptr<State> parent_state)
- : num_(++expended_states_), parent_state_(parent_state)
+ : incoming_transition_(parent_state->get_transition_out()), num_(++expended_states_), parent_state_(parent_state)
{
if (_sg_mc_strategy == "none")
strategy_ = std::make_shared<BasicStrategy>();
THROW_IMPOSSIBLE;
*strategy_ = *(parent_state->strategy_);
- recipe_ = std::list(parent_state_->get_recipe());
- recipe_.push_back(parent_state_->get_transition());
-
remote_app.get_actors_status(strategy_->actors_to_run_);
#if SIMGRID_HAVE_STATEFUL_MC /* Stateful model checking */
* And if we kept it and the actor is enabled in this state, mark the actor as already done, so that
* it is not explored*/
for (auto& [aid, transition] : parent_state_->get_sleep_set()) {
- if (not parent_state_->get_transition()->depends(&transition)) {
+ if (not incoming_transition_->depends(&transition)) {
sleep_set_.try_emplace(aid, transition);
if (strategy_->actors_to_run_.count(aid) != 0) {
XBT_DEBUG("Actor %ld will not be explored, for it is in the sleep set", aid);
strategy_->actors_to_run_.at(aid).mark_done();
}
} else
- XBT_DEBUG("Transition >>%s<< removed from the sleep set because it was dependent with >>%s<<",
- transition.to_string().c_str(), parent_state_->get_transition()->to_string().c_str());
+ XBT_DEBUG("Transition >>%s<< removed from the sleep set because it was dependent with incoming >>%s<<",
+ transition.to_string().c_str(), incoming_transition_->to_string().c_str());
}
}
}
return count;
}
-Transition* State::get_transition() const
-{
- return transition_;
-}
-
aid_t State::next_transition() const
{
XBT_DEBUG("Search for an actor to run. %zu actors to consider", strategy_->actors_to_run_.size());
// 2. what action actor `next` was able to take given `times_considered`
// The latter update is important as *more* information is potentially available
// about a transition AFTER it has executed.
- transition_ = just_executed;
+ outgoing_transition_ = std::shared_ptr<Transition>(just_executed);
- const auto executed_transition = std::shared_ptr<Transition>(just_executed);
- actor_state.set_transition(executed_transition, times_considered);
+ actor_state.set_transition(outgoing_transition_, times_considered);
app.wait_for_requests();
- return executed_transition;
+ return outgoing_transition_;
}
+
+std::unordered_set<aid_t> State::get_backtrack_set() const
+{
+ std::unordered_set<aid_t> actors;
+ for (const auto& [aid, state] : get_actors_list()) {
+ if (state.is_todo() or state.is_done()) {
+ actors.insert(aid);
+ }
+ }
+ return actors;
+}
+
} // namespace simgrid::mc