Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add default method for constructing full graph
authorMaxwell Pirtle <maxwellpirtle@gmail.com>
Mon, 27 Feb 2023 07:57:23 +0000 (08:57 +0100)
committerMaxwell Pirtle <maxwellpirtle@gmail.com>
Mon, 27 Feb 2023 08:24:17 +0000 (09:24 +0100)
A convenience method was added which allows the
full compatibility graph to be constructed without
needing to specify that each node should be included.

src/mc/explo/udpor/Configuration.cpp
src/mc/explo/udpor/Configuration.hpp
src/mc/explo/udpor/Configuration_test.cpp

index ac99056..c4bdd79 100644 (file)
@@ -233,4 +233,9 @@ Configuration::make_compatibility_graph_filtered_on(std::function<bool(const Unf
   return G;
 }
 
+std::unique_ptr<CompatibilityGraph> Configuration::make_compatibility_graph() const
+{
+  return make_compatibility_graph_filtered_on([=](const UnfoldingEvent*) { return true; });
+}
+
 } // namespace simgrid::mc::udpor
index b2c469e..d6c9561 100644 (file)
@@ -105,8 +105,7 @@ public:
 
   /**
    * @brief Construct a new compatibility graph from the events of the
-   * configuration whose associated transitions are dependent with the
-   * given action
+   * configuration that satisfy the given predicate
    *
    * @param pred whether or not to even consider the unfolding event in any
    * compatibility nodes of the resulting graph
@@ -116,6 +115,15 @@ public:
   std::unique_ptr<CompatibilityGraph>
   make_compatibility_graph_filtered_on(std::function<bool(const UnfoldingEvent*)> pred) const;
 
+  /**
+   * @brief Construct a new compatibility graph from the events of the
+   * configuration
+   *
+   * @returns a new compatibility graph that defines possible maximal subsets
+   * of events of C
+   */
+  std::unique_ptr<CompatibilityGraph> make_compatibility_graph() const;
+
 private:
   /**
    * @brief The most recent event added to the configuration
index bf12e98..5232a05 100644 (file)
@@ -300,13 +300,13 @@ TEST_CASE("simgrid::mc::udpor::Configuration: Topological Sort Order Very Compli
   UnfoldingEvent e7{&e2, &e8}, e11{&e8};
   UnfoldingEvent e10{&e7}, e9{&e6, &e7};
   UnfoldingEvent e12{&e5, &e9, &e10};
+  Configuration C{&e1, &e2, &e3, &e4, &e5, &e6, &e7, &e8, &e9, &e10, &e11, &e12};
 
   SECTION("Test every combination of the maximal configuration (forward graph)")
   {
     // To test this, we ensure that for the `i`th event
     // in `ordered_events`, each event in `ordered_events[0...<i]
     // is contained in the history of `ordered_events[i]`.
-    Configuration C{&e1, &e2, &e3, &e4, &e5, &e6, &e7, &e8, &e9, &e10, &e11, &e12};
     const auto ordered_events = C.get_topologically_sorted_events();
 
     EventSet events_seen;
@@ -336,7 +336,6 @@ TEST_CASE("simgrid::mc::udpor::Configuration: Topological Sort Order Very Compli
     // To test this, we ensure that for the `i`th event
     // in `ordered_events`, no event in `ordered_events[0...<i]
     // is contained in the history of `ordered_events[i]`.
-    Configuration C{&e1, &e2, &e3, &e4, &e5, &e6, &e7, &e8, &e9, &e10, &e11, &e12};
     const auto ordered_events = C.get_topologically_sorted_events_of_reverse_graph();
 
     EventSet events_seen;