X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/ed9565ed57e9c8ff4f244c0cd0a5af96c947f14f..50753d5f8442a47c17c4035724201a18a7ff6146:/src/mc/explo/udpor/Configuration.hpp diff --git a/src/mc/explo/udpor/Configuration.hpp b/src/mc/explo/udpor/Configuration.hpp index 3b344dda00..619871eac2 100644 --- a/src/mc/explo/udpor/Configuration.hpp +++ b/src/mc/explo/udpor/Configuration.hpp @@ -9,6 +9,8 @@ #include "src/mc/explo/udpor/EventSet.hpp" #include "src/mc/explo/udpor/udpor_forward.hpp" +#include + namespace simgrid::mc::udpor { class Configuration { @@ -18,11 +20,15 @@ public: Configuration& operator=(Configuration const&) = default; Configuration(Configuration&&) = default; + explicit Configuration(const UnfoldingEvent* event); explicit Configuration(const EventSet& events); + explicit Configuration(const History& history); explicit Configuration(std::initializer_list events); auto begin() const { return this->events_.begin(); } auto end() const { return this->events_.end(); } + auto cbegin() const { return this->events_.cbegin(); } + auto cend() const { return this->events_.cend(); } bool contains(const UnfoldingEvent* e) const { return this->events_.contains(e); } const EventSet& get_events() const { return this->events_; } @@ -57,6 +63,23 @@ public: */ void add_event(const UnfoldingEvent* e); + /** + * @brief Whether or not the given event can be added to + * this configuration while keeping the set of events causally closed + * and conflict-free + */ + bool is_compatible_with(const UnfoldingEvent* e) const; + + /** + * @brief Whether or not the events in the given history can be added to + * this configuration while keeping the set of events causally closed + * and conflict-free + */ + bool is_compatible_with(const History& history) const; + + std::optional compute_alternative_to(const EventSet& D, const Unfolding& U) const; + std::optional compute_k_partial_alternative_to(const EventSet& D, const Unfolding& U, size_t k) const; + /** * @brief Orders the events of the configuration such that * "more recent" events (i.e. those that are farther down in @@ -106,8 +129,8 @@ public: * of the events returned by this method is equal to the set of events * in this configuration * - * @returns the smallest set of events whose events generates this configuration - * (denoted `config(E)`) + * @returns the smallest set of events whose events generates + * this configuration (denoted `config(E)`) */ EventSet get_minimally_reproducible_events() const;