Commit 34033c70 authored by Alexis Lebis's avatar Alexis Lebis

clean some warnings + debug decay

parent 3b5f6555
...@@ -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;
......
...@@ -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) << "|";
} }
......
...@@ -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()) << " + ";
......
...@@ -20,7 +20,7 @@ std::pair<bool, double> ConstraintsPrerequisites::old_integrityCheck(Cursus indi ...@@ -20,7 +20,7 @@ std::pair<bool, double> ConstraintsPrerequisites::old_integrityCheck(Cursus indi
int currentTF = 0; int currentTF = 0;
int notFound = 0; int notFound = 0;
int notRespected = 0; int notRespected = 0;
int score = 0; //int score = 0;
int nbPrereq = 0; int nbPrereq = 0;
int magDivisor = 0; int magDivisor = 0;
...@@ -39,7 +39,7 @@ std::pair<bool, double> ConstraintsPrerequisites::old_integrityCheck(Cursus indi ...@@ -39,7 +39,7 @@ std::pair<bool, double> ConstraintsPrerequisites::old_integrityCheck(Cursus indi
bool changedTF = false; bool changedTF = false;
//std::cout << "=========START========" << std::endl; //std::cout << "=========START========" << std::endl;
for(int i = 0; i < indiv.size() ; i++) for(unsigned int i = 0; i < indiv.size() ; i++)
{ {
if(currentTF != i / this->_pb.cfg_pickedCoursesByTimeFrame()) if(currentTF != i / this->_pb.cfg_pickedCoursesByTimeFrame())
{ {
...@@ -53,7 +53,7 @@ std::pair<bool, double> ConstraintsPrerequisites::old_integrityCheck(Cursus indi ...@@ -53,7 +53,7 @@ std::pair<bool, double> ConstraintsPrerequisites::old_integrityCheck(Cursus indi
//std::cout << "Current TF: " << std::to_string(currentTF) << std::endl; //std::cout << "Current TF: " << std::to_string(currentTF) << std::endl;
//If changedTF is set to true, then we have changed of TF, we need to make available all the Comp in TF-1 here in TF, in addition to the new that'll be discovered in TF //If changedTF is set to true, then we have changed of TF, we need to make available all the Comp in TF-1 here in TF, in addition to the new that'll be discovered in TF
for(int j = 0 ; changedTF && j < compByTF.at(currentTF-1).size(); j++) for(unsigned int j = 0 ; changedTF && j < compByTF.at(currentTF-1).size(); j++)
{ {
// HERE, VARIABLE DECAY CAN BE APPLIED!!!!!!!! // HERE, VARIABLE DECAY CAN BE APPLIED!!!!!!!!
compByTF.at(currentTF).push_back(compByTF.at(currentTF-1).at(j)); compByTF.at(currentTF).push_back(compByTF.at(currentTF-1).at(j));
...@@ -85,7 +85,7 @@ std::pair<bool, double> ConstraintsPrerequisites::old_integrityCheck(Cursus indi ...@@ -85,7 +85,7 @@ std::pair<bool, double> ConstraintsPrerequisites::old_integrityCheck(Cursus indi
// Handling teached comp // Handling teached comp
for(int j = 0; j < currentCourse.teachedCompetenciesWeighted().size() ; j++) for(unsigned int j = 0; j < currentCourse.teachedCompetenciesWeighted().size() ; j++)
{ {
currentCompetency = currentCourse.teachedCompetenciesWeighted().at(j).first; currentCompetency = currentCourse.teachedCompetenciesWeighted().at(j).first;
...@@ -170,12 +170,12 @@ std::tuple<int, int, double, int> ConstraintsPrerequisites::_prereqsInPreviousTF ...@@ -170,12 +170,12 @@ std::tuple<int, int, double, int> ConstraintsPrerequisites::_prereqsInPreviousTF
if(cInTF.size() == 0) //if empty, we'll find nothing if(cInTF.size() == 0) //if empty, we'll find nothing
return std::tuple<int, int, double, int>(prereqs.size(), 0, magDiff, divisor); return std::tuple<int, int, double, int>(prereqs.size(), 0, magDiff, divisor);
for(int i = 0; i < prereqs.size(); i++) for(unsigned int i = 0; i < prereqs.size(); i++)
{ {
found = false; found = false;
//std::cout << "Looking for " << prereqs.at(i) << std::endl; //std::cout << "Looking for " << prereqs.at(i) << std::endl;
for(int j = 0 ; j < cInTF.size() && !found; j++) for(unsigned int j = 0 ; j < cInTF.size() && !found; j++)
{ {
//std::cout << "\n\t" << cInTF.at(j) << std::endl; //std::cout << "\n\t" << cInTF.at(j) << std::endl;
...@@ -223,15 +223,15 @@ std::pair<bool, double> ConstraintsPrerequisites::integrityCheck(Cursus indiv) ...@@ -223,15 +223,15 @@ std::pair<bool, double> ConstraintsPrerequisites::integrityCheck(Cursus indiv)
int currentTF = 0; int currentTF = 0;
Course currentCourse; Course currentCourse;
std::vector<std::pair<Competency, double>> teachedComps; std::vector<std::pair<Competency, double>> teachedComps;
unsigned int idx; int idx;
for(int i = 0; i < indiv.size(); i++) for(unsigned int i = 0; i < indiv.size(); i++)
{ {
currentTF = i / this->_pb.cfg_pickedCoursesByTimeFrame(); currentTF = i / this->_pb.cfg_pickedCoursesByTimeFrame();
currentCourse = this->_pb.coursesCatalogue().at(indiv.at(i)); currentCourse = this->_pb.coursesCatalogue().at(indiv.at(i));
teachedComps = currentCourse.teachedCompetenciesWeighted(); teachedComps = currentCourse.teachedCompetenciesWeighted();
for(int j = 0; j < teachedComps.size(); j++) for(unsigned int j = 0; j < teachedComps.size(); j++)
{ {
idx = this->_pb.mapCompToPosition(teachedComps.at(j).first); idx = this->_pb.mapCompToPosition(teachedComps.at(j).first);
assert(idx >= 0); assert(idx >= 0);
...@@ -243,9 +243,9 @@ std::pair<bool, double> ConstraintsPrerequisites::integrityCheck(Cursus indiv) ...@@ -243,9 +243,9 @@ std::pair<bool, double> ConstraintsPrerequisites::integrityCheck(Cursus indiv)
} }
// === sum for t of all t-i // === sum for t of all t-i
for(int i = 1; i < this->_pb.timeFrames().size() ; i++) for(unsigned int i = 1; i < this->_pb.timeFrames().size() ; i++)
{ {
for(int k = 0; k < this->_pb.competencyCatalogue().size() ; k++) for(unsigned int k = 0; k < this->_pb.competencyCatalogue().size() ; k++)
{ {
compDistribyTF.at(i).at(k) += compDistribyTF.at(i-1).at(k); compDistribyTF.at(i).at(k) += compDistribyTF.at(i-1).at(k);
...@@ -260,9 +260,9 @@ std::pair<bool, double> ConstraintsPrerequisites::integrityCheck(Cursus indiv) ...@@ -260,9 +260,9 @@ std::pair<bool, double> ConstraintsPrerequisites::integrityCheck(Cursus indiv)
double decayVal = 0; double delta = 0; double decayed = 0; double decayVal = 0; double delta = 0; double decayed = 0;
int decaynb = 0; int decaynb = 0;
for(int i = 1; i < compDistribyTF.size(); i++) //starts to 1 because 0 does not have decay for(unsigned int i = 1; i < compDistribyTF.size(); i++) //starts to 1 because 0 does not have decay
{ {
for(int j = 0; j < compDistribyTF.at(0).size(); j++) //cDTF[0] because we do not care which, they all have the same size == this->_pb.competencyCatalogue().size() for(unsigned int j = 0; j < compDistribyTF.at(0).size(); j++) //cDTF[0] because we do not care which, they all have the same size == this->_pb.competencyCatalogue().size()
{ {
decayVal = 0; delta = 0; decayed = 0; decayVal = 0; delta = 0; decayed = 0;
...@@ -276,7 +276,8 @@ std::pair<bool, double> ConstraintsPrerequisites::integrityCheck(Cursus indiv) ...@@ -276,7 +276,8 @@ std::pair<bool, double> ConstraintsPrerequisites::integrityCheck(Cursus indiv)
if(decayClock.at(j)>0) //if there is decay if(decayClock.at(j)>0) //if there is decay
{ {
//we take the diff between decay(j) and decay(j-1) since for each stagnation we instantly repercut the decay //we take the diff between decay(j) and decay(j-1) since for each stagnation we instantly repercut the decay
decayVal = DecayEngine::defaultDecay(decayClock.at(j)) - DecayEngine::defaultDecay(decayClock.at(j)-1); //decayVal = DecayEngine::defaultDecay(decayClock.at(j)) - DecayEngine::defaultDecay(decayClock.at(j)-1);
decayVal = DecayEngine::defaultDecay(decayClock.at(j));
decaynb++; decaynb++;
} }
...@@ -290,7 +291,7 @@ std::pair<bool, double> ConstraintsPrerequisites::integrityCheck(Cursus indiv) ...@@ -290,7 +291,7 @@ std::pair<bool, double> ConstraintsPrerequisites::integrityCheck(Cursus indiv)
// affecting the decay to this comp in upper TFs // affecting the decay to this comp in upper TFs
if(decayed > 0) if(decayed > 0)
{ {
for(int k = i+1 ; k < compDistribyTF.size(); k++) for(unsigned int k = i+1 ; k < compDistribyTF.size(); k++)
{ {
compDistribyTF.at(k).at(j) -= decayVal; compDistribyTF.at(k).at(j) -= decayVal;
...@@ -335,16 +336,16 @@ std::pair<bool, double> ConstraintsPrerequisites::integrityCheck(Cursus indiv) ...@@ -335,16 +336,16 @@ std::pair<bool, double> ConstraintsPrerequisites::integrityCheck(Cursus indiv)
// === checking courses prerequisite // === checking courses prerequisite
int notFound = 0; int notRespected = 0; int nbPrereq = 0; int notFound = 0; int notRespected = 0; int nbPrereq = 0;
double magDiff = 0; int magDivisor = 0; double magDiff = 0; // int magDivisor = 0;
for(int i = 0; i < indiv.size(); i++) for(unsigned int i = 0; i < indiv.size(); i++)
{ {
currentTF = i / this->_pb.cfg_pickedCoursesByTimeFrame(); currentTF = i / this->_pb.cfg_pickedCoursesByTimeFrame();
assert(indiv.at(i) < this->_pb.coursesCatalogue().size()); assert(indiv.at(i) < this->_pb.coursesCatalogue().size());
currentCourse = this->_pb.coursesCatalogue().at(indiv.at(i)); currentCourse = this->_pb.coursesCatalogue().at(indiv.at(i));
for(int j = 0; j < currentCourse.prerequisites().size(); j++) for(unsigned int j = 0; j < currentCourse.prerequisites().size(); j++)
{ {
nbPrereq++; nbPrereq++;
...@@ -423,15 +424,15 @@ std::pair<bool, double> res; ...@@ -423,15 +424,15 @@ std::pair<bool, double> res;
int currentTF = 0; int currentTF = 0;
Course currentCourse; Course currentCourse;
std::vector<std::pair<Competency, double>> teachedComps; std::vector<std::pair<Competency, double>> teachedComps;
unsigned int idx; int idx;
for(int i = 0; i < indiv.size(); i++) for(unsigned int i = 0; i < indiv.size(); i++)
{ {
currentTF = i / this->_pb.cfg_pickedCoursesByTimeFrame(); currentTF = i / this->_pb.cfg_pickedCoursesByTimeFrame();
currentCourse = this->_pb.coursesCatalogue().at(indiv.at(i)); currentCourse = this->_pb.coursesCatalogue().at(indiv.at(i));
teachedComps = currentCourse.teachedCompetenciesWeighted(); teachedComps = currentCourse.teachedCompetenciesWeighted();
for(int j = 0; j < teachedComps.size(); j++) for(unsigned int j = 0; j < teachedComps.size(); j++)
{ {
idx = this->_pb.mapCompToPosition(teachedComps.at(j).first); idx = this->_pb.mapCompToPosition(teachedComps.at(j).first);
assert(idx >= 0); assert(idx >= 0);
...@@ -444,10 +445,10 @@ std::pair<bool, double> res; ...@@ -444,10 +445,10 @@ std::pair<bool, double> res;
// === Comp by TF display section // === Comp by TF display section
std::cout << "\n* Competency value by TF" << std::endl; std::cout << "\n* Competency value by TF" << std::endl;
for(int i = 0 ; i < compDistribyTF.size(); i++) for(unsigned int i = 0 ; i < compDistribyTF.size(); i++)
{ {
std::cout << "TF#" << i << ": ["; std::cout << "TF#" << i << ": [";
for(int j = 0; j < compDistribyTF.at(i).size()-1; j++) for(unsigned int j = 0; j < compDistribyTF.at(i).size()-1; j++)
{ {
std::cout << std::setprecision(3) << compDistribyTF.at(i).at(j) << ";\t"; std::cout << std::setprecision(3) << compDistribyTF.at(i).at(j) << ";\t";
} }
...@@ -455,11 +456,11 @@ std::pair<bool, double> res; ...@@ -455,11 +456,11 @@ std::pair<bool, double> res;
} }
// === sum for t of all t-i // === sum for t of all t-i
for(int i = 1; i < this->_pb.timeFrames().size() ; i++) for(unsigned int i = 1; i < this->_pb.timeFrames().size() ; i++)
{ {
// for(int j = 0; j < i; j++) // for(int j = 0; j < i; j++)
// { // {
for(int k = 0; k < this->_pb.competencyCatalogue().size() ; k++) for(unsigned int k = 0; k < this->_pb.competencyCatalogue().size() ; k++)
{ {
compDistribyTF.at(i).at(k) += compDistribyTF.at(i-1).at(k); compDistribyTF.at(i).at(k) += compDistribyTF.at(i-1).at(k);
// if(compDistribyTF.at(i).at(k) > 1) //commented because decay // if(compDistribyTF.at(i).at(k) > 1) //commented because decay
...@@ -470,10 +471,10 @@ std::pair<bool, double> res; ...@@ -470,10 +471,10 @@ std::pair<bool, double> res;
// === Summed display section // === Summed display section
std::cout << "\n* Summed value by TF" << std::endl; std::cout << "\n* Summed value by TF" << std::endl;
for(int i = 0 ; i < compDistribyTF.size(); i++) for(unsigned int i = 0 ; i < compDistribyTF.size(); i++)
{ {
std::cout << "TF#" << i << ": ["; std::cout << "TF#" << i << ": [";
for(int j = 0; j < compDistribyTF.at(i).size()-1; j++) for(unsigned int j = 0; j < compDistribyTF.at(i).size()-1; j++)
{ {
std::cout << std::setprecision(3) << compDistribyTF.at(i).at(j) << ";\t"; std::cout << std::setprecision(3) << compDistribyTF.at(i).at(j) << ";\t";
} }
...@@ -487,9 +488,9 @@ std::pair<bool, double> res; ...@@ -487,9 +488,9 @@ std::pair<bool, double> res;
double decayVal = 0; double delta = 0; double decayed = 0; double decayVal = 0; double delta = 0; double decayed = 0;
int decaynb = 0; int decaynb = 0;
for(int i = 1; i < compDistribyTF.size(); i++) //starts to 1 because 0 does not have decay for(unsigned int i = 1; i < compDistribyTF.size(); i++) //starts to 1 because 0 does not have decay
{ {
for(int j = 0; j < compDistribyTF.at(0).size(); j++) //cDTF[0] because we do not care which, they all have the same size == this->_pb.competencyCatalogue().size() for(unsigned int j = 0; j < compDistribyTF.at(0).size(); j++) //cDTF[0] because we do not care which, they all have the same size == this->_pb.competencyCatalogue().size()
{ {
decayVal = 0; delta = 0; decayed = 0; decayVal = 0; delta = 0; decayed = 0;
...@@ -503,7 +504,8 @@ std::pair<bool, double> res; ...@@ -503,7 +504,8 @@ std::pair<bool, double> res;
if(decayClock.at(j)>0) //if there is decay if(decayClock.at(j)>0) //if there is decay
{ {
//we take the diff between decay(j) and decay(j-1) since for each stagnation we instantly repercut the decay //we take the diff between decay(j) and decay(j-1) since for each stagnation we instantly repercut the decay
decayVal = DecayEngine::defaultDecay(decayClock.at(j)) - DecayEngine::defaultDecay(decayClock.at(j)-1); //decayVal = DecayEngine::defaultDecay(decayClock.at(j)) - DecayEngine::defaultDecay(decayClock.at(j)-1);
decayVal = DecayEngine::defaultDecay(decayClock.at(j));
decaynb++; decaynb++;
} }
...@@ -517,7 +519,7 @@ std::pair<bool, double> res; ...@@ -517,7 +519,7 @@ std::pair<bool, double> res;
// affecting the decay to this comp in upper TFs // affecting the decay to this comp in upper TFs
if(decayed > 0) if(decayed > 0)
{ {
for(int k = i+1 ; k < compDistribyTF.size(); k++) for(unsigned int k = i+1 ; k < compDistribyTF.size(); k++)
{ {
compDistribyTF.at(k).at(j) -= decayVal; compDistribyTF.at(k).at(j) -= decayVal;
...@@ -563,10 +565,10 @@ std::pair<bool, double> res; ...@@ -563,10 +565,10 @@ std::pair<bool, double> res;
//=== Decay Display Section //=== Decay Display Section
std::cout << "\n* Decayed value by TF" << std::endl; std::cout << "\n* Decayed value by TF" << std::endl;
for(int i = 0 ; i < compDistribyTF.size(); i++) for(unsigned int i = 0 ; i < compDistribyTF.size(); i++)
{ {
std::cout << "TF#" << i << ": ["; std::cout << "TF#" << i << ": [";
for(int j = 0; j < compDistribyTF.at(i).size()-1; j++) for(unsigned int j = 0; j < compDistribyTF.at(i).size()-1; j++)
{ {
std::cout << std::setprecision(3) << compDistribyTF.at(i).at(j) << ";\t"; std::cout << std::setprecision(3) << compDistribyTF.at(i).at(j) << ";\t";
} }
......
...@@ -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())
{ {
......
...@@ -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++;
......
...@@ -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;
......
...@@ -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){
......
...@@ -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;
......
...@@ -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\tDistrib mean: " << std::get<2>(stats); std::cout << "\n\tDistrib mean: " << std::get<2>(stats);
std::cout << "\n\tDistrib median: " << std::get<3>(stats) << std::endl; std::cout << "\n\tDistrib 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 << "\tAssigned in HL#" << i <<": " << CompetencyDistribution::getHLevel(*this, i).size() << std::endl; std::cout << "\tAssigned 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;
......
...@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment