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());
}
// This should be done in GuidedState, or at least interact with it
-void State::execute_next(aid_t next, RemoteApp& app)
+std::shared_ptr<Transition> State::execute_next(aid_t next, RemoteApp& app)
{
// First, warn the guide, so it knows how to build a proper child state
strategy_->execute_next(next, app);
// 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;
-
- auto executed_transition = std::unique_ptr<Transition>(just_executed);
- actor_state.set_transition(std::move(executed_transition), times_considered);
+ outgoing_transition_ = std::shared_ptr<Transition>(just_executed);
+ actor_state.set_transition(outgoing_transition_, times_considered);
app.wait_for_requests();
+
+ return outgoing_transition_;
}
} // namespace simgrid::mc