Skip to content
Snippets Groups Projects
Commit e7522a8b authored by jgatt's avatar jgatt
Browse files

added comment + change function to protected + init_prob don't use random_seed

parent e205ccb9
No related branches found
No related tags found
1 merge request!12Merge Request multibehavior
Pipeline #5497 passed
......@@ -25,9 +25,7 @@ std::vector<DMWindow_list>::size_type DMWindow_list::index_in_dm_window(double d
return content.size();
}
void DMUserMultiBehavior::init_prob(const rapidjson::Value &param,uint_fast32_t random_seed){
random_gen = std::mt19937(random_seed);
void DMUserMultiBehavior::init_prob(const rapidjson::Value &param){
//Red window probability initialization
std::vector<double> red_prob (5,0.0);
......@@ -99,7 +97,8 @@ DMUserMultiBehavior::DMUserMultiBehavior(
this->logger = logger;
red_window_buffer = nullptr;
yellow_window_buffer = nullptr;
init_prob(param,random_seed);
random_gen = std::mt19937(random_seed);
init_prob(param);
}
DMUserMultiBehavior::~DMUserMultiBehavior()
......
......@@ -41,13 +41,11 @@ public:
uint_fast32_t random_seed, DMWindow_list *yellow_windows,
DMWindow_list *red_windows, LoggerUserStat* logger);
~DMUserMultiBehavior();
void init_prob(const rapidjson::Value &param, uint_fast32_t random_seed);
double next_submission();
void jobs_to_submit(
double date, std::list<shared_ptr<Job> > &jobs, std::list< const Profile *> &profiles);
bool is_in_yellow_window(double date);
bool is_in_red_window(double date);
void log_behavior(shared_ptr<Job> job, std::string behavior_name, long delay_time);
protected:
DMWindow_list *yellow_windows;
DMWindow_list * red_windows;
......@@ -57,18 +55,38 @@ protected:
std::uniform_real_distribution<double> distribution
= std::uniform_real_distribution<double>(0.0, 1.0);
LoggerUserStat *logger = nullptr ;
void init_prob(const rapidjson::Value &param);
bool is_in_yellow_window(double date);
bool is_in_red_window(double date);
void log_behavior(shared_ptr<Job> job, std::string behavior_name, long delay_time);
bool C_you_later_job(double date, double next_time,shared_ptr<Job> job);
/**
* function called each time the user want to submit a job it does the following :
* - if the user is in a red window
* the user adopt the behavior define in red_window_behavior
* - if the user is in a yellow window AND not in a red one
* the user adopt the behavior define in yellow_windows_behavior
* - else the user submit it job without any change
* @brief function called each time the user want to submit a job
* @details This function does the following :
* - if the user is in a red window
* the user adopt the behavior define in red_window_behavior
* - if the user is in a yellow window AND not in a red one
* the user adopt the behavior define in yellow_windows_behavior
* - else the user submit its job without any change
*/
bool handle_job(double date,shared_ptr<Job> job,Profile *profile);
/**
* @brief function called when the user submit a job in red state
* @details This function do the 5 behavior for red windows of the class
* (degrad,reconfig,renonce,rigid,see_you_later)
* following the provided probabilities given at the creation of the class
*/
bool red_window_behavior(double date,shared_ptr<Job> job, Profile *profile);
/**
* @brief function called when the user submit a job in yellow state
* @details This function do the 3 behaviors for yellow windows (degrad,reconfig, rigid)
* following the provided probabilities given at the creation of the class
*/
bool yellow_window_behavior(shared_ptr<Job> job, Profile *profile);
double red_prob_Cyoulater,red_prob_renonce, red_prob_reconfig,red_prob_degrad;
double red_prob_total;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment