+ /* DPOR persistent set procedure:
+ * for each new transition considered, check if it depends on any other previous transition executed before it
+ * on another process. If there exists one, find the more recent, and add its process to the interleave set.
+ * If the process is not enabled at this point, then add every enabled process to the interleave */
+ if (reduction_mode_ == ReductionMode::dpor) {
+ aid_t issuer_id = state->get_transition_out()->aid_;
+ stack_t tmp_stack = stack_;
+ while (not tmp_stack.empty()) {
+ if (const State* prev_state = tmp_stack.back().get();
+ state->get_transition_out()->aid_ == prev_state->get_transition_out()->aid_) {
+ XBT_DEBUG("Simcall >>%s<< and >>%s<< with same issuer %ld", state->get_transition_out()->to_string().c_str(),
+ prev_state->get_transition_out()->to_string().c_str(), issuer_id);
+ tmp_stack.pop_back();
+ continue;
+ } else if (prev_state->get_transition_out()->depends(state->get_transition_out().get())) {
+ XBT_VERB("Dependent Transitions:");
+ XBT_VERB(" %s (state=%ld)", prev_state->get_transition_out()->to_string().c_str(), prev_state->get_num());
+ XBT_VERB(" %s (state=%ld)", state->get_transition_out()->to_string().c_str(), state->get_num());
+
+ if (prev_state->is_actor_enabled(issuer_id)) {
+ if (not prev_state->is_actor_done(issuer_id)) {
+ prev_state->consider_one(issuer_id);
+ opened_states_.emplace_back(tmp_stack.back());
+ } else
+ XBT_DEBUG("Actor %ld is already in done set: no need to explore it again", issuer_id);
+ } else {
+ XBT_DEBUG("Actor %ld is not enabled: DPOR may be failing. To stay sound, we are marking every enabled "
+ "transition as todo",
+ issuer_id);
+ // If we ended up marking at least a transition, explore it at some point
+ if (prev_state->consider_all() > 0)
+ opened_states_.emplace_back(tmp_stack.back());
+ }
+ break;
+ } else {
+ XBT_VERB("INDEPENDENT Transitions:");
+ XBT_VERB(" %s (state=%ld)", prev_state->get_transition_out()->to_string().c_str(), prev_state->get_num());
+ XBT_VERB(" %s (state=%ld)", state->get_transition_out()->to_string().c_str(), state->get_num());
+ }
+ tmp_stack.pop_back();
+ }
+ } else if (reduction_mode_ == ReductionMode::sdpor) {
+ /**
+ * SDPOR Source Set Procedure:
+ *
+ * Find "reversible races" in the current execution `E` with respect
+ * to the latest action `p`. For each such race, determine one thread
+ * not contained in the backtrack set at the "race point" `r` which
+ * "represents" the trace formed by first executing everything after
+ * `r` that doesn't depend on it (`v := notdep(r, E)`) and then `p` to
+ * flip the race.
+ *
+ * The intuition is that some subsequence of `v` may enable `p`, so
+ * we want to be sure that search "in that direction"
+ */
+ execution_seq_.push_transition(std::move(executed_transition));
+ xbt_assert(execution_seq_.get_latest_event_handle().has_value(), "No events are contained in the SDPOR execution "
+ "even though one was just added");
+
+ const auto next_E_p = execution_seq_.get_latest_event_handle().value();
+ for (const auto e_race : execution_seq_.get_reversible_races_of(next_E_p)) {
+ State* prev_state = stack_[e_race].get();
+ const auto choices = execution_seq_.get_missing_source_set_actors_from(e_race, prev_state->get_backtrack_set());
+ if (not choices.empty()) {
+ // NOTE: To incorporate the idea of attempting to select the "best"
+ // backtrack point into SDPOR, instead of selecting the `first` initial,
+ // we should instead compute all choices and decide which is best
+ //
+ // Here, we choose the actor with the lowest ID to ensure
+ // we get deterministic results
+ const auto q =
+ std::min_element(choices.begin(), choices.end(), [](const aid_t a1, const aid_t a2) { return a1 < a2; });
+ prev_state->consider_one(*q);
+ opened_states_.emplace_back(std::move(prev_state));
+ }
+ }
+ } else if (reduction_mode_ == ReductionMode::odpor) {
+ // In the case of ODPOR, we simply observe the transition that was executed
+ // until we've reached a maximal trace
+ execution_seq_.push_transition(std::move(executed_transition));
+ }
+
+ // Before leaving that state, if the transition we just took can be taken multiple times, we
+ // need to give it to the opened states
+ if (stack_.back()->count_todo_multiples() > 0)
+ opened_states_.emplace_back(stack_.back());