@@ -63,11 +64,26 @@ int main(int argc, char* argv[]){
...
@@ -63,11 +64,26 @@ int main(int argc, char* argv[]){
unsignedintMINPRE=parser.createParam((unsignedint)(0),"minPre","minimal competency by course",'q',"Param").value();
unsignedintMINPRE=parser.createParam((unsignedint)(0),"minPre","minimal competency by course",'q',"Param").value();
unsignedintMAXPRE=parser.createParam((unsignedint)(3),"maxPre","maximal competency by course",'Q',"Param").value();
unsignedintMAXPRE=parser.createParam((unsignedint)(3),"maxPre","maximal competency by course",'Q',"Param").value();
unsignedintCBYTF=parser.createParam((unsignedint)(2),"cbyTF","course by time frame to pick",'A',"Param").value();
unsignedintCBYTF=parser.createParam((unsignedint)(2),"cbyTF","course by time frame to pick",'A',"Param").value();
unsignedintTHRESHOLD_HLEVEL=parser.createParam((unsignedint)(30),"minMaxHLevelPrq","Threshold under the one the HLevel max is used instead of min for prqs",'y',"Param").value();
CursusEval::WEIGHT_ECTS=parser.createParam((double)(1.0),"wECTS","Weight of ECTS in the fitness value",'V',"Param").value();
CursusEval::WEIGHT_ECTS=parser.createParam((double)(1.0),"wECTS","Weight of ECTS in the fitness value",'V',"Param").value();
CursusEval::WEIGHT_REPETION=parser.createParam((double)(1.0),"wREP","Weight of Repetition in the fitness value",'v',"Param").value();
CursusEval::WEIGHT_REPETION=parser.createParam((double)(1.0),"wREP","Weight of Repetition in the fitness value",'v',"Param").value();
CursusEval::WEIGHT_JOB=parser.createParam((double)(1.0),"wJob","Weight of profession in the fitness value",'w',"Param").value();
CursusEval::WEIGHT_JOB=parser.createParam((double)(1.0),"wJob","Weight of profession in the fitness value",'w',"Param").value();
CursusEval::WEIGHT_PREREQ=parser.createParam((double)(1.0),"wPrereq","Weight of prerequisites in the fitness value",'W',"Param").value();
CursusEval::WEIGHT_PREREQ=parser.createParam((double)(1.0),"wPrereq","Weight of prerequisites in the fitness value",'W',"Param").value();
DecayEngine::IS_DECAY_DEACTIVATED=parser.createParam((int)(0),"decayDeactivated","Wether or not the decay is deactivated",'D',"Param").value();
DecayEngine::IS_DECAY_DEACTIVATED=parser.createParam((int)(0),"decayDeactivated","Wether or not the decay is deactivated",'D',"Param").value();
ConstraintsProfession::DISCRETE_METRIC=parser.createParam((unsignedint)(1),"jobEvalDiscrete","What type of metric to use between discret and continue with mag",'k',"Param").value();
ConstraintsPrerequisites::DISCRETE_METRIC=parser.createParam((unsignedint)(1),"prqEvalDiscrete","What type of metric to use between discret and continue with mag constraints",'K',"Param").value();
ConstraintsPrerequisites::INTEGRITY_CHECK=parser.createParam((unsignedint)(1),"prqCheckFunc","Dev. option: switching between prereqCheck func 1 and 2",'O',"Param").value();
ConstraintsPrerequisites::OVERFLOW_PERCENT=parser.createParam((int)(0),"overflow","Overflow above 1 authorized during prerequisite calculation can be negative too",'Y',"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();
CompetencyDistribution::HLEVEL[5]=parser.createParam((int)(-1),"hLevel5","Comp Percentage in the HLevel 5",'5',"Param").value();
CompetencyDistribution::HLEVEL[6]=parser.createParam((int)(-1),"hLevel6","Comp Percentage in the HLevel 6",'6',"Param").value();
CompetencyDistribution::HLEVEL[7]=parser.createParam((int)(-1),"hLevel7","Comp Percentage in the HLevel 7",'7',"Param").value();
CompetencyDistribution::HLEVEL[8]=parser.createParam((int)(-1),"hLevel8","Comp Percentage in the HLevel 8",'8',"Param").value();
CompetencyDistribution::HLEVEL[9]=parser.createParam((int)(-1),"hLevel9","Comp Percentage in the HLevel 9",'9',"Param").value();
//PROFESSION PARAMETERS
//PROFESSION PARAMETERS
unsignedintJOB_SEED=parser.createParam((unsignedint)(7777),"jobSeed","Seed used for the Profession",'g',"Param").value();
unsignedintJOB_SEED=parser.createParam((unsignedint)(7777),"jobSeed","Seed used for the Profession",'g',"Param").value();
...
@@ -75,6 +91,7 @@ int main(int argc, char* argv[]){
...
@@ -75,6 +91,7 @@ int main(int argc, char* argv[]){
unsignedintJOB_MAXPRE=parser.createParam((unsignedint)(4),"jobMaxPre","maximal competency prerequisite by a job",'J',"Param").value();
unsignedintJOB_MAXPRE=parser.createParam((unsignedint)(4),"jobMaxPre","maximal competency prerequisite by a job",'J',"Param").value();
doubleJOB_MINMAG=parser.createParam((double)(0.5),"jobMinMag","miminal magnitude for a job",'h',"Param").value();
doubleJOB_MINMAG=parser.createParam((double)(0.5),"jobMinMag","miminal magnitude for a job",'h',"Param").value();
doubleJOB_MAXMAG=parser.createParam((double)(0.95),"jobMaxMag","maxima magnitude for a job",'H',"Param").value();
doubleJOB_MAXMAG=parser.createParam((double)(0.95),"jobMaxMag","maxima magnitude for a job",'H',"Param").value();
Profession::JOB_SELECTION_TYPE=parser.createParam((unsignedint)(0),"jobSelectType","Which type to use to select job",'z',"Param").value();
@@ -85,6 +102,7 @@ int main(int argc, char* argv[]){
...
@@ -85,6 +102,7 @@ int main(int argc, char* argv[]){
RATIO_RANDOM_VS_BEST=parser.createParam((unsignedint)(75),"ratioBest","Ratio between full random and best while prereq check fails in mutation",'B',"Param").value();
RATIO_RANDOM_VS_BEST=parser.createParam((unsignedint)(75),"ratioBest","Ratio between full random and best while prereq check fails in mutation",'B',"Param").value();
// ===== PB CONFIG ZONE =====
// ===== PB CONFIG ZONE =====
CompetencyDistribution::sanitizeHLEVEL();//Mandatory for HLevel
//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
std::vector<std::vector<double>>compDistribyTF;//each i contains an vector representing the magnitique of each comp existing, according to the path followed. [0;1]
for(unsignedinti=1;i<compDistribyTF.size();i++)//starts to 1 because 0 does not have decay
{
for(unsignedintj=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()
magDiff+=currentCourse.prerequisites().at(j).c_magnitude().value();//not exists so full value in diff here
notFound++;
}
else
{
magDiff+=(currentCourse.prerequisites().at(j).c_magnitude().value()-compDistribyTF.at(currentTF-1).at(idx))/currentCourse.prerequisites().at(j).c_magnitude().value();// percentage of diff in [0;1]
std::vector<std::vector<double>>compDistribyTF;//each i contains an vector representing the magnitique of each comp existing, according to the path followed. [0;1]
for(unsignedinti=1;i<compDistribyTF.size();i++)//starts to 1 because 0 does not have decay
{
for(unsignedintj=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()
/** Integrity check is used to investigate wheteher or not one indiv respects the constraints represented by THIS.
/** Integrity check is used to investigate wheteher or not one indiv respects the constraints represented by THIS.
* Returns a std::pair. First is a boolean set to true when the indiv passes the test and therefore is compilant with the constraint, false otherwise. Second is the associated metric, mostly usable during fitness calcul.
* Returns a std::pair. First is a boolean set to true when the indiv passes the test and therefore is compilant with the constraint, false otherwise. Second is the associated metric, mostly usable during fitness calcul.
* For each course c, we roll x, the nb of competencies associated to c.
* For each course c, we roll x, the nb of competencies associated to c.
* To assign a competency to c exhaustively, we create a tmp competency vector v, where the competencies are randomly sorted, then create a queue from it.
* To assign a competency to c exhaustively, we create a tmp competency vector v, where the competencies are randomly sorted, then create a queue from it.
...
@@ -359,6 +390,16 @@ int CSDVP::CSDVP_COUNTER = 0;
...
@@ -359,6 +390,16 @@ int CSDVP::CSDVP_COUNTER = 0;
std::queue<Competency>queue;
std::queue<Competency>queue;
for(unsignedinti=0;i<randomVec.size();i++)
for(unsignedinti=0;i<randomVec.size();i++)
queue.push(randomVec.at(i));
queue.push(randomVec.at(i));
/*
* ADDENDUM:
* We use the HierarchyLevel to condition the assignation of competency.
* A course at level i (defined by its biggest TF) cannot have a comp with HL > i*HLrange / NbTF
* Such a behavior induces a strong hypothesis on how courses draw their comp!
*
*/
/*
* NEXT TO DO :
* Array of boolean : true comp assignée ; évolution un tableau de -1 si pas assigné et [0;1] pour les magn des comp à chaque case puis assigné decay sur l'ensemble du tab -> utile pour borner les mag max du job
* POur prereq juste prendre les comp a true
* +
* Vecteur pour le HLevel en entree en % [20,30,10,10,30] (x cases) a passer en dur
int_thresholdMinMaxHLevel;// used for rand in prereq assign with HLevel
// ---------- END CONFIGURATION ATTRIBUTES ----------
// ---------- END CONFIGURATION ATTRIBUTES ----------
// ---------- PROBLEM SPECIFIC ATTRIBUTES ----------
// ---------- PROBLEM SPECIFIC ATTRIBUTES ----------
...
@@ -57,6 +60,10 @@ class CSDVP
...
@@ -57,6 +60,10 @@ class CSDVP
std::vector<std::vector<Course>>_coursesSortedByTF;//sorted by standard index. e.g. TF[4;6] -> [0]=4; [1]=5 ; [2] = 6
std::vector<std::vector<Course>>_coursesSortedByTF;//sorted by standard index. e.g. TF[4;6] -> [0]=4; [1]=5 ; [2] = 6
std::vector<Competency>_availableCompentecies;//The competency's magnitude should not be used here.
std::vector<Competency>_availableCompentecies;//The competency's magnitude should not be used here.
// This array is index aligned with the compCatalogue of the problem. It represents the current compentecies distrib in the pb. Mostly used during configuratioin.
// -1 : not assigned ; [0;1] the ith comp at the indice i in the cmpCatalogue as been assigned, with a value of x € [0;1].
std::vector<double>_distributedCompetencies;
///@todo implements a decay politics
///@todo implements a decay politics
//DecayPolitics
//DecayPolitics
// --------- END PROBLEM SPECIFIC ATTRIBUTES ---------
// --------- END PROBLEM SPECIFIC ATTRIBUTES ---------
...
@@ -81,6 +88,10 @@ class CSDVP
...
@@ -81,6 +88,10 @@ class CSDVP
/// It sources _coursesSortedByTF, which is another view of _availableCourses, sorted by TF
/// It sources _coursesSortedByTF, which is another view of _availableCourses, sorted by TF
void_makeCoursesSortedByTF();
void_makeCoursesSortedByTF();
// This fuction creates a new tmpComp with mag and add it the comp teached by the course idx of the catalogue
// Using the sourcing function keeps the _distributedCompetencies up to date