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
79bdf0e8
Commit
79bdf0e8
authored
Jun 04, 2020
by
Alexis Lebis
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'warning_cleaning' into 'clusterRun'
Warning cleaning See merge request
!7
parents
43c97b73
d048501d
Changes
16
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
95 additions
and
72 deletions
+95
-72
main.cpp
application/main.cpp
+5
-0
CMakeLists.txt
src/model/CMakeLists.txt
+1
-0
competency.cpp
src/model/competency.cpp
+1
-1
competency.h
src/model/competency.h
+8
-9
course.cpp
src/model/course.cpp
+9
-9
course.h
src/model/course.h
+4
-3
decay.cpp
src/model/decay.cpp
+3
-0
decay.h
src/model/decay.h
+4
-0
evaluator.cpp
src/model/ea/evaluator.cpp
+12
-5
evaluator.h
src/model/ea/evaluator.h
+4
-0
courseTemporalFrameException.h
src/model/exception/courseTemporalFrameException.h
+1
-1
problem.cpp
src/model/problem.cpp
+18
-19
problem.h
src/model/problem.h
+16
-16
profession.cpp
src/model/profession.cpp
+3
-3
profession.h
src/model/profession.h
+5
-5
tools.h
src/model/tools.h
+1
-1
No files found.
application/main.cpp
View file @
79bdf0e8
...
...
@@ -62,6 +62,11 @@ int main(int argc, char* argv[]){
unsigned
int
MINPRE
=
parser
.
createParam
((
unsigned
int
)(
0
),
"minPre"
,
"minimal competency by course"
,
'q'
,
"Param"
).
value
();
unsigned
int
MAXPRE
=
parser
.
createParam
((
unsigned
int
)(
3
),
"maxPre"
,
"maximal competency by course"
,
'Q'
,
"Param"
).
value
();
unsigned
int
CBYTF
=
parser
.
createParam
((
unsigned
int
)(
2
),
"cbyTF"
,
"course by time frame to pick"
,
'A'
,
"Param"
).
value
();
CursusEval
::
WEIGHT_ECTS
=
parser
.
createParam
((
double
)(
1.0
),
"wECTS"
,
"Weight of ECTS in the fitness value"
,
'V'
,
"Param"
).
value
();
CursusEval
::
WEIGHT_REPETION
=
parser
.
createParam
((
double
)(
1.0
),
"wREP"
,
"Weight of Repetition in the fitness value"
,
'v'
,
"Param"
).
value
();
CursusEval
::
WEIGHT_JOB
=
parser
.
createParam
((
double
)(
1.0
),
"wJob"
,
"Weight of profession in the fitness value"
,
'w'
,
"Param"
).
value
();
CursusEval
::
WEIGHT_PREREQ
=
parser
.
createParam
((
double
)(
1.0
),
"wPrereq"
,
"Weight of prerequisites in the fitness value"
,
'W'
,
"Param"
).
value
();
DecayEngine
::
IS_DECAY_DEACTIVATED
=
parser
.
createParam
((
int
)(
0
),
"decayDeactivated"
,
"Wether or not the decay is deactivated"
,
'D'
,
"Param"
).
value
();
//PROFESSION PARAMETERS
unsigned
int
JOB_SEED
=
parser
.
createParam
((
unsigned
int
)(
7777
),
"jobSeed"
,
"Seed used for the Profession"
,
'g'
,
"Param"
).
value
();
...
...
src/model/CMakeLists.txt
View file @
79bdf0e8
...
...
@@ -9,6 +9,7 @@ SET (EXERCICE_SOURCES
course.cpp
profession.cpp
problem.cpp
decay.cpp
)
ADD_LIBRARY
(
lModel STATIC
${
EXERCICE_SOURCES
}
)
...
...
src/model/competency.cpp
View file @
79bdf0e8
...
...
@@ -115,7 +115,7 @@ void Competency::evolveTowards(double d)
}
}
const
double
Competency
::
competencyValue
()
const
double
Competency
::
competencyValue
()
const
{
return
this
->
_m
.
value
();
}
...
...
src/model/competency.h
View file @
79bdf0e8
...
...
@@ -17,14 +17,13 @@
class
Competency
{
private
:
int
_id
;
Magnitude
_m
;
Magnitude
_undecayedMag
;
//Decay related
std
::
string
_name
;
int
_id
;
int
_howLongDecaying
;
//Decay related
bool
_isDecaying
;
//Decay related
//Decay related
Magnitude
_undecayedMag
;
bool
_isDecaying
;
int
_howLongDecaying
;
//Constructor
Competency
(
int
,
Magnitude
,
std
::
string
);
...
...
@@ -58,7 +57,7 @@ class Competency
// === GETTER
///Retrieves the magnitude/mastery value of the competency
const
double
competencyValue
()
const
;
double
competencyValue
()
const
;
///Retrieves the magnitude of the compentecy
const
Magnitude
c_magnitude
()
const
{
return
this
->
_m
;}
Magnitude
&
magnitude
(){
return
this
->
_m
;}
...
...
@@ -66,14 +65,14 @@ class Competency
const
std
::
string
c_name
()
const
{
return
this
->
_name
;}
std
::
string
&
name
()
{
return
this
->
_name
;}
const
int
id
()
const
{
return
this
->
_id
;}
int
id
()
const
{
return
this
->
_id
;}
// === SETTER
void
setMagnitude
(
Magnitude
&
m
){
this
->
_m
=
m
;}
void
setName
(
std
::
string
s
){
this
->
_name
=
s
;}
// === DECAY
const
bool
isDecaying
()
const
{
return
this
->
_isDecaying
;}
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
;}
...
...
src/model/course.cpp
View file @
79bdf0e8
...
...
@@ -239,10 +239,10 @@ bool Course::_lazyEquality(const Course & c) const
}
///@todo
bool
Course
::
_fullEquality
(
const
Course
&
c
)
const
{
throw
NotImplementedException
(
"Course::_fullEquality"
);
}
//
bool Course::_fullEquality(const Course & c) const
//
{
//
throw NotImplementedException("Course::_fullEquality");
//
}
// === OPERATOR
std
::
ostream
&
operator
<<
(
std
::
ostream
&
Stream
,
const
Course
&
c
)
...
...
@@ -251,20 +251,20 @@ std::ostream& operator<<(std::ostream& Stream, const Course & c)
std
::
string
tf
;
if
(
c
.
timeFrame
().
size
()
>
0
)
{
for
(
int
i
=
0
;
i
<
c
.
timeFrame
().
size
()
-
1
;
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
c
.
timeFrame
().
size
()
-
1
;
i
++
)
tf
+=
std
::
to_string
(
c
.
timeFrame
().
at
(
i
))
+
" ; "
;
tf
+=
std
::
to_string
(
c
.
timeFrame
().
at
(
c
.
timeFrame
().
size
()
-
1
));
s
+=
"
\n\t
TimeFrames: ["
+
tf
+
"]"
;
}
s
+=
"
\n\t
Requirement: ["
;
for
(
int
i
=
0
;
i
<
c
.
prerequisites
().
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
c
.
prerequisites
().
size
();
i
++
)
{
s
+=
""
+
c
.
prerequisites
().
at
(
i
).
c_name
()
+
"("
+
std
::
to_string
(
c
.
prerequisites
().
at
(
i
).
c_magnitude
().
value
())
+
") ; "
;
}
s
+=
"]"
;
s
+=
"
\n\t
Teaches: ["
;
for
(
int
i
=
0
;
i
<
c
.
teachedCompetenciesWeighted
().
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
c
.
teachedCompetenciesWeighted
().
size
();
i
++
)
{
s
+=
""
+
c
.
teachedCompetenciesWeighted
().
at
(
i
).
first
.
c_name
()
+
"("
+
std
::
to_string
(
c
.
teachedCompetenciesWeighted
().
at
(
i
).
first
.
c_magnitude
().
value
())
+
") ; "
;
}
...
...
@@ -308,9 +308,9 @@ std::vector<std::vector<Course>> Course::organiseByTF(std::vector<Course> course
std
::
vector
<
std
::
vector
<
Course
>>
coursesByTF
(
timeFrames
.
size
());
int
tmpIdx
;
for
(
int
i
=
0
;
i
<
courses
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
courses
.
size
();
i
++
)
{
for
(
int
j
=
0
;
j
<
courses
.
at
(
i
).
timeFrame
().
size
();
j
++
)
for
(
unsigned
int
j
=
0
;
j
<
courses
.
at
(
i
).
timeFrame
().
size
();
j
++
)
{
tmpIdx
=
courses
.
at
(
i
).
timeFrame
().
at
(
j
)
-
timeFrames
.
at
(
0
);
coursesByTF
.
at
(
tmpIdx
).
push_back
(
courses
.
at
(
i
));
...
...
src/model/course.h
View file @
79bdf0e8
...
...
@@ -30,6 +30,7 @@ class Course
// std::vector<double> diffusionWeight;
// === OTHER
int
_id
;
/// European Credit Transfer and Accumulation System
int
_ects
;
/** Timeframe availablity of a course.
...
...
@@ -38,7 +39,7 @@ class Course
*/
std
::
vector
<
int
>
_temporalAvailability
;
std
::
string
_name
;
int
_id
;
// === FUNC
/// _duplicataProtection returns true if the value (2nd param) searched into (1st param) is found
...
...
@@ -73,9 +74,9 @@ class Course
Course
()
=
default
;
// === GETTER
const
int
id
()
const
{
return
this
->
_id
;};
int
id
()
const
{
return
this
->
_id
;};
const
std
::
string
name
()
const
{
return
this
->
_name
;};
const
int
ects
()
const
{
return
this
->
_ects
;}
int
ects
()
const
{
return
this
->
_ects
;}
const
std
::
vector
<
Competency
>
prerequisites
()
const
{
return
this
->
_prerequisites
;}
std
::
vector
<
Competency
>&
unlocked_prerequisites
()
{
return
this
->
_prerequisites
;}
const
std
::
vector
<
int
>
timeFrame
()
const
{
return
this
->
_temporalAvailability
;}
...
...
src/model/decay.cpp
0 → 100644
View file @
79bdf0e8
#include "decay.h"
int
DecayEngine
::
IS_DECAY_DEACTIVATED
=
0
;
\ No newline at end of file
src/model/decay.h
View file @
79bdf0e8
...
...
@@ -2,16 +2,20 @@
#define SRC_MODEL_DECAY_H_
#include <cmath>
#include <iostream>
class
DecayEngine
{
private
:
public
:
static
int
IS_DECAY_DEACTIVATED
;
/** Expresses the decay over the time x.
*/
static
double
defaultDecay
(
int
t
)
{
if
(
IS_DECAY_DEACTIVATED
)
return
0
;
if
(
t
==
0
)
return
0
;
return
(
exp
(
t
/
1
.
25
)
+
5
)
/
100
;
...
...
src/model/ea/evaluator.cpp
View file @
79bdf0e8
#include "evaluator.h"
#include "../tools.h"
double
CursusEval
::
WEIGHT_ECTS
=
1
;
double
CursusEval
::
WEIGHT_REPETION
=
1
;
double
CursusEval
::
WEIGHT_JOB
=
1
;
double
CursusEval
::
WEIGHT_PREREQ
=
1
;
void
CursusEval
::
operator
()(
Cursus
&
_cursus
){
double
fit
=
0.0
;
int
pCE
,
pCP
,
pCR
,
pCPR
;
double
pCE
,
pCP
,
pCR
,
pCPR
;
pCE
=
1
;
pCR
=
1
;
pCP
=
1
;
pCPR
=
1
;
pCE
=
WEIGHT_ECTS
;
pCR
=
WEIGHT_REPETION
;
pCP
=
WEIGHT_JOB
;
pCPR
=
WEIGHT_PREREQ
;
std
::
pair
<
bool
,
double
>
resCE
;
std
::
pair
<
bool
,
double
>
resCP
;
...
...
src/model/ea/evaluator.h
View file @
79bdf0e8
...
...
@@ -17,6 +17,10 @@ public:
void
operator
()(
Cursus
&
_cursus
);
static
double
WEIGHT_ECTS
;
static
double
WEIGHT_REPETION
;
static
double
WEIGHT_JOB
;
static
double
WEIGHT_PREREQ
;
private
:
ConstraintsPrerequisites
cpr
;
...
...
src/model/exception/courseTemporalFrameException.h
View file @
79bdf0e8
...
...
@@ -30,7 +30,7 @@ class CourseTemporalFrameException : public std::exception
}
Course
&
getCourse
()
const
{
return
*
(
this
->
_course
);}
const
int
getTime
()
const
{
return
this
->
_time
;}
int
getTime
()
const
{
return
this
->
_time
;}
};
#endif // SRC_MODEL_EXCEPTION_COURSE_TEMPORAL_FRAME_EXCEPTION_H_
\ No newline at end of file
src/model/problem.cpp
View file @
79bdf0e8
...
...
@@ -80,9 +80,9 @@ int CSDVP::CSDVP_COUNTER = 0;
void
CSDVP
::
setTimeFrames
(
std
::
vector
<
int
>
&
v
)
{
this
->
_timeFrames
=
v
;}
void
CSDVP
::
setCoursesCatalogue
(
std
::
vector
<
Course
>
&
c
)
{
this
->
_availableCourses
;}
{
this
->
_availableCourses
=
c
;}
void
CSDVP
::
setCompetenciesCatalogue
(
std
::
vector
<
Competency
>
&
c
)
{
this
->
_availableCompentecies
;}
{
this
->
_availableCompentecies
=
c
;}
// ADDER
bool
CSDVP
::
addTimeFrame
(
int
tF
)
{
...
...
@@ -167,13 +167,13 @@ int CSDVP::CSDVP_COUNTER = 0;
void
CSDVP
::
_makeCoursesSortedByTF
()
{
//Init the vector of the size of the time frames
for
(
int
i
=
0
;
i
<
this
->
_timeFrames
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
this
->
_timeFrames
.
size
();
i
++
)
this
->
_coursesSortedByTF
.
push_back
(
std
::
vector
<
Course
>
());
int
tmpIdx
;
for
(
int
i
=
0
;
i
<
this
->
_availableCourses
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
this
->
_availableCourses
.
size
();
i
++
)
{
for
(
int
j
=
0
;
j
<
this
->
_availableCourses
.
at
(
i
).
timeFrame
().
size
();
j
++
)
for
(
unsigned
int
j
=
0
;
j
<
this
->
_availableCourses
.
at
(
i
).
timeFrame
().
size
();
j
++
)
{
tmpIdx
=
this
->
_availableCourses
.
at
(
i
).
timeFrame
().
at
(
j
)
-
this
->
_minimalTimeFrame
;
this
->
_coursesSortedByTF
.
at
(
tmpIdx
).
push_back
(
this
->
_availableCourses
.
at
(
i
));
...
...
@@ -182,7 +182,7 @@ int CSDVP::CSDVP_COUNTER = 0;
}
int
CSDVP
::
mapCourseToPosition
(
const
Course
&
c
)
{
for
(
int
i
=
0
;
i
<
this
->
coursesCatalogue
().
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
this
->
coursesCatalogue
().
size
();
i
++
)
if
(
c
==
this
->
coursesCatalogue
().
at
(
i
))
return
i
;
return
-
1
;
...
...
@@ -217,10 +217,10 @@ int CSDVP::CSDVP_COUNTER = 0;
return
min
+
(
rand
()
%
(
max
-
min
+
1
)
);
}
double
CSDVP
::
_randomizeIn
(
const
double
min
,
const
double
max
)
{
throw
NotImplementedException
(
"CSDVP::_randomizeIn"
);
}
//
double CSDVP::_randomizeIn(const double min, const double max)
//
{
//
throw NotImplementedException("CSDVP::_randomizeIn");
//
}
void
CSDVP
::
randomizeProblem
(
CSDVP
&
pb
,
int
seed
)
{
...
...
@@ -266,10 +266,10 @@ int CSDVP::CSDVP_COUNTER = 0;
*/
std
::
vector
<
int
>
idxCourses
;
std
::
vector
<
int
>
nbCoursesByTF
;
for
(
int
i
=
0
;
i
<
pb
.
timeFrames
().
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
pb
.
timeFrames
().
size
();
i
++
)
nbCoursesByTF
.
push_back
(
CSDVP
::
_randomizeIn
(
pb
.
_minimalCoursesByTimeFrame
,
pb
.
_maximalCoursesByTimeFrame
));
int
idxCoursesCounter
=
0
;
for
(
int
i
=
0
;
i
<
nbCoursesByTF
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
nbCoursesByTF
.
size
();
i
++
)
{
for
(
int
j
=
0
;
j
<
nbCoursesByTF
.
at
(
i
);
j
++
)
{
...
...
@@ -282,12 +282,11 @@ int CSDVP::CSDVP_COUNTER = 0;
bool
insertRez
;
int
rndIdx
;
idxCoursesCounter
=
0
;
for
(
int
i
=
0
;
i
<
pb
.
timeFrames
().
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
pb
.
timeFrames
().
size
();
i
++
)
{
for
(
int
j
=
0
;
j
<
nbCoursesByTF
.
at
(
i
);
j
++
)
{
insertRez
=
true
;
int
cc
=
idxCourses
.
at
(
idxCoursesCounter
);
insertRez
=
tmpCourses
.
at
(
idxCourses
.
at
(
idxCoursesCounter
)).
addTemporalFrame
(
pb
.
timeFrames
().
at
(
i
));
while
(
!
insertRez
)
//if duplicataProtection (i.e. course already in this semester)
...
...
@@ -319,7 +318,7 @@ int CSDVP::CSDVP_COUNTER = 0;
// }
// }
for
(
int
i
=
0
;
i
<
tmpCourses
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
tmpCourses
.
size
();
i
++
)
if
(
tmpCourses
.
at
(
i
).
timeFrame
().
size
()
>
0
)
pb
.
addCourseToCatalogue
(
tmpCourses
.
at
(
i
));
...
...
@@ -349,14 +348,14 @@ int CSDVP::CSDVP_COUNTER = 0;
std
::
vector
<
Competency
>
randomVec
(
pb
.
competencyCatalogue
());
std
::
random_shuffle
(
randomVec
.
begin
(),
randomVec
.
end
());
std
::
queue
<
Competency
>
queue
;
for
(
int
i
=
0
;
i
<
randomVec
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
randomVec
.
size
();
i
++
)
queue
.
push
(
randomVec
.
at
(
i
));
int
x
;
Competency
tmpComp
;
std
::
pair
<
Competency
,
double
>
teachedComp
;
for
(
int
i
=
0
;
i
<
pb
.
coursesCatalogue
().
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
pb
.
coursesCatalogue
().
size
();
i
++
)
{
x
=
_randomizeIn
(
pb
.
cfg_competencyByCourseMin
(),
pb
.
cfg_competencyByCourseMax
());
for
(
int
j
=
0
;
j
<
x
;
j
++
)
...
...
@@ -375,10 +374,10 @@ int CSDVP::CSDVP_COUNTER = 0;
*/
std
::
random_shuffle
(
randomVec
.
begin
(),
randomVec
.
end
());
queue
=
std
::
queue
<
Competency
>
();
for
(
int
i
=
0
;
i
<
randomVec
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
randomVec
.
size
();
i
++
)
queue
.
push
(
randomVec
.
at
(
i
));
for
(
int
i
=
0
;
i
<
pb
.
coursesCatalogue
().
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
pb
.
coursesCatalogue
().
size
();
i
++
)
{
x
=
_randomizeIn
(
pb
.
cfg_prerequisiteByCourseMin
(),
pb
.
cfg_prerequisiteByCourseMax
());
for
(
int
j
=
0
;
j
<
x
;
j
++
)
...
...
src/model/problem.h
View file @
79bdf0e8
...
...
@@ -102,21 +102,21 @@ class CSDVP
static
void
generateProblem
(
CSDVP
&
csdvp
,
CSDVP
::
GenerationType
type
,
int
seed
=
-
1
);
// === GETTER
const
int
id
()
const
{
return
this
->
_id
;}
const
int
seed
()
const
{
return
this
->
_seed
;}
const
int
cfg_quantityCompetencies
()
const
{
return
this
->
_quantityAvailableCompetencies
;}
const
int
cfg_quantityCourses
()
const
{
return
this
->
_quantityAvailableCourses
;}
const
int
cfg_minimalTimeFrame
()
const
{
return
this
->
_minimalTimeFrame
;}
const
int
cfg_maximalTimeFrame
()
const
{
return
this
->
_maximalTimeFrame
;}
const
int
cfg_ectsMax
()
const
{
return
this
->
_maximalECTSValue
;}
const
int
cfg_ectsMin
()
const
{
return
this
->
_minimalECTSValue
;}
const
int
cfg_courseByTFMax
()
const
{
return
this
->
_maximalCoursesByTimeFrame
;}
const
int
cfg_courseByTFMin
()
const
{
return
this
->
_minimalCoursesByTimeFrame
;}
const
int
cfg_competencyByCourseMin
()
const
{
return
this
->
_minimalCompetencyByCourse
;}
const
int
cfg_competencyByCourseMax
()
const
{
return
this
->
_maximalCompetencyByCourse
;}
const
int
cfg_prerequisiteByCourseMin
()
const
{
return
this
->
_minimalPrerequisiteByCourse
;}
const
int
cfg_prerequisiteByCourseMax
()
const
{
return
this
->
_maximalPrerequisiteByCourse
;}
const
int
cfg_pickedCoursesByTimeFrame
()
const
{
return
this
->
_pickedCoursesByTimeFrame
;}
int
id
()
const
{
return
this
->
_id
;}
int
seed
()
const
{
return
this
->
_seed
;}
int
cfg_quantityCompetencies
()
const
{
return
this
->
_quantityAvailableCompetencies
;}
int
cfg_quantityCourses
()
const
{
return
this
->
_quantityAvailableCourses
;}
int
cfg_minimalTimeFrame
()
const
{
return
this
->
_minimalTimeFrame
;}
int
cfg_maximalTimeFrame
()
const
{
return
this
->
_maximalTimeFrame
;}
int
cfg_ectsMax
()
const
{
return
this
->
_maximalECTSValue
;}
int
cfg_ectsMin
()
const
{
return
this
->
_minimalECTSValue
;}
int
cfg_courseByTFMax
()
const
{
return
this
->
_maximalCoursesByTimeFrame
;}
int
cfg_courseByTFMin
()
const
{
return
this
->
_minimalCoursesByTimeFrame
;}
int
cfg_competencyByCourseMin
()
const
{
return
this
->
_minimalCompetencyByCourse
;}
int
cfg_competencyByCourseMax
()
const
{
return
this
->
_maximalCompetencyByCourse
;}
int
cfg_prerequisiteByCourseMin
()
const
{
return
this
->
_minimalPrerequisiteByCourse
;}
int
cfg_prerequisiteByCourseMax
()
const
{
return
this
->
_maximalPrerequisiteByCourse
;}
int
cfg_pickedCoursesByTimeFrame
()
const
{
return
this
->
_pickedCoursesByTimeFrame
;}
const
Magnitude
&
cfg_magnitudeMin
()
const
{
return
this
->
_minimalMagnitude
;}
const
Magnitude
&
cfg_magnitudeMax
()
const
{
return
this
->
_maximalMagnitude
;}
...
...
@@ -131,7 +131,7 @@ class CSDVP
std
::
vector
<
Course
>
&
unlocked_coursesCatalogue
(){
return
this
->
_availableCourses
;}
std
::
vector
<
Competency
>
&
unlocked_competenciesCatalogue
(){
return
this
->
_availableCompentecies
;}
const
int
getQuantityCoursesToPick
()
const
{
int
getQuantityCoursesToPick
()
const
{
if
(
this
->
_isConfig
)
return
this
->
_timeFrames
.
size
()
*
this
->
_pickedCoursesByTimeFrame
;
return
-
1
;
//if not config
...
...
src/model/profession.cpp
View file @
79bdf0e8
...
...
@@ -112,7 +112,7 @@ std::ostream & operator<<(std::ostream & Stream, const Profession & p)
{
std
::
string
s
=
"Profession
\n\t
id:"
+
std
::
to_string
(
p
.
id
())
+
"
\n\t
Name:"
+
p
.
name
()
+
"
\n\t
ECTS: "
+
std
::
to_string
(
p
.
requiredECTS
())
+
"
\n\t
#Prereq:"
+
std
::
to_string
(
p
.
prerequisites
().
size
())
+
"
\n\t
===Details:===
\n\t
"
;
Stream
<<
s
;
for
(
int
i
=
0
;
i
<
p
.
prerequisites
().
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
p
.
prerequisites
().
size
();
i
++
)
Stream
<<
"("
<<
i
<<
"th) "
<<
p
.
prerequisites
().
at
(
i
)
<<
"
\n\t
"
;
Stream
<<
"=========="
<<
std
::
endl
;
return
Stream
;
...
...
@@ -170,7 +170,7 @@ void Profession::_randomlyGenerate(Profession & job, CSDVP & pb)
std
::
random_shuffle
(
tmpComp
.
begin
(),
tmpComp
.
end
());
int
i
;
for
(
i
=
0
;
i
<
tmpComp
.
size
()
&&
i
<
howManyPrereq
;
i
++
)
for
(
i
=
0
;
i
<
(
int
)
tmpComp
.
size
()
&&
i
<
howManyPrereq
;
i
++
)
{
magVal
=
job
.
cfg_minimalMagnitude
().
value
()
+
(
(
double
)
rand
()
/
RAND_MAX
)
*
(
job
.
cfg_maximalMagnitude
().
value
()
-
job
.
cfg_minimalMagnitude
().
value
())
;
ctmp
=
Competency
::
buildTMP
(
magVal
,
tmpComp
.
at
(
i
).
name
());
...
...
@@ -196,7 +196,7 @@ void Profession::_randomlyGenerate(Profession & job, CSDVP & pb)
// ects = pb.timeFrames().size() * 30; //30 is the default european value
for
(
i
=
0
;
i
<
pb
.
timeFrames
().
size
();
i
++
)
for
(
i
=
0
;
i
<
(
int
)
pb
.
timeFrames
().
size
();
i
++
)
{
for
(
int
j
=
0
;
j
<
pb
.
cfg_pickedCoursesByTimeFrame
();
j
++
)
{
...
...
src/model/profession.h
View file @
79bdf0e8
...
...
@@ -65,16 +65,16 @@ class Profession
bool
checkConfig
();
// === GETTER
const
int
id
()
const
{
return
this
->
_id
;}
const
int
seed
()
const
{
return
this
->
_seed
;}
const
int
requiredECTS
()
const
{
return
this
->
_requiredECTS
;}
int
id
()
const
{
return
this
->
_id
;}
int
seed
()
const
{
return
this
->
_seed
;}
int
requiredECTS
()
const
{
return
this
->
_requiredECTS
;}
const
std
::
string
name
()
const
{
return
this
->
_name
;}
const
std
::
vector
<
Competency
>
&
prerequisites
()
const
{
return
this
->
_prerequisites
;}
/// return a modifiable reference to _prerequisite;
std
::
vector
<
Competency
>
&
unlocked_prerequisites
(){
return
this
->
_prerequisites
;}
const
int
cfg_minimalPrerequisites
()
const
{
return
this
->
_minimalPrerequisites
;}
const
int
cfg_maximalPrerequisites
()
const
{
return
this
->
_maximalPrerequisites
;}
int
cfg_minimalPrerequisites
()
const
{
return
this
->
_minimalPrerequisites
;}
int
cfg_maximalPrerequisites
()
const
{
return
this
->
_maximalPrerequisites
;}
const
Magnitude
cfg_minimalMagnitude
()
const
{
return
this
->
_minimalMagnitude
;}
const
Magnitude
cfg_maximalMagnitude
()
const
{
return
this
->
_maximalMagnitude
;}
...
...
src/model/tools.h
View file @
79bdf0e8
...
...
@@ -22,7 +22,7 @@ static std::pair<int, T> findInVector(std::vector<T> & vec, T & findMe)
if
(
it
==
vec
.
end
())
{
res
.
first
=
-
1
;
res
.
second
;
//NTD, -1 SHOULD BE USED TO DETECT THAT NOTHING HAS BEEN FOUND
//
res.second; //NTD, -1 SHOULD BE USED TO DETECT THAT NOTHING HAS BEEN FOUND
}
else
{
...
...
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