Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of https://framagit.org/simgrid/simgrid
[simgrid.git] / src / mc / api / State.cpp
index 877835f..cc85d8c 100644 (file)
@@ -5,7 +5,9 @@
 
 #include "src/mc/api/State.hpp"
 #include "src/mc/api/strategy/BasicStrategy.hpp"
-#include "src/mc/api/strategy/WaitStrategy.hpp"
+#include "src/mc/api/strategy/MaxMatchComm.hpp"
+#include "src/mc/api/strategy/MinMatchComm.hpp"
+#include "src/mc/api/strategy/UniformStrategy.hpp"
 #include "src/mc/explo/Exploration.hpp"
 #include "src/mc/mc_config.hpp"
 
@@ -21,10 +23,17 @@ long State::expended_states_ = 0;
 State::State(RemoteApp& remote_app) : num_(++expended_states_)
 {
   XBT_VERB("Creating a guide for the state");
+
+  srand(_sg_mc_random_seed);
+  
   if (_sg_mc_strategy == "none")
     strategy_ = std::make_shared<BasicStrategy>();
-  else if (_sg_mc_strategy == "nb_wait")
-    strategy_ = std::make_shared<WaitStrategy>();
+  else if (_sg_mc_strategy == "max_match_comm")
+    strategy_ = std::make_shared<MaxMatchComm>();
+  else if (_sg_mc_strategy == "min_match_comm")
+    strategy_ = std::make_shared<MinMatchComm>();
+  else if (_sg_mc_strategy == "uniform") 
+    strategy_ = std::make_shared<UniformStrategy>();
   else
     THROW_IMPOSSIBLE;
 
@@ -41,13 +50,18 @@ State::State(RemoteApp& remote_app) : num_(++expended_states_)
 State::State(RemoteApp& remote_app, std::shared_ptr<State> parent_state)
     : incoming_transition_(parent_state->get_transition_out()), num_(++expended_states_), parent_state_(parent_state)
 {
-  if (_sg_mc_strategy == "none")
+    
+   if (_sg_mc_strategy == "none")
     strategy_ = std::make_shared<BasicStrategy>();
-  else if (_sg_mc_strategy == "nb_wait")
-    strategy_ = std::make_shared<WaitStrategy>();
+  else if (_sg_mc_strategy == "max_match_comm")
+    strategy_ = std::make_shared<MaxMatchComm>();
+  else if (_sg_mc_strategy == "min_match_comm")
+    strategy_ = std::make_shared<MinMatchComm>();
+  else if (_sg_mc_strategy == "uniform") 
+    strategy_ = std::make_shared<UniformStrategy>();
   else
     THROW_IMPOSSIBLE;
-  *strategy_ = *(parent_state->strategy_);
+  strategy_->copy_from(parent_state_->strategy_.get());
 
   remote_app.get_actors_status(strategy_->actors_to_run_);