Commit d2eb097f authored by Alexis Lebis's avatar Alexis Lebis

integrityCheck debugging -- further test needed

parent b224af89
......@@ -72,8 +72,8 @@ int main(int argc, char* argv[]){
ConstraintsProfession::DISCRETE_METRIC = parser.createParam((unsigned int)(1), "jobEvalDiscrete" , "What type of metric to use between discret and continue with mag", 'k', "Param").value();
ConstraintsPrerequisites::DISCRETE_METRIC = parser.createParam((unsigned int)(1), "prqEvalDiscrete" , "What type of metric to use between discret and continue with mag constraints", 'K', "Param").value();
ConstraintsPrerequisites::INTEGRITY_CHECK = parser.createParam((unsigned int)(1), "prqCheckFunc" , "Dev. option: switching between prereqCheck func 1 and 2", 'O', "Param").value();
CompetencyDistribution::HLEVEL[0] = parser.createParam((int)(100), "hLevel0", "Comp Percentage in the HLevel 0", '0', "Param").value();
CompetencyDistribution::HLEVEL[1] = parser.createParam((int)(-1), "hLevel1", "Comp Percentage in the HLevel 1", '1', "Param").value();
CompetencyDistribution::HLEVEL[0] = parser.createParam((int)(50), "hLevel0", "Comp Percentage in the HLevel 0", '0', "Param").value();
CompetencyDistribution::HLEVEL[1] = parser.createParam((int)(50), "hLevel1", "Comp Percentage in the HLevel 1", '1', "Param").value();
CompetencyDistribution::HLEVEL[2] = parser.createParam((int)(-1), "hLevel2", "Comp Percentage in the HLevel 2", '2', "Param").value();
CompetencyDistribution::HLEVEL[3] = parser.createParam((int)(-1), "hLevel3", "Comp Percentage in the HLevel 3", '3', "Param").value();
CompetencyDistribution::HLEVEL[4] = parser.createParam((int)(-1), "hLevel4", "Comp Percentage in the HLevel 4", '4', "Param").value();
......
......@@ -200,6 +200,7 @@ std::tuple<int, int, double, int> ConstraintsPrerequisites::_prereqsInPreviousTF
return std::tuple<int, int, double, int>(notFound, notRespected, magDiff, divisor);
}
// @todo repercuter les affections du decay sur tt les n+1
std::pair<bool, double> ConstraintsPrerequisites::integrityCheck(Cursus indiv)
{
std::pair<bool, double> res;
......@@ -257,28 +258,46 @@ std::pair<bool, double> ConstraintsPrerequisites::integrityCheck(Cursus indiv)
// === apply decay
std::vector<double> tmpDiff;
std::vector<int> decayClock(this->_pb.competencyCatalogue().size());
double decayVal = 0; double delta = 0;
double decayVal = 0; double delta = 0; double decayed = 0;
int decaynb = 0;
for(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++) //0 because we do not care which, they all have the same size == this->_pb.competencyCatalogue().size()
{
decayVal = 0; delta = 0;
decayVal = 0; delta = 0; decayed = 0;
tmpDiff.push_back(compDistribyTF.at(i).at(j) - compDistribyTF.at(i-1).at(j));
if(tmpDiff.at(j) == 0) //if 0->comp stagnation therefore decay
if(compDistribyTF.at(i).at(j) - compDistribyTF.at(i-1).at(j) == 0) //if 0->comp stagnation therefore decay
{
decayClock.at(j)++;
}
else
{
if(decayClock.at(j)>0)
decayVal = DecayEngine::defaultDecay(decayClock.at(j)-1);
{
decayVal = DecayEngine::defaultDecay(decayClock.at(j));
decaynb++;
}
// storing the delta of the mag in i-1 ; i
delta = compDistribyTF.at(i).at(j) - compDistribyTF.at(i-1).at(j);
compDistribyTF.at(i).at(j) = delta + ( compDistribyTF.at(i-1).at(j) - decayVal );
decayed = compDistribyTF.at(i-1).at(j) - decayVal;
if(decayed < 0)
decayed = 0;
compDistribyTF.at(i).at(j) = delta + decayed;
// affecting the decay to this comp in upper TFs
if(decayed > 0)
{
for(int k = i+1 ; k < compDistribyTF.size(); k++)
{
compDistribyTF.at(k).at(j) -= decayVal;
}
}
decayClock.at(j) = 0;
}
......@@ -296,8 +315,6 @@ std::pair<bool, double> ConstraintsPrerequisites::integrityCheck(Cursus indiv)
assert(indiv.at(i) < this->_pb.coursesCatalogue().size());
currentCourse = this->_pb.coursesCatalogue().at(indiv.at(i));
// std::cout << currentCourse << std::endl;
for(int j = 0; j < currentCourse.prerequisites().size(); j++)
{
nbPrereq++;
......
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