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[]){
//POPULATION INITIALISATION
eoPop<Cursus> pop;
Cursus c1;
for(int i = 0; i < POPSIZE; i++){
for(unsigned int i = 0; i < POPSIZE; i++){
init(c1);
eval(c1);
pop.push_back(c1);
......@@ -331,7 +331,7 @@ int main(int argc, char* argv[]){
std::vector<Competency> compHL = CompetencyDistribution::upToHLevel(pb,2);
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 << "===== CURRENT POP =====" << std::endl;
......@@ -385,7 +385,7 @@ int main(int argc, char* argv[]){
outputfile2 << 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
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;
......@@ -406,7 +406,7 @@ int main(int argc, char* argv[]){
outputfile2 << 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
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;
......
......@@ -25,9 +25,9 @@ void CompetencyDistribution::distribute(CSDVP &pb)
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);
nbAffected++;
......@@ -66,7 +66,7 @@ void CompetencyDistribution::linearDistribution(CSDVP &pb)
}
//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;
for(int i = pb.cfg_quantityCompetencies()-1; i >= nbCompByHL*interval; i--)
......@@ -94,7 +94,7 @@ void CompetencyDistribution::linearDistribution(CSDVP &pb)
return comp;
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)
comp.push_back(pbComp[i]);
......@@ -110,7 +110,7 @@ void CompetencyDistribution::linearDistribution(CSDVP &pb)
for(start = 0; start <= level ; 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]);
}
......@@ -127,7 +127,7 @@ void CompetencyDistribution::linearDistribution(CSDVP &pb)
for(int i = 0; i <= level; 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]);
}
......@@ -140,7 +140,7 @@ void CompetencyDistribution::linearDistribution(CSDVP &pb)
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)
res.push_back(pb.competencyCatalogue().at(i));
......@@ -154,7 +154,7 @@ void CompetencyDistribution::linearDistribution(CSDVP &pb)
int sum = 0;
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
{
......@@ -172,7 +172,7 @@ void CompetencyDistribution::linearDistribution(CSDVP &pb)
void CompetencyDistribution::displayHLevel()
{
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) << "|";
}
......
......@@ -8,7 +8,7 @@ std::pair<bool, double> ConstraintsECTS::integrityCheck(Cursus indiv)
int tmpECTS = 0;
//std::cout << "courses size : " << std::to_string(courses.size()) << 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();
//std::cout << std::to_string(courses.at(indiv[i]).ects()) << " + ";
......
......@@ -15,7 +15,7 @@ std::pair<bool, double> ConstraintsProfession::integrityCheck(Cursus indiv)
{
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();
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)
bool changedTF = false;
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));
......@@ -38,12 +38,12 @@ std::pair<bool, double> ConstraintsProfession::integrityCheck(Cursus indiv)
changedTF = false;
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();
}
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;
......@@ -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();
//std::cout << compToAnswer.at(i) << std::endl;
......@@ -75,7 +75,7 @@ std::pair<bool, double> ConstraintsProfession::integrityCheck(Cursus indiv)
int score = 0;
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())
{
......
......@@ -6,9 +6,9 @@ std::pair<bool, double> ConstraintsRepetition::integrityCheck(Cursus indiv)
{
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))
nbOfRepetition++;
......
......@@ -57,7 +57,7 @@ Course::Course(int id, int ects, std::string name)
const int Course::lastTimeFrame() const
{
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])
max = this->_temporalAvailability[i];
return max;
......
......@@ -30,9 +30,9 @@ class eoInitConstraintCSDVP: public eoInit<EOT>
sizeTF=chromSize/nbTF;
catalogue = pb.coursesCatalogue();
possibleIDbyTF.resize(nbTF);
for(int i=0; i<maxVal; i++){
for(unsigned int i=0; i<maxVal; i++){
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);
}
}
......@@ -46,13 +46,13 @@ class eoInitConstraintCSDVP: public eoInit<EOT>
}
virtual void operator()(EOT& chrom){
int cpt=0;
unsigned int cpt=0;
//std::cout << "Enter init" << std::endl;
unsigned int r=eo::rng.random(possibleIDbyTF[0].size());
chrom.resize(0);
chrom.push_back(possibleIDbyTF[0][r]);
//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;
r=eo::rng.random(possibleIDbyTF[i/sizeTF].size());
while(!notin(chrom, possibleIDbyTF[i/sizeTF][r], i) && cpt<maxVal){
......
......@@ -24,8 +24,8 @@ class mutCSDVP: public eoMonOp<EOT>
//_CourseID subastraction from _chrom
void notin(std::vector<int>& _courseID, std::vector<int>& _chrom){
int tmp;
for (int i=0; i<_chrom.size(); i++){
unsigned int tmp;
for (unsigned int i=0; i<_chrom.size(); i++){
tmp=0;
while(tmp<_courseID.size() && _chrom[i]!=_courseID[tmp])
tmp++;
......@@ -230,7 +230,7 @@ class mutCSDVP: public eoMonOp<EOT>
bool changedTF = false;
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));
......@@ -242,13 +242,13 @@ class mutCSDVP: public eoMonOp<EOT>
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();
}
}
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;
addStatus = tmpCourse.addPrerequisite(tmpComp);
......@@ -275,7 +275,7 @@ class mutCSDVP: public eoMonOp<EOT>
}
compStatus = tmpCourse.prerequisites();
for(int i = 0; i < compStatus.size(); i++)
for(unsigned int i = 0; i < compStatus.size(); i++)
compStatus.at(i).saveDecay();
return compStatus;
......@@ -292,7 +292,7 @@ class mutCSDVP: public eoMonOp<EOT>
Competency checkCmp;
for(int i = 0; i < availableC.size(); i++)
for(unsigned int i = 0; i < availableC.size(); i++)
{
isPrereqOK = true;
......
......@@ -354,7 +354,7 @@ int CSDVP::CSDVP_COUNTER = 0;
}
/* 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);
}
......@@ -406,7 +406,7 @@ int CSDVP::CSDVP_COUNTER = 0;
// 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 = HLComp.at(j);
......@@ -452,7 +452,7 @@ int CSDVP::CSDVP_COUNTER = 0;
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);
//we change mag value for prereq
......@@ -506,14 +506,14 @@ void const CSDVP::displayDistribution(){
std::cout << "\n\tDistrib mean: " << std::get<2>(stats);
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 << "Distrib:" << std::endl;
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);
if(i < this->_distributedCompetencies.size() -1 )
......@@ -529,9 +529,9 @@ std::tuple<int, int, double, double> CSDVP::distributionStats()
int unassigned = 0;
int aboveFive = 0;// >= 0.5
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)
unassigned++;
......@@ -547,8 +547,8 @@ std::tuple<int, int, double, double> CSDVP::distributionStats()
std::get<0>(stats) = unassigned;
std::get<1>(stats) = aboveFive;
std::get<2>(stats) = mean; //todo
std::get<3>(stats) = -1; //todo
std::get<2>(stats) = mean;
std::get<3>(stats) = median; //@todo
return stats;
}
......@@ -564,12 +564,12 @@ std::tuple<int, int, double, double> CSDVP::distributionStats()
Stream << s;
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 << "===Competencies:";
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";
return Stream;
......
......@@ -248,7 +248,7 @@ void Profession::_pickWithHLWeighting(int nbToPick, Profession & job, CSDVP & pb
{
std::vector<int> range;
int sumInterval = 0;
int x; int currentHL;
int x; unsigned int currentHL;
double magVal;
Competency ctmp;
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