X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/3d8419dc7f7fb035900de237a69b447f72439792..122a5a2813fd6d64d4db8ee7f1fdb5a62b7e0d6a:/src/mc/explo/UdporChecker.hpp diff --git a/src/mc/explo/UdporChecker.hpp b/src/mc/explo/UdporChecker.hpp index 907469e0ef..02f2a8e1d1 100644 --- a/src/mc/explo/UdporChecker.hpp +++ b/src/mc/explo/UdporChecker.hpp @@ -7,6 +7,7 @@ #ifndef SIMGRID_MC_UDPOR_CHECKER_HPP #define SIMGRID_MC_UDPOR_CHECKER_HPP +#include "src/mc/api/State.hpp" #include "src/mc/explo/Exploration.hpp" #include "src/mc/explo/udpor/Configuration.hpp" #include "src/mc/explo/udpor/EventSet.hpp" @@ -38,13 +39,15 @@ public: void run() override; RecordTrace get_record_trace() override; - std::vector get_textual_trace() override; - - inline std::unique_ptr get_current_state() { return std::make_unique(get_remote_app()); } + std::unique_ptr get_current_state() { return std::make_unique(get_remote_app()); } private: Unfolding unfolding = Unfolding(); + // The current sequence of states that the checker has + // visited in order to reach the current configuration + std::list> state_stack; + /** * @brief Explores the unfolding of the concurrent system * represented by the ModelChecker instance "mcmodel_checker" @@ -60,20 +63,11 @@ private: * @param A the set of events to "guide" UDPOR in the correct direction * when it returns back to a node in the unfolding and must decide among * events to select from `ex(C)`. See [1] for more details - * @param stateSequence the sequence of states entered by the program - * while UDPOR explored `C`. The program is in `state(C)` (using the notation of [1]), - * which is the result of executing all actions in the stack - * - * TODO: We pass around the reference to the stack which is modified - * appropriately in each recursive call. An iterative version would not - * need to pass around the states in this manner: the `std::stack<...>` - * could be a local variable of the function * * TODO: Add the optimization where we can check if e == e_prior * to prevent repeated work when computing ex(C) */ - void explore(const Configuration& C, EventSet D, EventSet A, std::list>& state_stack, - EventSet prev_exC); + void explore(const Configuration& C, EventSet D, EventSet A, EventSet prev_exC); /** * @brief Identifies the next event from the unfolding of the concurrent system @@ -87,7 +81,7 @@ private: * by the UDPOR algorithm to select new events to search. See the original * paper [1] for more details */ - const UnfoldingEvent* select_next_unfolding_event(const EventSet& A, const EventSet& enC); + UnfoldingEvent* select_next_unfolding_event(const EventSet& A, const EventSet& enC); /** * @brief Computes the sets `ex(C)` and `en(C)` of the given configuration @@ -114,38 +108,43 @@ private: * @returns the extension set `ex(C)` of `C` */ EventSet compute_exC(const Configuration& C, const State& stateC, const EventSet& prev_exC); - - /** - * @brief Computes a portion of the extension set of a configuration given - * some action `action` by directly enumerating all maximal subsets of C - * (i.e. without specializations based on the action) - */ - EventSet compute_exC_by_enumeration(const Configuration& C, const std::shared_ptr action); - EventSet compute_enC(const Configuration& C, const EventSet& exC) const; /** * */ - void move_to_stateCe(State& stateC, const UnfoldingEvent& e); + void move_to_stateCe(State* stateC, UnfoldingEvent* e); /** - * @brief Creates a new snapshot of the state of the progam undergoing - * model checking - * - * @returns the handle used to uniquely identify this state later in the - * exploration of the unfolding. You provide this handle to an event in the - * unfolding to regenerate past states + * @brief Creates a new snapshot of the state of the application + * as it currently looks */ std::unique_ptr record_current_state(); /** + * @brief Move the application side into the state at the top of the + * state stack provided + * + * As UDPOR performs its search, it moves the application-side along with + * it so that the application is always providing the checker with + * the correct information about what each actor is running (and whether + * those actors are enabled) at the state reached by the configuration it + * decides to search. * + * When UDPOR decides to "backtrack" (e.g. after reaching a configuration + * whose en(C) is empty), before it attempts to continue the search by taking + * a different path from a configuration it visited in the past, it must ensure + * that the application-side has moved back into `state(C)`. + * + * The search may have moved the application arbitrarily deep into its execution, + * and the search may backtrack arbitrarily closer to the beginning of the execution. + * The UDPOR implementation in SimGrid ensures that the stack is updated appropriately, + * but the process must still be regenerated. */ - void restore_program_state_with_sequence(const std::list>& state_stack); + void restore_program_state_with_current_stack(); /** - * + * @brief Perform the functionality of the `Remove(e, C, D)` function in [1] */ void clean_up_explore(const UnfoldingEvent* e, const Configuration& C, const EventSet& D); };