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
34033c70
Commit
34033c70
authored
Dec 03, 2020
by
Alexis Lebis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clean some warnings + debug decay
parent
3b5f6555
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
81 additions
and
79 deletions
+81
-79
main.cpp
application/main.cpp
+4
-4
competencyDistribution.cpp
src/model/competencyDistribution.cpp
+9
-9
ectsConstraints.cpp
src/model/constraints/ectsConstraints.cpp
+1
-1
prerequisitesConstraints.cpp
src/model/constraints/prerequisitesConstraints.cpp
+35
-33
professionConstraints.cpp
src/model/constraints/professionConstraints.cpp
+6
-6
repetitionConstraints.cpp
src/model/constraints/repetitionConstraints.cpp
+2
-2
course.cpp
src/model/course.cpp
+1
-1
initConstraint.h
src/model/ea/initConstraint.h
+4
-4
mutation.h
src/model/ea/mutation.h
+7
-7
problem.cpp
src/model/problem.cpp
+11
-11
profession.cpp
src/model/profession.cpp
+1
-1
No files found.
application/main.cpp
View file @
34033c70
...
@@ -182,7 +182,7 @@ int main(int argc, char* argv[]){
...
@@ -182,7 +182,7 @@ int main(int argc, char* argv[]){
//POPULATION INITIALISATION
//POPULATION INITIALISATION
eoPop
<
Cursus
>
pop
;
eoPop
<
Cursus
>
pop
;
Cursus
c1
;
Cursus
c1
;
for
(
int
i
=
0
;
i
<
POPSIZE
;
i
++
){
for
(
unsigned
int
i
=
0
;
i
<
POPSIZE
;
i
++
){
init
(
c1
);
init
(
c1
);
eval
(
c1
);
eval
(
c1
);
pop
.
push_back
(
c1
);
pop
.
push_back
(
c1
);
...
@@ -331,7 +331,7 @@ int main(int argc, char* argv[]){
...
@@ -331,7 +331,7 @@ int main(int argc, char* argv[]){
std
::
vector
<
Competency
>
compHL
=
CompetencyDistribution
::
upToHLevel
(
pb
,
2
);
std
::
vector
<
Competency
>
compHL
=
CompetencyDistribution
::
upToHLevel
(
pb
,
2
);
std
::
cout
<<
"HL GTTING"
<<
std
::
endl
;
std
::
cout
<<
"HL GTTING"
<<
std
::
endl
;
for
(
int
i
=
0
;
i
<
compHL
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
compHL
.
size
();
i
++
)
std
::
cout
<<
compHL
[
i
]
<<
std
::
endl
;
std
::
cout
<<
compHL
[
i
]
<<
std
::
endl
;
std
::
cout
<<
"===== CURRENT POP ====="
<<
std
::
endl
;
std
::
cout
<<
"===== CURRENT POP ====="
<<
std
::
endl
;
...
@@ -385,7 +385,7 @@ int main(int argc, char* argv[]){
...
@@ -385,7 +385,7 @@ int main(int argc, char* argv[]){
outputfile2
<<
pop
.
size
()
<<
std
::
endl
;
outputfile2
<<
pop
.
size
()
<<
std
::
endl
;
outputfile3
<<
pop
.
size
()
<<
std
::
endl
;
outputfile3
<<
pop
.
size
()
<<
std
::
endl
;
for
(
int
i
=
0
;
i
<
pop
.
size
();
i
++
){
for
(
unsigned
int
i
=
0
;
i
<
pop
.
size
();
i
++
){
//Write pop + prerequires values
//Write pop + prerequires values
pop
[
i
].
printOn
(
outputfile2
);
pop
[
i
].
printOn
(
outputfile2
);
outputfile2
<<
" "
<<
ctrECTS
.
integrityCheck
(
pop
[
i
]).
second
<<
" "
<<
ctrRep
.
integrityCheck
(
pop
[
i
]).
second
<<
" "
<<
ctrJob
.
integrityCheck
(
pop
[
i
]).
second
<<
" "
<<
ctrPrq
.
integrityCheck
(
pop
[
i
]).
second
<<
std
::
endl
;
outputfile2
<<
" "
<<
ctrECTS
.
integrityCheck
(
pop
[
i
]).
second
<<
" "
<<
ctrRep
.
integrityCheck
(
pop
[
i
]).
second
<<
" "
<<
ctrJob
.
integrityCheck
(
pop
[
i
]).
second
<<
" "
<<
ctrPrq
.
integrityCheck
(
pop
[
i
]).
second
<<
std
::
endl
;
...
@@ -406,7 +406,7 @@ int main(int argc, char* argv[]){
...
@@ -406,7 +406,7 @@ int main(int argc, char* argv[]){
outputfile2
<<
pop
.
size
()
<<
std
::
endl
;
outputfile2
<<
pop
.
size
()
<<
std
::
endl
;
outputfile3
<<
pop
.
size
()
<<
std
::
endl
;
outputfile3
<<
pop
.
size
()
<<
std
::
endl
;
for
(
int
i
=
0
;
i
<
pop
.
size
();
i
++
){
for
(
unsigned
int
i
=
0
;
i
<
pop
.
size
();
i
++
){
//Write pop + prerequires values
//Write pop + prerequires values
pop
[
i
].
printOn
(
outputfile2
);
pop
[
i
].
printOn
(
outputfile2
);
outputfile2
<<
" "
<<
ctrECTS
.
integrityCheck
(
pop
[
i
]).
second
<<
" "
<<
ctrRep
.
integrityCheck
(
pop
[
i
]).
second
<<
" "
<<
ctrJob
.
integrityCheck
(
pop
[
i
]).
second
<<
" "
<<
ctrPrq
.
integrityCheck
(
pop
[
i
]).
second
<<
std
::
endl
;
outputfile2
<<
" "
<<
ctrECTS
.
integrityCheck
(
pop
[
i
]).
second
<<
" "
<<
ctrRep
.
integrityCheck
(
pop
[
i
]).
second
<<
" "
<<
ctrJob
.
integrityCheck
(
pop
[
i
]).
second
<<
" "
<<
ctrPrq
.
integrityCheck
(
pop
[
i
]).
second
<<
std
::
endl
;
...
...
src/model/competencyDistribution.cpp
View file @
34033c70
...
@@ -25,9 +25,9 @@ void CompetencyDistribution::distribute(CSDVP &pb)
...
@@ -25,9 +25,9 @@ void CompetencyDistribution::distribute(CSDVP &pb)
int
nbAffected
=
0
;
int
nbAffected
=
0
;
for
(
int
i
=
0
;
i
<
CompetencyDistribution
::
HLEVEL
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
CompetencyDistribution
::
HLEVEL
.
size
();
i
++
)
{
{
for
(
int
j
=
0
;
j
<
idxComp
.
size
()
&&
(
j
<
(
CompetencyDistribution
::
HLEVEL
.
at
(
i
)
*
pb
.
cfg_quantityCompetencies
())
/
100
)
;
j
++
)
for
(
unsigned
int
j
=
0
;
j
<
idxComp
.
size
()
&&
(
j
<
(
CompetencyDistribution
::
HLEVEL
.
at
(
i
)
*
pb
.
cfg_quantityCompetencies
())
/
100
)
;
j
++
)
{
{
pb
.
unlocked_competenciesCatalogue
().
at
(
idxComp
.
at
(
nbAffected
)).
setHL
(
i
);
pb
.
unlocked_competenciesCatalogue
().
at
(
idxComp
.
at
(
nbAffected
)).
setHL
(
i
);
nbAffected
++
;
nbAffected
++
;
...
@@ -66,7 +66,7 @@ void CompetencyDistribution::linearDistribution(CSDVP &pb)
...
@@ -66,7 +66,7 @@ void CompetencyDistribution::linearDistribution(CSDVP &pb)
}
}
//Taking into account comp missed with the division
//Taking into account comp missed with the division
int
diff
=
pb
.
cfg_quantityCompetencies
()
-
nbCompByHL
*
interval
;
//
int diff = pb.cfg_quantityCompetencies() - nbCompByHL*interval;
int
idxInterval
=
0
;
int
idxInterval
=
0
;
for
(
int
i
=
pb
.
cfg_quantityCompetencies
()
-
1
;
i
>=
nbCompByHL
*
interval
;
i
--
)
for
(
int
i
=
pb
.
cfg_quantityCompetencies
()
-
1
;
i
>=
nbCompByHL
*
interval
;
i
--
)
...
@@ -94,7 +94,7 @@ void CompetencyDistribution::linearDistribution(CSDVP &pb)
...
@@ -94,7 +94,7 @@ void CompetencyDistribution::linearDistribution(CSDVP &pb)
return
comp
;
return
comp
;
std
::
vector
<
Competency
>
pbComp
=
pb
.
competencyCatalogue
();
std
::
vector
<
Competency
>
pbComp
=
pb
.
competencyCatalogue
();
for
(
int
i
=
0
;
i
<
pbComp
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
pbComp
.
size
();
i
++
)
if
(
pbComp
[
i
].
hLevel
()
==
level
)
if
(
pbComp
[
i
].
hLevel
()
==
level
)
comp
.
push_back
(
pbComp
[
i
]);
comp
.
push_back
(
pbComp
[
i
]);
...
@@ -110,7 +110,7 @@ void CompetencyDistribution::linearDistribution(CSDVP &pb)
...
@@ -110,7 +110,7 @@ void CompetencyDistribution::linearDistribution(CSDVP &pb)
for
(
start
=
0
;
start
<=
level
;
start
++
)
for
(
start
=
0
;
start
<=
level
;
start
++
)
{
{
tmp
=
CompetencyDistribution
::
getHLevel
(
pb
,
start
);
tmp
=
CompetencyDistribution
::
getHLevel
(
pb
,
start
);
for
(
int
i
=
0
;
i
<
tmp
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
tmp
.
size
();
i
++
)
res
.
push_back
(
tmp
[
i
]);
res
.
push_back
(
tmp
[
i
]);
}
}
...
@@ -127,7 +127,7 @@ void CompetencyDistribution::linearDistribution(CSDVP &pb)
...
@@ -127,7 +127,7 @@ void CompetencyDistribution::linearDistribution(CSDVP &pb)
for
(
int
i
=
0
;
i
<=
level
;
i
++
)
for
(
int
i
=
0
;
i
<=
level
;
i
++
)
{
{
tmp
=
CompetencyDistribution
::
unassignedAtHLevel
(
pb
,
i
);
tmp
=
CompetencyDistribution
::
unassignedAtHLevel
(
pb
,
i
);
for
(
int
j
=
0
;
j
<
tmp
.
size
();
j
++
)
for
(
unsigned
int
j
=
0
;
j
<
tmp
.
size
();
j
++
)
res
.
push_back
(
tmp
[
j
]);
res
.
push_back
(
tmp
[
j
]);
}
}
...
@@ -140,7 +140,7 @@ void CompetencyDistribution::linearDistribution(CSDVP &pb)
...
@@ -140,7 +140,7 @@ void CompetencyDistribution::linearDistribution(CSDVP &pb)
std
::
vector
<
Competency
>
res
;
std
::
vector
<
Competency
>
res
;
for
(
int
i
=
0
;
i
<
pb
.
competencyCatalogue
().
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
pb
.
competencyCatalogue
().
size
();
i
++
)
{
{
if
(
pb
.
competencyCatalogue
().
at
(
i
).
hLevel
()
==
hlevel
&&
pb
.
unlocked_distributedCompetencies
().
at
(
i
)
==
-
1
)
if
(
pb
.
competencyCatalogue
().
at
(
i
).
hLevel
()
==
hlevel
&&
pb
.
unlocked_distributedCompetencies
().
at
(
i
)
==
-
1
)
res
.
push_back
(
pb
.
competencyCatalogue
().
at
(
i
));
res
.
push_back
(
pb
.
competencyCatalogue
().
at
(
i
));
...
@@ -154,7 +154,7 @@ void CompetencyDistribution::linearDistribution(CSDVP &pb)
...
@@ -154,7 +154,7 @@ void CompetencyDistribution::linearDistribution(CSDVP &pb)
int
sum
=
0
;
int
sum
=
0
;
std
::
vector
<
int
>
tmp
;
std
::
vector
<
int
>
tmp
;
for
(
int
i
=
0
;
i
<
CompetencyDistribution
::
HLEVEL
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
CompetencyDistribution
::
HLEVEL
.
size
();
i
++
)
{
{
if
(
CompetencyDistribution
::
HLEVEL
.
at
(
i
)
>=
0
)
//ignoring all negative value
if
(
CompetencyDistribution
::
HLEVEL
.
at
(
i
)
>=
0
)
//ignoring all negative value
{
{
...
@@ -172,7 +172,7 @@ void CompetencyDistribution::linearDistribution(CSDVP &pb)
...
@@ -172,7 +172,7 @@ void CompetencyDistribution::linearDistribution(CSDVP &pb)
void
CompetencyDistribution
::
displayHLevel
()
void
CompetencyDistribution
::
displayHLevel
()
{
{
std
::
cout
<<
"HLEVEL:"
<<
std
::
endl
<<
"["
;
std
::
cout
<<
"HLEVEL:"
<<
std
::
endl
<<
"["
;
for
(
int
i
=
0
;
i
<
CompetencyDistribution
::
HLEVEL
.
size
()
-
1
;
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
CompetencyDistribution
::
HLEVEL
.
size
()
-
1
;
i
++
)
{
{
std
::
cout
<<
CompetencyDistribution
::
HLEVEL
.
at
(
i
)
<<
"|"
;
std
::
cout
<<
CompetencyDistribution
::
HLEVEL
.
at
(
i
)
<<
"|"
;
}
}
...
...
src/model/constraints/ectsConstraints.cpp
View file @
34033c70
...
@@ -8,7 +8,7 @@ std::pair<bool, double> ConstraintsECTS::integrityCheck(Cursus indiv)
...
@@ -8,7 +8,7 @@ std::pair<bool, double> ConstraintsECTS::integrityCheck(Cursus indiv)
int
tmpECTS
=
0
;
int
tmpECTS
=
0
;
//std::cout << "courses size : " << std::to_string(courses.size()) << std::endl;
//std::cout << "courses size : " << std::to_string(courses.size()) << std::endl;
//std::cout << "courses catl : " << std::to_string(this->_pb.cfg_quantityCourses()) << std::endl;
//std::cout << "courses catl : " << std::to_string(this->_pb.cfg_quantityCourses()) << std::endl;
for
(
int
i
=
0
;
i
<
indiv
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
indiv
.
size
();
i
++
)
{
{
tmpECTS
+=
courses
.
at
(
indiv
[
i
]).
ects
();
tmpECTS
+=
courses
.
at
(
indiv
[
i
]).
ects
();
//std::cout << std::to_string(courses.at(indiv[i]).ects()) << " + ";
//std::cout << std::to_string(courses.at(indiv[i]).ects()) << " + ";
...
...
src/model/constraints/prerequisitesConstraints.cpp
View file @
34033c70
This diff is collapsed.
Click to expand it.
src/model/constraints/professionConstraints.cpp
View file @
34033c70
...
@@ -15,7 +15,7 @@ std::pair<bool, double> ConstraintsProfession::integrityCheck(Cursus indiv)
...
@@ -15,7 +15,7 @@ std::pair<bool, double> ConstraintsProfession::integrityCheck(Cursus indiv)
{
{
std
::
vector
<
Competency
>
compToAnswer
;
std
::
vector
<
Competency
>
compToAnswer
;
for
(
int
i
=
0
;
i
<
this
->
_job
.
prerequisites
().
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
this
->
_job
.
prerequisites
().
size
();
i
++
)
{
{
std
::
string
name
=
this
->
_job
.
prerequisites
().
at
(
i
).
c_name
();
std
::
string
name
=
this
->
_job
.
prerequisites
().
at
(
i
).
c_name
();
compToAnswer
.
push_back
(
Competency
::
buildTMP
(
0
,
name
));
//same name to exploit the Competency::operator== on name equality
compToAnswer
.
push_back
(
Competency
::
buildTMP
(
0
,
name
));
//same name to exploit the Competency::operator== on name equality
...
@@ -28,7 +28,7 @@ std::pair<bool, double> ConstraintsProfession::integrityCheck(Cursus indiv)
...
@@ -28,7 +28,7 @@ std::pair<bool, double> ConstraintsProfession::integrityCheck(Cursus indiv)
bool
changedTF
=
false
;
bool
changedTF
=
false
;
int
currentTF
=
0
;
int
currentTF
=
0
;
for
(
int
i
=
0
;
i
<
indiv
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
indiv
.
size
();
i
++
)
{
{
current
=
this
->
_pb
.
coursesCatalogue
().
at
(
indiv
.
at
(
i
));
current
=
this
->
_pb
.
coursesCatalogue
().
at
(
indiv
.
at
(
i
));
...
@@ -38,12 +38,12 @@ std::pair<bool, double> ConstraintsProfession::integrityCheck(Cursus indiv)
...
@@ -38,12 +38,12 @@ std::pair<bool, double> ConstraintsProfession::integrityCheck(Cursus indiv)
changedTF
=
false
;
changedTF
=
false
;
currentTF
=
i
/
this
->
_pb
.
cfg_pickedCoursesByTimeFrame
();
currentTF
=
i
/
this
->
_pb
.
cfg_pickedCoursesByTimeFrame
();
for
(
int
j
=
0
;
j
<
compToAnswer
.
size
();
j
++
)
for
(
unsigned
int
j
=
0
;
j
<
compToAnswer
.
size
();
j
++
)
{
{
compToAnswer
.
at
(
j
).
increaseDecay
();
compToAnswer
.
at
(
j
).
increaseDecay
();
}
}
for
(
int
j
=
0
;
j
<
current
.
teachedCompetenciesWeighted
().
size
()
;
j
++
)
for
(
unsigned
int
j
=
0
;
j
<
current
.
teachedCompetenciesWeighted
().
size
()
;
j
++
)
{
{
currentComp
=
current
.
teachedCompetenciesWeighted
().
at
(
j
).
first
;
currentComp
=
current
.
teachedCompetenciesWeighted
().
at
(
j
).
first
;
...
@@ -65,7 +65,7 @@ std::pair<bool, double> ConstraintsProfession::integrityCheck(Cursus indiv)
...
@@ -65,7 +65,7 @@ std::pair<bool, double> ConstraintsProfession::integrityCheck(Cursus indiv)
}
}
}
}
for
(
int
i
=
0
;
i
<
compToAnswer
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
compToAnswer
.
size
();
i
++
)
{
{
compToAnswer
.
at
(
i
).
saveDecay
();
compToAnswer
.
at
(
i
).
saveDecay
();
//std::cout << compToAnswer.at(i) << std::endl;
//std::cout << compToAnswer.at(i) << std::endl;
...
@@ -75,7 +75,7 @@ std::pair<bool, double> ConstraintsProfession::integrityCheck(Cursus indiv)
...
@@ -75,7 +75,7 @@ std::pair<bool, double> ConstraintsProfession::integrityCheck(Cursus indiv)
int
score
=
0
;
int
score
=
0
;
double
magDiff
=
0
;
// addendum from HL
double
magDiff
=
0
;
// addendum from HL
for
(
int
i
=
0
;
i
<
this
->
_job
.
prerequisites
().
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
this
->
_job
.
prerequisites
().
size
();
i
++
)
{
{
if
(
compToAnswer
.
at
(
i
).
magnitude
().
value
()
<
this
->
_job
.
prerequisites
().
at
(
i
).
c_magnitude
().
value
())
if
(
compToAnswer
.
at
(
i
).
magnitude
().
value
()
<
this
->
_job
.
prerequisites
().
at
(
i
).
c_magnitude
().
value
())
{
{
...
...
src/model/constraints/repetitionConstraints.cpp
View file @
34033c70
...
@@ -6,9 +6,9 @@ std::pair<bool, double> ConstraintsRepetition::integrityCheck(Cursus indiv)
...
@@ -6,9 +6,9 @@ std::pair<bool, double> ConstraintsRepetition::integrityCheck(Cursus indiv)
{
{
int
nbOfRepetition
=
0
;
int
nbOfRepetition
=
0
;
for
(
int
i
=
0
;
i
<
indiv
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
indiv
.
size
();
i
++
)
{
{
for
(
int
j
=
i
+
1
;
j
<
indiv
.
size
();
j
++
)
for
(
unsigned
int
j
=
i
+
1
;
j
<
indiv
.
size
();
j
++
)
{
{
if
(
indiv
.
at
(
i
)
==
indiv
.
at
(
j
))
if
(
indiv
.
at
(
i
)
==
indiv
.
at
(
j
))
nbOfRepetition
++
;
nbOfRepetition
++
;
...
...
src/model/course.cpp
View file @
34033c70
...
@@ -57,7 +57,7 @@ Course::Course(int id, int ects, std::string name)
...
@@ -57,7 +57,7 @@ Course::Course(int id, int ects, std::string name)
const
int
Course
::
lastTimeFrame
()
const
const
int
Course
::
lastTimeFrame
()
const
{
{
int
max
=
this
->
_temporalAvailability
[
0
];
int
max
=
this
->
_temporalAvailability
[
0
];
for
(
int
i
=
1
;
i
<
this
->
_temporalAvailability
.
size
();
i
++
)
for
(
unsigned
int
i
=
1
;
i
<
this
->
_temporalAvailability
.
size
();
i
++
)
if
(
max
<
this
->
_temporalAvailability
[
i
])
if
(
max
<
this
->
_temporalAvailability
[
i
])
max
=
this
->
_temporalAvailability
[
i
];
max
=
this
->
_temporalAvailability
[
i
];
return
max
;
return
max
;
...
...
src/model/ea/initConstraint.h
View file @
34033c70
...
@@ -30,9 +30,9 @@ class eoInitConstraintCSDVP: public eoInit<EOT>
...
@@ -30,9 +30,9 @@ class eoInitConstraintCSDVP: public eoInit<EOT>
sizeTF
=
chromSize
/
nbTF
;
sizeTF
=
chromSize
/
nbTF
;
catalogue
=
pb
.
coursesCatalogue
();
catalogue
=
pb
.
coursesCatalogue
();
possibleIDbyTF
.
resize
(
nbTF
);
possibleIDbyTF
.
resize
(
nbTF
);
for
(
int
i
=
0
;
i
<
maxVal
;
i
++
){
for
(
unsigned
int
i
=
0
;
i
<
maxVal
;
i
++
){
tmp
=
catalogue
[
i
].
timeFrame
();
tmp
=
catalogue
[
i
].
timeFrame
();
for
(
int
j
=
0
;
j
<
tmp
.
size
();
j
++
){
for
(
unsigned
int
j
=
0
;
j
<
tmp
.
size
();
j
++
){
possibleIDbyTF
[
tmp
[
j
]
-
pb
.
cfg_minimalTimeFrame
()].
push_back
(
i
);
possibleIDbyTF
[
tmp
[
j
]
-
pb
.
cfg_minimalTimeFrame
()].
push_back
(
i
);
}
}
}
}
...
@@ -46,13 +46,13 @@ class eoInitConstraintCSDVP: public eoInit<EOT>
...
@@ -46,13 +46,13 @@ class eoInitConstraintCSDVP: public eoInit<EOT>
}
}
virtual
void
operator
()(
EOT
&
chrom
){
virtual
void
operator
()(
EOT
&
chrom
){
int
cpt
=
0
;
unsigned
int
cpt
=
0
;
//std::cout << "Enter init" << std::endl;
//std::cout << "Enter init" << std::endl;
unsigned
int
r
=
eo
::
rng
.
random
(
possibleIDbyTF
[
0
].
size
());
unsigned
int
r
=
eo
::
rng
.
random
(
possibleIDbyTF
[
0
].
size
());
chrom
.
resize
(
0
);
chrom
.
resize
(
0
);
chrom
.
push_back
(
possibleIDbyTF
[
0
][
r
]);
chrom
.
push_back
(
possibleIDbyTF
[
0
][
r
]);
//std::cout << "push " << possibleIDbyTF[0][r] << std::endl;
//std::cout << "push " << possibleIDbyTF[0][r] << std::endl;
for
(
int
i
=
1
;
i
<
chromSize
;
i
++
){
for
(
unsigned
int
i
=
1
;
i
<
chromSize
;
i
++
){
cpt
=
0
;
cpt
=
0
;
r
=
eo
::
rng
.
random
(
possibleIDbyTF
[
i
/
sizeTF
].
size
());
r
=
eo
::
rng
.
random
(
possibleIDbyTF
[
i
/
sizeTF
].
size
());
while
(
!
notin
(
chrom
,
possibleIDbyTF
[
i
/
sizeTF
][
r
],
i
)
&&
cpt
<
maxVal
){
while
(
!
notin
(
chrom
,
possibleIDbyTF
[
i
/
sizeTF
][
r
],
i
)
&&
cpt
<
maxVal
){
...
...
src/model/ea/mutation.h
View file @
34033c70
...
@@ -24,8 +24,8 @@ class mutCSDVP: public eoMonOp<EOT>
...
@@ -24,8 +24,8 @@ class mutCSDVP: public eoMonOp<EOT>
//_CourseID subastraction from _chrom
//_CourseID subastraction from _chrom
void
notin
(
std
::
vector
<
int
>&
_courseID
,
std
::
vector
<
int
>&
_chrom
){
void
notin
(
std
::
vector
<
int
>&
_courseID
,
std
::
vector
<
int
>&
_chrom
){
int
tmp
;
unsigned
int
tmp
;
for
(
int
i
=
0
;
i
<
_chrom
.
size
();
i
++
){
for
(
unsigned
int
i
=
0
;
i
<
_chrom
.
size
();
i
++
){
tmp
=
0
;
tmp
=
0
;
while
(
tmp
<
_courseID
.
size
()
&&
_chrom
[
i
]
!=
_courseID
[
tmp
])
while
(
tmp
<
_courseID
.
size
()
&&
_chrom
[
i
]
!=
_courseID
[
tmp
])
tmp
++
;
tmp
++
;
...
@@ -230,7 +230,7 @@ class mutCSDVP: public eoMonOp<EOT>
...
@@ -230,7 +230,7 @@ class mutCSDVP: public eoMonOp<EOT>
bool
changedTF
=
false
;
bool
changedTF
=
false
;
int
currentTF
=
0
;
int
currentTF
=
0
;
for
(
int
i
=
0
;
i
<
_chrom
.
size
()
&&
(
i
/
nbCbyTF
<
TF
);
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
_chrom
.
size
()
&&
(
i
/
nbCbyTF
<
TF
);
i
++
)
{
{
currentCourse
=
catalogue
.
at
(
_chrom
.
at
(
i
));
currentCourse
=
catalogue
.
at
(
_chrom
.
at
(
i
));
...
@@ -242,13 +242,13 @@ class mutCSDVP: public eoMonOp<EOT>
...
@@ -242,13 +242,13 @@ class mutCSDVP: public eoMonOp<EOT>
if
(
changedTF
)
//if we have changed of tf, lets improve decay for all comp
if
(
changedTF
)
//if we have changed of tf, lets improve decay for all comp
{
{
for
(
int
j
=
0
;
j
<
tmpCourse
.
prerequisites
().
size
();
j
++
)
for
(
unsigned
int
j
=
0
;
j
<
tmpCourse
.
prerequisites
().
size
();
j
++
)
{
{
tmpCourse
.
unlocked_prerequisites
().
at
(
j
).
increaseDecay
();
tmpCourse
.
unlocked_prerequisites
().
at
(
j
).
increaseDecay
();
}
}
}
}
for
(
int
j
=
0
;
j
<
currentCourse
.
teachedCompetenciesWeighted
().
size
();
j
++
)
for
(
unsigned
int
j
=
0
;
j
<
currentCourse
.
teachedCompetenciesWeighted
().
size
();
j
++
)
{
{
tmpComp
=
currentCourse
.
teachedCompetenciesWeighted
().
at
(
j
).
first
;
tmpComp
=
currentCourse
.
teachedCompetenciesWeighted
().
at
(
j
).
first
;
addStatus
=
tmpCourse
.
addPrerequisite
(
tmpComp
);
addStatus
=
tmpCourse
.
addPrerequisite
(
tmpComp
);
...
@@ -275,7 +275,7 @@ class mutCSDVP: public eoMonOp<EOT>
...
@@ -275,7 +275,7 @@ class mutCSDVP: public eoMonOp<EOT>
}
}
compStatus
=
tmpCourse
.
prerequisites
();
compStatus
=
tmpCourse
.
prerequisites
();
for
(
int
i
=
0
;
i
<
compStatus
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
compStatus
.
size
();
i
++
)
compStatus
.
at
(
i
).
saveDecay
();
compStatus
.
at
(
i
).
saveDecay
();
return
compStatus
;
return
compStatus
;
...
@@ -292,7 +292,7 @@ class mutCSDVP: public eoMonOp<EOT>
...
@@ -292,7 +292,7 @@ class mutCSDVP: public eoMonOp<EOT>
Competency
checkCmp
;
Competency
checkCmp
;
for
(
int
i
=
0
;
i
<
availableC
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
availableC
.
size
();
i
++
)
{
{
isPrereqOK
=
true
;
isPrereqOK
=
true
;
...
...
src/model/problem.cpp
View file @
34033c70
...
@@ -354,7 +354,7 @@ int CSDVP::CSDVP_COUNTER = 0;
...
@@ -354,7 +354,7 @@ int CSDVP::CSDVP_COUNTER = 0;
}
}
/* Creating _distributedCompetencies array for assignation */
/* Creating _distributedCompetencies array for assignation */
for
(
int
i
=
0
;
i
<
pb
.
competencyCatalogue
().
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
pb
.
competencyCatalogue
().
size
();
i
++
)
{
{
pb
.
_distributedCompetencies
.
push_back
(
-
1
);
pb
.
_distributedCompetencies
.
push_back
(
-
1
);
}
}
...
@@ -406,7 +406,7 @@ int CSDVP::CSDVP_COUNTER = 0;
...
@@ -406,7 +406,7 @@ int CSDVP::CSDVP_COUNTER = 0;
// std::cout << "SIZE OF HLCOMP : " << HLComp.size() << std::endl;
// std::cout << "SIZE OF HLCOMP : " << HLComp.size() << std::endl;
for
(
int
j
=
0
;
j
<
x
&&
HLComp
.
size
()
>
0
&&
j
<
HLComp
.
size
();
j
++
)
for
(
unsigned
int
j
=
0
;
j
<
x
&&
HLComp
.
size
()
>
0
&&
j
<
HLComp
.
size
();
j
++
)
{
{
// tmpComp = queue.front();
// tmpComp = queue.front();
tmpComp
=
HLComp
.
at
(
j
);
tmpComp
=
HLComp
.
at
(
j
);
...
@@ -452,7 +452,7 @@ int CSDVP::CSDVP_COUNTER = 0;
...
@@ -452,7 +452,7 @@ int CSDVP::CSDVP_COUNTER = 0;
std
::
random_shuffle
(
HLComp
.
begin
(),
HLComp
.
end
());
std
::
random_shuffle
(
HLComp
.
begin
(),
HLComp
.
end
());
for
(
int
j
=
0
;
j
<
x
&&
HLComp
.
size
()
>
0
&&
j
<
HLComp
.
size
();
j
++
)
for
(
unsigned
int
j
=
0
;
j
<
x
&&
HLComp
.
size
()
>
0
&&
j
<
HLComp
.
size
();
j
++
)
{
{
tmpComp
=
HLComp
.
at
(
j
);
tmpComp
=
HLComp
.
at
(
j
);
//we change mag value for prereq
//we change mag value for prereq
...
@@ -506,14 +506,14 @@ void const CSDVP::displayDistribution(){
...
@@ -506,14 +506,14 @@ void const CSDVP::displayDistribution(){
std
::
cout
<<
"
\n\t
Distrib mean: "
<<
std
::
get
<
2
>
(
stats
);
std
::
cout
<<
"
\n\t
Distrib mean: "
<<
std
::
get
<
2
>
(
stats
);
std
::
cout
<<
"
\n\t
Distrib median: "
<<
std
::
get
<
3
>
(
stats
)
<<
std
::
endl
;
std
::
cout
<<
"
\n\t
Distrib median: "
<<
std
::
get
<
3
>
(
stats
)
<<
std
::
endl
;
for
(
int
i
=
0
;
i
<
CompetencyDistribution
::
HLEVEL
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
CompetencyDistribution
::
HLEVEL
.
size
();
i
++
)
{
{
std
::
cout
<<
"
\t
Assigned in HL#"
<<
i
<<
": "
<<
CompetencyDistribution
::
getHLevel
(
*
this
,
i
).
size
()
<<
std
::
endl
;
std
::
cout
<<
"
\t
Assigned in HL#"
<<
i
<<
": "
<<
CompetencyDistribution
::
getHLevel
(
*
this
,
i
).
size
()
<<
std
::
endl
;
}
}
std
::
cout
<<
"Distrib:"
<<
std
::
endl
;
std
::
cout
<<
"Distrib:"
<<
std
::
endl
;
std
::
cout
<<
"["
;
std
::
cout
<<
"["
;
for
(
int
i
=
0
;
i
<
this
->
_distributedCompetencies
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
this
->
_distributedCompetencies
.
size
();
i
++
)
{
{
std
::
cout
<<
this
->
_distributedCompetencies
.
at
(
i
);
std
::
cout
<<
this
->
_distributedCompetencies
.
at
(
i
);
if
(
i
<
this
->
_distributedCompetencies
.
size
()
-
1
)
if
(
i
<
this
->
_distributedCompetencies
.
size
()
-
1
)
...
@@ -529,9 +529,9 @@ std::tuple<int, int, double, double> CSDVP::distributionStats()
...
@@ -529,9 +529,9 @@ std::tuple<int, int, double, double> CSDVP::distributionStats()
int
unassigned
=
0
;
int
unassigned
=
0
;
int
aboveFive
=
0
;
// >= 0.5
int
aboveFive
=
0
;
// >= 0.5
double
mean
=
0
;
double
mean
=
0
;
double
median
=
0
;
double
median
=
-
1
;
for
(
int
i
=
0
;
i
<
this
->
_distributedCompetencies
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
this
->
_distributedCompetencies
.
size
();
i
++
)
{
{
if
(
this
->
_distributedCompetencies
.
at
(
i
)
==
-
1
)
if
(
this
->
_distributedCompetencies
.
at
(
i
)
==
-
1
)
unassigned
++
;
unassigned
++
;
...
@@ -547,8 +547,8 @@ std::tuple<int, int, double, double> CSDVP::distributionStats()
...
@@ -547,8 +547,8 @@ std::tuple<int, int, double, double> CSDVP::distributionStats()
std
::
get
<
0
>
(
stats
)
=
unassigned
;
std
::
get
<
0
>
(
stats
)
=
unassigned
;
std
::
get
<
1
>
(
stats
)
=
aboveFive
;
std
::
get
<
1
>
(
stats
)
=
aboveFive
;
std
::
get
<
2
>
(
stats
)
=
mean
;
//todo
std
::
get
<
2
>
(
stats
)
=
mean
;
std
::
get
<
3
>
(
stats
)
=
-
1
;
//
todo
std
::
get
<
3
>
(
stats
)
=
median
;
//@
todo
return
stats
;
return
stats
;
}
}
...
@@ -564,12 +564,12 @@ std::tuple<int, int, double, double> CSDVP::distributionStats()
...
@@ -564,12 +564,12 @@ std::tuple<int, int, double, double> CSDVP::distributionStats()
Stream
<<
s
;
Stream
<<
s
;
std
::
vector
<
Course
>
courses
=
c
.
coursesCatalogue
();
std
::
vector
<
Course
>
courses
=
c
.
coursesCatalogue
();
for
(
int
i
=
0
;
i
<
courses
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
courses
.
size
();
i
++
)
Stream
<<
courses
[
i
]
<<
"
\n
"
;
Stream
<<
courses
[
i
]
<<
"
\n
"
;
Stream
<<
"===Competencies:"
;
Stream
<<
"===Competencies:"
;
std
::
vector
<
Competency
>
comp
=
c
.
competencyCatalogue
();
std
::
vector
<
Competency
>
comp
=
c
.
competencyCatalogue
();
for
(
int
i
=
0
;
i
<
comp
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
comp
.
size
();
i
++
)
Stream
<<
comp
[
i
]
<<
"
\n
"
;
Stream
<<
comp
[
i
]
<<
"
\n
"
;
return
Stream
;
return
Stream
;
...
...
src/model/profession.cpp
View file @
34033c70
...
@@ -248,7 +248,7 @@ void Profession::_pickWithHLWeighting(int nbToPick, Profession & job, CSDVP & pb
...
@@ -248,7 +248,7 @@ void Profession::_pickWithHLWeighting(int nbToPick, Profession & job, CSDVP & pb
{
{
std
::
vector
<
int
>
range
;
std
::
vector
<
int
>
range
;
int
sumInterval
=
0
;
int
sumInterval
=
0
;
int
x
;
int
currentHL
;
int
x
;
unsigned
int
currentHL
;
double
magVal
;
double
magVal
;
Competency
ctmp
;
Competency
ctmp
;
const
int
hLRange
=
CompetencyDistribution
::
HLevelRange
(
pb
);
const
int
hLRange
=
CompetencyDistribution
::
HLevelRange
(
pb
);
...
...
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