Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
batmen
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sepia-pub
mael
batmen
Commits
e7522a8b
Commit
e7522a8b
authored
2 years ago
by
jgatt
Browse files
Options
Downloads
Patches
Plain Diff
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
!12
Merge Request multibehavior
Pipeline
#5497
passed
2 years ago
Stage: build-and-test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/users/user_windows.cpp
+3
-4
3 additions, 4 deletions
src/users/user_windows.cpp
src/users/user_windows.hpp
+28
-10
28 additions, 10 deletions
src/users/user_windows.hpp
with
31 additions
and
14 deletions
src/users/user_windows.cpp
+
3
−
4
View file @
e7522a8b
...
...
@@ -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
()
...
...
This diff is collapsed.
Click to expand it.
src/users/user_windows.hpp
+
28
−
10
View file @
e7522a8b
...
...
@@ -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
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment