Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
FIC_DK_P GA Solving
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
6
Issues
6
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
M3TAL
FIC_DK_P GA Solving
Commits
1ad04219
Commit
1ad04219
authored
May 25, 2020
by
Alexis Lebis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
frame for decay
parent
6dfc228f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
58 additions
and
2 deletions
+58
-2
main.cpp
application/main.cpp
+2
-1
competency.cpp
src/model/competency.cpp
+18
-1
competency.h
src/model/competency.h
+17
-0
decay.h
src/model/decay.h
+21
-0
No files found.
application/main.cpp
View file @
1ad04219
...
...
@@ -10,6 +10,7 @@
#include <model/magnitude.h>
#include <model/tools.h>
#include <model/competency.h>
#include <model/decay.h>
#include <model/ea/cursus.h>
#include <model/ea/initializer.h>
...
...
@@ -355,6 +356,6 @@ int main(int argc, char* argv[]){
std
::
cout
<<
"cpt: "
<<
cross
.
cpt
<<
std
::
endl
;
// ================================= END RUN ZONE ===============================
return
EXIT_SUCCESS
;
}
src/model/competency.cpp
View file @
1ad04219
...
...
@@ -61,7 +61,7 @@ Competency Competency::buildTMP(double d, std::string name)
// === CONSTRUCTOR
Competency
::
Competency
(
int
id
,
Magnitude
m
,
std
::
string
s
)
:
_id
(
id
),
_m
(
m
),
_name
(
s
)
:
_id
(
id
),
_m
(
m
),
_
undecayedMag
(
m
),
_
name
(
s
)
{
}
...
...
@@ -120,6 +120,23 @@ const double Competency::competencyValue() const
return
this
->
_m
.
value
();
}
double
Competency
::
decay
()
{
if
(
!
this
->
_isDecaying
)
return
this
->
_m
.
value
();
try
{
this
->
evolveTowards
((
-
1
)
*
DecayEngine
::
defaultDecay
(
this
->
_howLongDecaying
));
}
catch
(
CompetencyEvolvingException
&
e
)
{
//NTD
}
return
this
->
_m
.
value
();
}
// === OPERATOR
std
::
ostream
&
operator
<<
(
std
::
ostream
&
Stream
,
const
Competency
&
c
)
{
...
...
src/model/competency.h
View file @
1ad04219
...
...
@@ -4,6 +4,8 @@
#include <string>
#include "magnitude.h"
#include "decay.h"
/**
* Represents the notion of a competency (a.k.a. "non operationalisable" skill).
...
...
@@ -19,6 +21,11 @@ class Competency
std
::
string
_name
;
int
_id
;
//Decay related
Magnitude
_undecayedMag
;
bool
_isDecaying
;
int
_howLongDecaying
;
//Constructor
Competency
(
int
,
Magnitude
,
std
::
string
);
...
...
@@ -65,6 +72,16 @@ class Competency
void
setMagnitude
(
Magnitude
&
m
){
this
->
_m
=
m
;}
void
setName
(
std
::
string
s
){
this
->
_name
=
s
;}
// === DECAY
const
bool
isDecaying
()
const
{
return
this
->
_isDecaying
;}
void
decayState
(
bool
state
)
{
this
->
_isDecaying
=
state
;}
int
increaseDecay
(){
this
->
_isDecaying
=
true
;
this
->
_howLongDecaying
++
;
return
this
->
_howLongDecaying
;}
void
resetDecay
(){
this
->
_isDecaying
=
false
;
this
->
_howLongDecaying
=
0
;}
void
setTimeDecay
(
unsigned
int
time
){
this
->
_howLongDecaying
=
time
;}
Magnitude
getUndecayedMagnitude
(){
return
this
->
_undecayedMag
;}
double
decay
();
double
decayAndReset
(){
this
->
decay
();
this
->
resetDecay
();
return
this
->
_m
.
value
();}
// === OPERATOR
/// A competency is equal to another iff their id are the same, or their name
bool
operator
==
(
const
Competency
&
c
)
const
;
...
...
src/model/decay.h
0 → 100644
View file @
1ad04219
#ifndef SRC_MODEL_DECAY_H_
#define SRC_MODEL_DECAY_H_
#include <cmath>
class
DecayEngine
{
private
:
public
:
/** Expresses the decay over the time x.
*/
static
double
defaultDecay
(
int
t
)
{
if
(
t
==
0
)
return
0
;
return
(
exp
(
t
/
1
.
25
)
+
5
)
/
100
;
}
};
#endif //SRC_MODEL_DECAY_H_
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment