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
d048501d
Commit
d048501d
authored
Jun 04, 2020
by
Alexis Lebis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleaning some warnings
parent
b4032fe0
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
66 additions
and
67 deletions
+66
-67
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
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.
src/model/competency.cpp
View file @
d048501d
...
@@ -115,7 +115,7 @@ void Competency::evolveTowards(double d)
...
@@ -115,7 +115,7 @@ void Competency::evolveTowards(double d)
}
}
}
}
const
double
Competency
::
competencyValue
()
const
double
Competency
::
competencyValue
()
const
{
{
return
this
->
_m
.
value
();
return
this
->
_m
.
value
();
}
}
...
...
src/model/competency.h
View file @
d048501d
...
@@ -17,14 +17,13 @@
...
@@ -17,14 +17,13 @@
class
Competency
class
Competency
{
{
private
:
private
:
int
_id
;
Magnitude
_m
;
Magnitude
_m
;
Magnitude
_undecayedMag
;
//Decay related
std
::
string
_name
;
std
::
string
_name
;
int
_id
;
int
_howLongDecaying
;
//Decay related
bool
_isDecaying
;
//Decay related
//Decay related
Magnitude
_undecayedMag
;
bool
_isDecaying
;
int
_howLongDecaying
;
//Constructor
//Constructor
Competency
(
int
,
Magnitude
,
std
::
string
);
Competency
(
int
,
Magnitude
,
std
::
string
);
...
@@ -58,7 +57,7 @@ class Competency
...
@@ -58,7 +57,7 @@ class Competency
// === GETTER
// === GETTER
///Retrieves the magnitude/mastery value of the competency
///Retrieves the magnitude/mastery value of the competency
const
double
competencyValue
()
const
;
double
competencyValue
()
const
;
///Retrieves the magnitude of the compentecy
///Retrieves the magnitude of the compentecy
const
Magnitude
c_magnitude
()
const
{
return
this
->
_m
;}
const
Magnitude
c_magnitude
()
const
{
return
this
->
_m
;}
Magnitude
&
magnitude
(){
return
this
->
_m
;}
Magnitude
&
magnitude
(){
return
this
->
_m
;}
...
@@ -66,14 +65,14 @@ class Competency
...
@@ -66,14 +65,14 @@ class Competency
const
std
::
string
c_name
()
const
{
return
this
->
_name
;}
const
std
::
string
c_name
()
const
{
return
this
->
_name
;}
std
::
string
&
name
()
{
return
this
->
_name
;}
std
::
string
&
name
()
{
return
this
->
_name
;}
const
int
id
()
const
{
return
this
->
_id
;}
int
id
()
const
{
return
this
->
_id
;}
// === SETTER
// === SETTER
void
setMagnitude
(
Magnitude
&
m
){
this
->
_m
=
m
;}
void
setMagnitude
(
Magnitude
&
m
){
this
->
_m
=
m
;}
void
setName
(
std
::
string
s
){
this
->
_name
=
s
;}
void
setName
(
std
::
string
s
){
this
->
_name
=
s
;}
// === DECAY
// === DECAY
const
bool
isDecaying
()
const
{
return
this
->
_isDecaying
;}
bool
isDecaying
()
const
{
return
this
->
_isDecaying
;}
void
decayState
(
bool
state
)
{
this
->
_isDecaying
=
state
;}
void
decayState
(
bool
state
)
{
this
->
_isDecaying
=
state
;}
int
increaseDecay
(){
this
->
_isDecaying
=
true
;
this
->
_howLongDecaying
++
;
return
this
->
_howLongDecaying
;}
int
increaseDecay
(){
this
->
_isDecaying
=
true
;
this
->
_howLongDecaying
++
;
return
this
->
_howLongDecaying
;}
void
resetDecay
(){
this
->
_isDecaying
=
false
;
this
->
_howLongDecaying
=
0
;}
void
resetDecay
(){
this
->
_isDecaying
=
false
;
this
->
_howLongDecaying
=
0
;}
...
...
src/model/course.cpp
View file @
d048501d
...
@@ -239,10 +239,10 @@ bool Course::_lazyEquality(const Course & c) const
...
@@ -239,10 +239,10 @@ bool Course::_lazyEquality(const Course & c) const
}
}
///@todo
///@todo
bool
Course
::
_fullEquality
(
const
Course
&
c
)
const
//
bool Course::_fullEquality(const Course & c) const
{
//
{
throw
NotImplementedException
(
"Course::_fullEquality"
);
//
throw NotImplementedException("Course::_fullEquality");
}
//
}
// === OPERATOR
// === OPERATOR
std
::
ostream
&
operator
<<
(
std
::
ostream
&
Stream
,
const
Course
&
c
)
std
::
ostream
&
operator
<<
(
std
::
ostream
&
Stream
,
const
Course
&
c
)
...
@@ -251,20 +251,20 @@ 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
;
std
::
string
tf
;
if
(
c
.
timeFrame
().
size
()
>
0
)
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
(
i
))
+
" ; "
;
tf
+=
std
::
to_string
(
c
.
timeFrame
().
at
(
c
.
timeFrame
().
size
()
-
1
));
tf
+=
std
::
to_string
(
c
.
timeFrame
().
at
(
c
.
timeFrame
().
size
()
-
1
));
s
+=
"
\n\t
TimeFrames: ["
+
tf
+
"]"
;
s
+=
"
\n\t
TimeFrames: ["
+
tf
+
"]"
;
}
}
s
+=
"
\n\t
Requirement: ["
;
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
+=
""
+
c
.
prerequisites
().
at
(
i
).
c_name
()
+
"("
+
std
::
to_string
(
c
.
prerequisites
().
at
(
i
).
c_magnitude
().
value
())
+
") ; "
;
}
}
s
+=
"]"
;
s
+=
"]"
;
s
+=
"
\n\t
Teaches: ["
;
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
())
+
") ; "
;
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
...
@@ -308,9 +308,9 @@ std::vector<std::vector<Course>> Course::organiseByTF(std::vector<Course> course
std
::
vector
<
std
::
vector
<
Course
>>
coursesByTF
(
timeFrames
.
size
());
std
::
vector
<
std
::
vector
<
Course
>>
coursesByTF
(
timeFrames
.
size
());
int
tmpIdx
;
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
);
tmpIdx
=
courses
.
at
(
i
).
timeFrame
().
at
(
j
)
-
timeFrames
.
at
(
0
);
coursesByTF
.
at
(
tmpIdx
).
push_back
(
courses
.
at
(
i
));
coursesByTF
.
at
(
tmpIdx
).
push_back
(
courses
.
at
(
i
));
...
...
src/model/course.h
View file @
d048501d
...
@@ -30,6 +30,7 @@ class Course
...
@@ -30,6 +30,7 @@ class Course
// std::vector<double> diffusionWeight;
// std::vector<double> diffusionWeight;
// === OTHER
// === OTHER
int
_id
;
/// European Credit Transfer and Accumulation System
/// European Credit Transfer and Accumulation System
int
_ects
;
int
_ects
;
/** Timeframe availablity of a course.
/** Timeframe availablity of a course.
...
@@ -38,7 +39,7 @@ class Course
...
@@ -38,7 +39,7 @@ class Course
*/
*/
std
::
vector
<
int
>
_temporalAvailability
;
std
::
vector
<
int
>
_temporalAvailability
;
std
::
string
_name
;
std
::
string
_name
;
int
_id
;
// === FUNC
// === FUNC
/// _duplicataProtection returns true if the value (2nd param) searched into (1st param) is found
/// _duplicataProtection returns true if the value (2nd param) searched into (1st param) is found
...
@@ -73,9 +74,9 @@ class Course
...
@@ -73,9 +74,9 @@ class Course
Course
()
=
default
;
Course
()
=
default
;
// === GETTER
// === GETTER
const
int
id
()
const
{
return
this
->
_id
;};
int
id
()
const
{
return
this
->
_id
;};
const
std
::
string
name
()
const
{
return
this
->
_name
;};
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
;}
const
std
::
vector
<
Competency
>
prerequisites
()
const
{
return
this
->
_prerequisites
;}
std
::
vector
<
Competency
>&
unlocked_prerequisites
()
{
return
this
->
_prerequisites
;}
std
::
vector
<
Competency
>&
unlocked_prerequisites
()
{
return
this
->
_prerequisites
;}
const
std
::
vector
<
int
>
timeFrame
()
const
{
return
this
->
_temporalAvailability
;}
const
std
::
vector
<
int
>
timeFrame
()
const
{
return
this
->
_temporalAvailability
;}
...
...
src/model/exception/courseTemporalFrameException.h
View file @
d048501d
...
@@ -30,7 +30,7 @@ class CourseTemporalFrameException : public std::exception
...
@@ -30,7 +30,7 @@ class CourseTemporalFrameException : public std::exception
}
}
Course
&
getCourse
()
const
{
return
*
(
this
->
_course
);}
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_
#endif // SRC_MODEL_EXCEPTION_COURSE_TEMPORAL_FRAME_EXCEPTION_H_
\ No newline at end of file
src/model/problem.cpp
View file @
d048501d
...
@@ -80,9 +80,9 @@ int CSDVP::CSDVP_COUNTER = 0;
...
@@ -80,9 +80,9 @@ int CSDVP::CSDVP_COUNTER = 0;
void
CSDVP
::
setTimeFrames
(
std
::
vector
<
int
>
&
v
)
void
CSDVP
::
setTimeFrames
(
std
::
vector
<
int
>
&
v
)
{
this
->
_timeFrames
=
v
;}
{
this
->
_timeFrames
=
v
;}
void
CSDVP
::
setCoursesCatalogue
(
std
::
vector
<
Course
>
&
c
)
void
CSDVP
::
setCoursesCatalogue
(
std
::
vector
<
Course
>
&
c
)
{
this
->
_availableCourses
;}
{
this
->
_availableCourses
=
c
;}
void
CSDVP
::
setCompetenciesCatalogue
(
std
::
vector
<
Competency
>
&
c
)
void
CSDVP
::
setCompetenciesCatalogue
(
std
::
vector
<
Competency
>
&
c
)
{
this
->
_availableCompentecies
;}
{
this
->
_availableCompentecies
=
c
;}
// ADDER
// ADDER
bool
CSDVP
::
addTimeFrame
(
int
tF
)
bool
CSDVP
::
addTimeFrame
(
int
tF
)
{
{
...
@@ -167,13 +167,13 @@ int CSDVP::CSDVP_COUNTER = 0;
...
@@ -167,13 +167,13 @@ int CSDVP::CSDVP_COUNTER = 0;
void
CSDVP
::
_makeCoursesSortedByTF
()
void
CSDVP
::
_makeCoursesSortedByTF
()
{
{
//Init the vector of the size of the time frames
//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
>
());
this
->
_coursesSortedByTF
.
push_back
(
std
::
vector
<
Course
>
());
int
tmpIdx
;
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
;
tmpIdx
=
this
->
_availableCourses
.
at
(
i
).
timeFrame
().
at
(
j
)
-
this
->
_minimalTimeFrame
;
this
->
_coursesSortedByTF
.
at
(
tmpIdx
).
push_back
(
this
->
_availableCourses
.
at
(
i
));
this
->
_coursesSortedByTF
.
at
(
tmpIdx
).
push_back
(
this
->
_availableCourses
.
at
(
i
));
...
@@ -182,7 +182,7 @@ int CSDVP::CSDVP_COUNTER = 0;
...
@@ -182,7 +182,7 @@ int CSDVP::CSDVP_COUNTER = 0;
}
}
int
CSDVP
::
mapCourseToPosition
(
const
Course
&
c
)
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
))
if
(
c
==
this
->
coursesCatalogue
().
at
(
i
))
return
i
;
return
i
;
return
-
1
;
return
-
1
;
...
@@ -217,10 +217,10 @@ int CSDVP::CSDVP_COUNTER = 0;
...
@@ -217,10 +217,10 @@ int CSDVP::CSDVP_COUNTER = 0;
return
min
+
(
rand
()
%
(
max
-
min
+
1
)
);
return
min
+
(
rand
()
%
(
max
-
min
+
1
)
);
}
}
double
CSDVP
::
_randomizeIn
(
const
double
min
,
const
double
max
)
//
double CSDVP::_randomizeIn(const double min, const double max)
{
//
{
throw
NotImplementedException
(
"CSDVP::_randomizeIn"
);
//
throw NotImplementedException("CSDVP::_randomizeIn");
}
//
}
void
CSDVP
::
randomizeProblem
(
CSDVP
&
pb
,
int
seed
)
void
CSDVP
::
randomizeProblem
(
CSDVP
&
pb
,
int
seed
)
{
{
...
@@ -266,10 +266,10 @@ int CSDVP::CSDVP_COUNTER = 0;
...
@@ -266,10 +266,10 @@ int CSDVP::CSDVP_COUNTER = 0;
*/
*/
std
::
vector
<
int
>
idxCourses
;
std
::
vector
<
int
>
idxCourses
;
std
::
vector
<
int
>
nbCoursesByTF
;
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
));
nbCoursesByTF
.
push_back
(
CSDVP
::
_randomizeIn
(
pb
.
_minimalCoursesByTimeFrame
,
pb
.
_maximalCoursesByTimeFrame
));
int
idxCoursesCounter
=
0
;
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
++
)
for
(
int
j
=
0
;
j
<
nbCoursesByTF
.
at
(
i
);
j
++
)
{
{
...
@@ -282,12 +282,11 @@ int CSDVP::CSDVP_COUNTER = 0;
...
@@ -282,12 +282,11 @@ int CSDVP::CSDVP_COUNTER = 0;
bool
insertRez
;
bool
insertRez
;
int
rndIdx
;
int
rndIdx
;
idxCoursesCounter
=
0
;
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
++
)
for
(
int
j
=
0
;
j
<
nbCoursesByTF
.
at
(
i
);
j
++
)
{
{
insertRez
=
true
;
insertRez
=
true
;
int
cc
=
idxCourses
.
at
(
idxCoursesCounter
);
insertRez
=
tmpCourses
.
at
(
idxCourses
.
at
(
idxCoursesCounter
)).
addTemporalFrame
(
pb
.
timeFrames
().
at
(
i
));
insertRez
=
tmpCourses
.
at
(
idxCourses
.
at
(
idxCoursesCounter
)).
addTemporalFrame
(
pb
.
timeFrames
().
at
(
i
));
while
(
!
insertRez
)
//if duplicataProtection (i.e. course already in this semester)
while
(
!
insertRez
)
//if duplicataProtection (i.e. course already in this semester)
...
@@ -319,7 +318,7 @@ int CSDVP::CSDVP_COUNTER = 0;
...
@@ -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
)
if
(
tmpCourses
.
at
(
i
).
timeFrame
().
size
()
>
0
)
pb
.
addCourseToCatalogue
(
tmpCourses
.
at
(
i
));
pb
.
addCourseToCatalogue
(
tmpCourses
.
at
(
i
));
...
@@ -349,14 +348,14 @@ int CSDVP::CSDVP_COUNTER = 0;
...
@@ -349,14 +348,14 @@ int CSDVP::CSDVP_COUNTER = 0;
std
::
vector
<
Competency
>
randomVec
(
pb
.
competencyCatalogue
());
std
::
vector
<
Competency
>
randomVec
(
pb
.
competencyCatalogue
());
std
::
random_shuffle
(
randomVec
.
begin
(),
randomVec
.
end
());
std
::
random_shuffle
(
randomVec
.
begin
(),
randomVec
.
end
());
std
::
queue
<
Competency
>
queue
;
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
));
queue
.
push
(
randomVec
.
at
(
i
));
int
x
;
int
x
;
Competency
tmpComp
;
Competency
tmpComp
;
std
::
pair
<
Competency
,
double
>
teachedComp
;
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
());
x
=
_randomizeIn
(
pb
.
cfg_competencyByCourseMin
(),
pb
.
cfg_competencyByCourseMax
());
for
(
int
j
=
0
;
j
<
x
;
j
++
)
for
(
int
j
=
0
;
j
<
x
;
j
++
)
...
@@ -375,10 +374,10 @@ int CSDVP::CSDVP_COUNTER = 0;
...
@@ -375,10 +374,10 @@ int CSDVP::CSDVP_COUNTER = 0;
*/
*/
std
::
random_shuffle
(
randomVec
.
begin
(),
randomVec
.
end
());
std
::
random_shuffle
(
randomVec
.
begin
(),
randomVec
.
end
());
queue
=
std
::
queue
<
Competency
>
();
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
));
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
());
x
=
_randomizeIn
(
pb
.
cfg_prerequisiteByCourseMin
(),
pb
.
cfg_prerequisiteByCourseMax
());
for
(
int
j
=
0
;
j
<
x
;
j
++
)
for
(
int
j
=
0
;
j
<
x
;
j
++
)
...
...
src/model/problem.h
View file @
d048501d
...
@@ -102,21 +102,21 @@ class CSDVP
...
@@ -102,21 +102,21 @@ class CSDVP
static
void
generateProblem
(
CSDVP
&
csdvp
,
CSDVP
::
GenerationType
type
,
int
seed
=
-
1
);
static
void
generateProblem
(
CSDVP
&
csdvp
,
CSDVP
::
GenerationType
type
,
int
seed
=
-
1
);
// === GETTER
// === GETTER
const
int
id
()
const
{
return
this
->
_id
;}
int
id
()
const
{
return
this
->
_id
;}
const
int
seed
()
const
{
return
this
->
_seed
;}
int
seed
()
const
{
return
this
->
_seed
;}
const
int
cfg_quantityCompetencies
()
const
{
return
this
->
_quantityAvailableCompetencies
;}
int
cfg_quantityCompetencies
()
const
{
return
this
->
_quantityAvailableCompetencies
;}
const
int
cfg_quantityCourses
()
const
{
return
this
->
_quantityAvailableCourses
;}
int
cfg_quantityCourses
()
const
{
return
this
->
_quantityAvailableCourses
;}
const
int
cfg_minimalTimeFrame
()
const
{
return
this
->
_minimalTimeFrame
;}
int
cfg_minimalTimeFrame
()
const
{
return
this
->
_minimalTimeFrame
;}
const
int
cfg_maximalTimeFrame
()
const
{
return
this
->
_maximalTimeFrame
;}
int
cfg_maximalTimeFrame
()
const
{
return
this
->
_maximalTimeFrame
;}
const
int
cfg_ectsMax
()
const
{
return
this
->
_maximalECTSValue
;}
int
cfg_ectsMax
()
const
{
return
this
->
_maximalECTSValue
;}
const
int
cfg_ectsMin
()
const
{
return
this
->
_minimalECTSValue
;}
int
cfg_ectsMin
()
const
{
return
this
->
_minimalECTSValue
;}
const
int
cfg_courseByTFMax
()
const
{
return
this
->
_maximalCoursesByTimeFrame
;}
int
cfg_courseByTFMax
()
const
{
return
this
->
_maximalCoursesByTimeFrame
;}
const
int
cfg_courseByTFMin
()
const
{
return
this
->
_minimalCoursesByTimeFrame
;}
int
cfg_courseByTFMin
()
const
{
return
this
->
_minimalCoursesByTimeFrame
;}
const
int
cfg_competencyByCourseMin
()
const
{
return
this
->
_minimalCompetencyByCourse
;}
int
cfg_competencyByCourseMin
()
const
{
return
this
->
_minimalCompetencyByCourse
;}
const
int
cfg_competencyByCourseMax
()
const
{
return
this
->
_maximalCompetencyByCourse
;}
int
cfg_competencyByCourseMax
()
const
{
return
this
->
_maximalCompetencyByCourse
;}
const
int
cfg_prerequisiteByCourseMin
()
const
{
return
this
->
_minimalPrerequisiteByCourse
;}
int
cfg_prerequisiteByCourseMin
()
const
{
return
this
->
_minimalPrerequisiteByCourse
;}
const
int
cfg_prerequisiteByCourseMax
()
const
{
return
this
->
_maximalPrerequisiteByCourse
;}
int
cfg_prerequisiteByCourseMax
()
const
{
return
this
->
_maximalPrerequisiteByCourse
;}
const
int
cfg_pickedCoursesByTimeFrame
()
const
{
return
this
->
_pickedCoursesByTimeFrame
;}
int
cfg_pickedCoursesByTimeFrame
()
const
{
return
this
->
_pickedCoursesByTimeFrame
;}
const
Magnitude
&
cfg_magnitudeMin
()
const
{
return
this
->
_minimalMagnitude
;}
const
Magnitude
&
cfg_magnitudeMin
()
const
{
return
this
->
_minimalMagnitude
;}
const
Magnitude
&
cfg_magnitudeMax
()
const
{
return
this
->
_maximalMagnitude
;}
const
Magnitude
&
cfg_magnitudeMax
()
const
{
return
this
->
_maximalMagnitude
;}
...
@@ -131,7 +131,7 @@ class CSDVP
...
@@ -131,7 +131,7 @@ class CSDVP
std
::
vector
<
Course
>
&
unlocked_coursesCatalogue
(){
return
this
->
_availableCourses
;}
std
::
vector
<
Course
>
&
unlocked_coursesCatalogue
(){
return
this
->
_availableCourses
;}
std
::
vector
<
Competency
>
&
unlocked_competenciesCatalogue
(){
return
this
->
_availableCompentecies
;}
std
::
vector
<
Competency
>
&
unlocked_competenciesCatalogue
(){
return
this
->
_availableCompentecies
;}
const
int
getQuantityCoursesToPick
()
const
{
int
getQuantityCoursesToPick
()
const
{
if
(
this
->
_isConfig
)
if
(
this
->
_isConfig
)
return
this
->
_timeFrames
.
size
()
*
this
->
_pickedCoursesByTimeFrame
;
return
this
->
_timeFrames
.
size
()
*
this
->
_pickedCoursesByTimeFrame
;
return
-
1
;
//if not config
return
-
1
;
//if not config
...
...
src/model/profession.cpp
View file @
d048501d
...
@@ -112,7 +112,7 @@ std::ostream & operator<<(std::ostream & Stream, const Profession & p)
...
@@ -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
"
;
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
;
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
<<
"("
<<
i
<<
"th) "
<<
p
.
prerequisites
().
at
(
i
)
<<
"
\n\t
"
;
Stream
<<
"=========="
<<
std
::
endl
;
Stream
<<
"=========="
<<
std
::
endl
;
return
Stream
;
return
Stream
;
...
@@ -170,7 +170,7 @@ void Profession::_randomlyGenerate(Profession & job, CSDVP & pb)
...
@@ -170,7 +170,7 @@ void Profession::_randomlyGenerate(Profession & job, CSDVP & pb)
std
::
random_shuffle
(
tmpComp
.
begin
(),
tmpComp
.
end
());
std
::
random_shuffle
(
tmpComp
.
begin
(),
tmpComp
.
end
());
int
i
;
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
())
;
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
());
ctmp
=
Competency
::
buildTMP
(
magVal
,
tmpComp
.
at
(
i
).
name
());
...
@@ -196,7 +196,7 @@ void Profession::_randomlyGenerate(Profession & job, CSDVP & pb)
...
@@ -196,7 +196,7 @@ void Profession::_randomlyGenerate(Profession & job, CSDVP & pb)
// ects = pb.timeFrames().size() * 30; //30 is the default european value
// 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
++
)
for
(
int
j
=
0
;
j
<
pb
.
cfg_pickedCoursesByTimeFrame
();
j
++
)
{
{
...
...
src/model/profession.h
View file @
d048501d
...
@@ -65,16 +65,16 @@ class Profession
...
@@ -65,16 +65,16 @@ class Profession
bool
checkConfig
();
bool
checkConfig
();
// === GETTER
// === GETTER
const
int
id
()
const
{
return
this
->
_id
;}
int
id
()
const
{
return
this
->
_id
;}
const
int
seed
()
const
{
return
this
->
_seed
;}
int
seed
()
const
{
return
this
->
_seed
;}
const
int
requiredECTS
()
const
{
return
this
->
_requiredECTS
;}
int
requiredECTS
()
const
{
return
this
->
_requiredECTS
;}
const
std
::
string
name
()
const
{
return
this
->
_name
;}
const
std
::
string
name
()
const
{
return
this
->
_name
;}
const
std
::
vector
<
Competency
>
&
prerequisites
()
const
{
return
this
->
_prerequisites
;}
const
std
::
vector
<
Competency
>
&
prerequisites
()
const
{
return
this
->
_prerequisites
;}
/// return a modifiable reference to _prerequisite;
/// return a modifiable reference to _prerequisite;
std
::
vector
<
Competency
>
&
unlocked_prerequisites
(){
return
this
->
_prerequisites
;}
std
::
vector
<
Competency
>
&
unlocked_prerequisites
(){
return
this
->
_prerequisites
;}
const
int
cfg_minimalPrerequisites
()
const
{
return
this
->
_minimalPrerequisites
;}
int
cfg_minimalPrerequisites
()
const
{
return
this
->
_minimalPrerequisites
;}
const
int
cfg_maximalPrerequisites
()
const
{
return
this
->
_maximalPrerequisites
;}
int
cfg_maximalPrerequisites
()
const
{
return
this
->
_maximalPrerequisites
;}
const
Magnitude
cfg_minimalMagnitude
()
const
{
return
this
->
_minimalMagnitude
;}
const
Magnitude
cfg_minimalMagnitude
()
const
{
return
this
->
_minimalMagnitude
;}
const
Magnitude
cfg_maximalMagnitude
()
const
{
return
this
->
_maximalMagnitude
;}
const
Magnitude
cfg_maximalMagnitude
()
const
{
return
this
->
_maximalMagnitude
;}
...
...
src/model/tools.h
View file @
d048501d
...
@@ -22,7 +22,7 @@ static std::pair<int, T> findInVector(std::vector<T> & vec, T & findMe)
...
@@ -22,7 +22,7 @@ static std::pair<int, T> findInVector(std::vector<T> & vec, T & findMe)
if
(
it
==
vec
.
end
())
if
(
it
==
vec
.
end
())
{
{
res
.
first
=
-
1
;
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
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