Commit 66b12fec authored by Alexis Lebis's avatar Alexis Lebis

DEBUGGING IN PROGRESS

parent b350d092
......@@ -27,18 +27,19 @@ std::pair<bool, double> ConstraintsPrerequisites::integrityCheck(Cursus indiv)
bool changedTF = false;
std::cout << "=========START========" << std::endl;
for(int i = 0; i < indiv.size() ; i++)
{
if(currentTF != i / this->_pb.cfg_pickedCoursesByTimeFrame())
{
std::cout << "I've changed of TF" << std::endl;
//std::cout << "I've changed of TF" << std::endl;
changedTF = true;
}
else
changedTF = false;
currentTF = i / this->_pb.cfg_pickedCoursesByTimeFrame();
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
for(int j = 0 ; changedTF && j < compByTF.at(currentTF-1).size(); j++)
......@@ -49,7 +50,9 @@ std::pair<bool, double> ConstraintsPrerequisites::integrityCheck(Cursus indiv)
// Then, we explore the current TF for new Comp
currentCourse = this->_pb.coursesCatalogue().at(indiv.at(i));
std::cout << "\tPrereq: " << std::to_string(currentCourse.prerequisites().size()) << std::endl;
std::cout << "\t" << currentCourse << std::endl;
//std::cout << "\tPrereq: " << std::to_string(currentCourse.prerequisites().size()) << std::endl;
nbPrereq += currentCourse.prerequisites().size();
for(int j = 0; j < currentCourse.teachedCompetenciesWeighted().size() ; j++)
......@@ -61,6 +64,7 @@ std::pair<bool, double> ConstraintsPrerequisites::integrityCheck(Cursus indiv)
if(alreadyExists.first >= 0) //Already Exists in the array
{
std::cout << currentCompetency.c_name() << " already exists" <<std::endl;
try
{
compByTF.at(currentTF).at(alreadyExists.first).evolveTowards(currentCompetency.magnitude());
......@@ -69,14 +73,22 @@ std::pair<bool, double> ConstraintsPrerequisites::integrityCheck(Cursus indiv)
{
//Should has NTD here
//compToAnswer.at(posFound.first) = e.getCompetency();
std::cout << "INFO:\n(during ConstraintsProfession)\n\n Compentecy evolution throw an exception. Auto rebase. New value is " << e.getCompetency() << std::endl;
//std::cout << "INFO:\n(during ConstraintsProfession)\n\n Compentecy evolution throw an exception. Auto rebase. New value is " << e.getCompetency() << std::endl;
//std::cout << "Comp rebased val is" << compByTF.at(currentTF).at(alreadyExists.first) << std::endl;
std::cout << "exception.Rebased";
}
}
else
{
// Check if prerequisites exists in TF-1
if(currentTF > 0)
{
prereqFound = this->_prereqsInPreviousTF(compByTF.at(currentTF-1), currentCourse.prerequisites());
}
else
{
prereqFound = this->_prereqsInPreviousTF(std::vector<Competency>(0), currentCourse.prerequisites());
}
notFound += prereqFound.first;
notRespected += prereqFound.second;
......@@ -86,6 +98,16 @@ std::pair<bool, double> ConstraintsPrerequisites::integrityCheck(Cursus indiv)
}
}
std::cout << "==EXPLORING COMP BY TF" << std::endl;
for(int i = 0; i < compByTF.size(); i++)
{
std::cout << "TF#" << std::to_string(i) << std::endl;
for(int j = 0; j < compByTF.at(i).size() ; j++)
{
std::cout << compByTF.at(i).at(j) << std::endl;
}
}
bool isOK = ((notFound == 0) && (notRespected == 0));
std::cout << "Not Found: " << std::to_string(notFound) << std::endl;
std::cout << "Not Respected: " << std::to_string(notRespected) << std::endl;
......@@ -101,12 +123,18 @@ std::pair<int, int> ConstraintsPrerequisites::_prereqsInPreviousTF(std::vector<C
int notRespected = 0;
bool found = false;
if(cInTF.size() == 0) //if empty, we'll find nothing
return std::pair<int, int>(prereqs.size(), 0);
for(int i = 0; i < prereqs.size(); i++)
{
found = false;
std::cout << "Looking for " << prereqs.at(i) << std::endl;
for(int j = 0 ; j < cInTF.size() && !found; j++)
{
std::cout << "\n\t" << cInTF.at(j) << std::endl;
if(prereqs.at(i)==cInTF.at(j))
{
found = true;
......@@ -118,6 +146,6 @@ std::pair<int, int> ConstraintsPrerequisites::_prereqsInPreviousTF(std::vector<C
if(!found)
notFound++;
}
std::cout << "NF: " << std::to_string(notFound) << " | NR: " << std::to_string(notRespected) << std::endl;
return std::pair<int, int>(notFound, notRespected);
}
\ No newline at end of file
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