- /* We may backtrack from somewhere either because it's leaf, or because every enabled process are in done/sleep set.
- * In the first case, we need to remove the last transition corresponding to the Finalize */
- if (stack_.back()->get_transition()->aid_ == 0)
- stack_.pop_back();
-
- stack_t backtrack;
- double min_dist = std::numeric_limits<double>::infinity();
- aid_t min_aid = -1;
- for (auto iter = opened_states_.begin(); iter != opened_states_.end();) {
- auto [aid, dist] = (*iter).back()->next_transition_guided();
- if (aid == -1) { // happens if no actors are todo anymore in this transition
- iter = opened_states_.erase(iter);
- continue;
- }
- if (dist < min_dist) {
- min_dist = dist;
- min_aid = aid;
- backtrack = (*iter);
- }
- iter++;
- }