X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/7fcf716d96f17793b4e132efcd7886c2c476bdda..3fb28e990d3e18eef76fa5d21a134f0bd4e2fbaa:/src/mc/explo/DFSExplorer.hpp diff --git a/src/mc/explo/DFSExplorer.hpp b/src/mc/explo/DFSExplorer.hpp index 218020b48d..a0dc478c0c 100644 --- a/src/mc/explo/DFSExplorer.hpp +++ b/src/mc/explo/DFSExplorer.hpp @@ -6,36 +6,30 @@ #ifndef SIMGRID_MC_SAFETY_CHECKER_HPP #define SIMGRID_MC_SAFETY_CHECKER_HPP +#include "src/mc/api/ClockVector.hpp" #include "src/mc/api/State.hpp" #include "src/mc/explo/Exploration.hpp" +#include "src/mc/explo/odpor/Execution.hpp" +#include "src/mc/mc_config.hpp" #if SIMGRID_HAVE_STATEFUL_MC #include "src/mc/VisitedState.hpp" #endif +#include #include #include #include #include +#include #include namespace simgrid::mc { -using stack_t = std::list>; - -/* Used to compare two stacks and decide which one is better to backtrack, - * regarding the chosen guide in the last state. */ -class OpenedStatesCompare { -public: - bool operator()(std::shared_ptr const& lhs, std::shared_ptr const& rhs) const - { - return lhs->next_transition_guided().second > rhs->next_transition_guided().second; - } -}; +using stack_t = std::deque>; class XBT_PRIVATE DFSExplorer : public Exploration { - XBT_DECLARE_ENUM_CLASS(ReductionMode, none, dpor); - +private: ReductionMode reduction_mode_; unsigned long backtrack_count_ = 0; // for statistics unsigned long visited_states_count_ = 0; // for statistics @@ -53,10 +47,9 @@ class XBT_PRIVATE DFSExplorer : public Exploration { static xbt::signal on_log_state_signal; public: - explicit DFSExplorer(const std::vector& args, bool with_dpor, bool need_memory_info = false); + explicit DFSExplorer(const std::vector& args, ReductionMode mode, bool need_memory_info = false); void run() override; RecordTrace get_record_trace() override; - std::vector get_textual_trace() override; void log_state() override; /** Called once when the exploration starts */ @@ -104,6 +97,16 @@ private: /** Stack representing the position in the exploration graph */ stack_t stack_; + + /** + * Provides additional metadata about the position in the exploration graph + * which is used by SDPOR and ODPOR + */ + odpor::Execution execution_seq_; + + /** Per-actor clock vectors used to compute the "happens-before" relation */ + std::unordered_map per_actor_clocks_; + #if SIMGRID_HAVE_STATEFUL_MC VisitedStates visited_states_; std::unique_ptr visited_state_; @@ -113,7 +116,13 @@ private: /** Opened states are states that still contains todo actors. * When backtracking, we pick a state from it*/ - std::multiset, OpenedStatesCompare> opened_states_; + std::vector> opened_states_; + std::shared_ptr best_opened_state(); + + /** If we're running ODPOR, picks the corresponding state in the stack + * (opened_states_ are ignored) + */ + std::shared_ptr next_odpor_state(); /** Change current stack_ value to correspond to the one we would have * had if we executed transition to get to state. This is required when