+
+ /**
+ * @brief Retrieves the transition that we should consider for execution by
+ * this actor from the State instance with respect to which this ActorState object
+ * is considered
+ */
+ std::shared_ptr<Transition> get_transition() const
+ {
+ // The rationale for this selection is as follows:
+ //
+ // 1. For transitions with only one possibility of execution,
+ // we always wish to select action `0` even if we've
+ // marked the transition already as considered (which
+ // we'll do if we explore a trace following that transition).
+ //
+ // 2. For transitions that can be considered multiple
+ // times, we want to be sure to select the most up-to-date
+ // action. In general, this means selecting that which is
+ // now being considered at this state. If, however, we've
+ // executed the
+ //
+ // The formula satisfies both of the above conditions:
+ //
+ // > std::clamp(times_considered_, 0u, max_consider_ - 1)
+ return get_transition(std::clamp(times_considered_, 0u, max_consider_ - 1));
+ }
+
+ std::shared_ptr<Transition> get_transition(unsigned times_considered) const
+ {
+ xbt_assert(times_considered < this->pending_transitions_.size(),
+ "Actor %ld does not have a state available transition with `times_considered = %u`,\n"
+ "yet one was asked for",
+ aid_, times_considered);
+ return this->pending_transitions_[times_considered];
+ }
+
+ void set_transition(std::shared_ptr<Transition> t, unsigned times_considered)
+ {
+ xbt_assert(times_considered < this->pending_transitions_.size(),
+ "Actor %ld does not have a state available transition with `times_considered = %u`, "
+ "yet one was attempted to be set",
+ aid_, times_considered);
+ this->pending_transitions_[times_considered] = std::move(t);
+ }
+
+ const std::vector<std::shared_ptr<Transition>>& get_enabled_transitions() const
+ {
+ static const auto no_enabled_transitions = std::vector<std::shared_ptr<Transition>>();
+ return this->is_enabled() ? this->pending_transitions_ : no_enabled_transitions;
+ };