- const auto p = parent_state_->get_transition_out()->aid_;
- const auto branch = std::find_if(
- parent_state_->wakeup_tree_.begin(), parent_state_->wakeup_tree_.end(),
- [=](const odpor::WakeupTreeNode* node) { return node->is_single_process() && node->get_first_actor() == p; });
- xbt_assert(branch != parent_state_->wakeup_tree_.end(),
- "Attempted to create a subtree from the wakeup tree of the parent "
- "state using actor `%ld`, but no such subtree could be found. "
- "This implies that the wakeup tree management is broken, "
- "and more specifically that subtree formation is not working "
- "as intended; for if this state was generated by the parent "
- "having taken an action by actor `%ld`, this implies that "
- "ODPOR found `%ld` as a candidate branch prior",
- p, p, p);
- this->wakeup_tree_ = odpor::WakeupTree::make_subtree_rooted_at(*branch);
+ const auto min_process_node = parent_state_->wakeup_tree_.get_min_single_process_node();
+ xbt_assert(min_process_node.has_value(), "Attempting to construct a subtree for a substate from a "
+ "parent with an empty wakeup tree. This indicates either that ODPOR "
+ "actor selection in State.cpp is incorrect, or that the code "
+ "deciding when to make subtrees in ODPOR is incorrect");
+ xbt_assert((get_transition_in()->aid_ == min_process_node.value()->get_actor()) &&
+ (get_transition_in()->type_ == min_process_node.value()->get_action()->type_),
+ "We tried to make a subtree from a parent state who claimed to have executed `%s` "
+ "but whose wakeup tree indicates it should have executed `%s`. This indicates "
+ "that exploration is not following ODPOR. Are you sure you're choosing actors "
+ "to schedule from the wakeup tree?",
+ get_transition_in()->to_string(false).c_str(),
+ min_process_node.value()->get_action()->to_string(false).c_str());
+ this->wakeup_tree_ = odpor::WakeupTree::make_subtree_rooted_at(min_process_node.value());