Commit 7f926ed4 authored by Alexis Lebis's avatar Alexis Lebis

add -y arg : Max Hlevel over Min threshold (in percent)

parent bde8b48c
...@@ -64,6 +64,7 @@ int main(int argc, char* argv[]){ ...@@ -64,6 +64,7 @@ int main(int argc, char* argv[]){
unsigned int MINPRE = parser.createParam((unsigned int)(0), "minPre", "minimal competency by course",'q',"Param").value(); unsigned int MINPRE = parser.createParam((unsigned int)(0), "minPre", "minimal competency by course",'q',"Param").value();
unsigned int MAXPRE = parser.createParam((unsigned int)(3), "maxPre", "maximal competency by course",'Q',"Param").value(); unsigned int MAXPRE = parser.createParam((unsigned int)(3), "maxPre", "maximal competency by course",'Q',"Param").value();
unsigned int CBYTF = parser.createParam((unsigned int)(2), "cbyTF", "course by time frame to pick",'A',"Param").value(); unsigned int CBYTF = parser.createParam((unsigned int)(2), "cbyTF", "course by time frame to pick",'A',"Param").value();
unsigned int THRESHOLD_HLEVEL = parser.createParam((unsigned int)(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();
...@@ -118,6 +119,7 @@ int main(int argc, char* argv[]){ ...@@ -118,6 +119,7 @@ int main(int argc, char* argv[]){
pb.set_cfg_minimalPrerequisiteByCourse(MINPRE); pb.set_cfg_minimalPrerequisiteByCourse(MINPRE);
pb.set_cfg_maximalPrerequisiteByCourse(MAXPRE); pb.set_cfg_maximalPrerequisiteByCourse(MAXPRE);
pb.set_cfg_pickedCoursesByTimeFrame(CBYTF); pb.set_cfg_pickedCoursesByTimeFrame(CBYTF);
pb.set_cfg_thresholdHLevelMaxOverMin(THRESHOLD_HLEVEL);
CSDVP::generateProblem(pb, CSDVP::GenerationType::RANDOM, SEED); CSDVP::generateProblem(pb, CSDVP::GenerationType::RANDOM, SEED);
assert(pb.checkConfig()); assert(pb.checkConfig());
......
...@@ -78,6 +78,8 @@ int CSDVP::CSDVP_COUNTER = 0; ...@@ -78,6 +78,8 @@ int CSDVP::CSDVP_COUNTER = 0;
{ {
this->_maximalMagnitude = Magnitude::build(m); this->_maximalMagnitude = Magnitude::build(m);
} }
void CSDVP::set_cfg_thresholdHLevelMaxOverMin(int thr)
{this->_thresholdMinMaxHLevel = thr;}
void CSDVP::setTimeFrames(std::vector<int> & v) void CSDVP::setTimeFrames(std::vector<int> & v)
{this->_timeFrames = v;} {this->_timeFrames = v;}
...@@ -85,6 +87,7 @@ int CSDVP::CSDVP_COUNTER = 0; ...@@ -85,6 +87,7 @@ int CSDVP::CSDVP_COUNTER = 0;
{this->_availableCourses = c;} {this->_availableCourses = c;}
void CSDVP::setCompetenciesCatalogue(std::vector<Competency> & c) void CSDVP::setCompetenciesCatalogue(std::vector<Competency> & c)
{this->_availableCompentecies = c;} {this->_availableCompentecies = c;}
// ADDER // ADDER
bool CSDVP::addTimeFrame(int tF) bool CSDVP::addTimeFrame(int tF)
{ {
...@@ -441,14 +444,14 @@ int CSDVP::CSDVP_COUNTER = 0; ...@@ -441,14 +444,14 @@ int CSDVP::CSDVP_COUNTER = 0;
queue.push(randomVec.at(i)); queue.push(randomVec.at(i));
int firstTF = 0; int randVal = 0; int firstTF = 0; int randVal = 0;
int threshold = 30; //int threshold = 30;
for(unsigned int i = 0; i < pb.coursesCatalogue().size(); i++) for(unsigned int i = 0; i < pb.coursesCatalogue().size(); i++)
{ {
x = _randomizeIn(pb.cfg_prerequisiteByCourseMin(), pb.cfg_prerequisiteByCourseMax()); x = _randomizeIn(pb.cfg_prerequisiteByCourseMin(), pb.cfg_prerequisiteByCourseMax());
lastTF = pb.coursesCatalogue().at(i).lastTimeFrame(); lastTF = pb.coursesCatalogue().at(i).lastTimeFrame();
firstTF = pb.coursesCatalogue().at(i).timeFrame().at(0); firstTF = pb.coursesCatalogue().at(i).timeFrame().at(0);
randVal = rand() % (100); randVal = rand() % (100);
if( x < threshold) if( x < pb.cfg_thresholdHLevelMaxOverMin())
maxLevel = lastTF * hLevelR / nbTF; maxLevel = lastTF * hLevelR / nbTF;
else else
maxLevel = firstTF * hLevelR / nbTF; maxLevel = firstTF * hLevelR / nbTF;
......
...@@ -49,6 +49,8 @@ class CSDVP ...@@ -49,6 +49,8 @@ class CSDVP
Magnitude _minimalMagnitude; Magnitude _minimalMagnitude;
Magnitude _maximalMagnitude; Magnitude _maximalMagnitude;
int _thresholdMinMaxHLevel; // used for rand in prereq assign with HLevel
// ---------- END CONFIGURATION ATTRIBUTES ---------- // ---------- END CONFIGURATION ATTRIBUTES ----------
// ---------- PROBLEM SPECIFIC ATTRIBUTES ---------- // ---------- PROBLEM SPECIFIC ATTRIBUTES ----------
...@@ -126,6 +128,7 @@ class CSDVP ...@@ -126,6 +128,7 @@ class CSDVP
int cfg_prerequisiteByCourseMin() const {return this->_minimalPrerequisiteByCourse;} int cfg_prerequisiteByCourseMin() const {return this->_minimalPrerequisiteByCourse;}
int cfg_prerequisiteByCourseMax() const {return this->_maximalPrerequisiteByCourse;} int cfg_prerequisiteByCourseMax() const {return this->_maximalPrerequisiteByCourse;}
int cfg_pickedCoursesByTimeFrame() const {return this->_pickedCoursesByTimeFrame;} int cfg_pickedCoursesByTimeFrame() const {return this->_pickedCoursesByTimeFrame;}
int cfg_thresholdHLevelMaxOverMin() const {return this->_thresholdMinMaxHLevel;}
const Magnitude & cfg_magnitudeMin() const{return this->_minimalMagnitude;} const Magnitude & cfg_magnitudeMin() const{return this->_minimalMagnitude;}
const Magnitude & cfg_magnitudeMax() const{return this->_maximalMagnitude;} const Magnitude & cfg_magnitudeMax() const{return this->_maximalMagnitude;}
...@@ -185,6 +188,7 @@ class CSDVP ...@@ -185,6 +188,7 @@ class CSDVP
void set_cfg_minimalPrerequisiteByCourse(int nb); void set_cfg_minimalPrerequisiteByCourse(int nb);
void set_cfg_maximalPrerequisiteByCourse(int nb); void set_cfg_maximalPrerequisiteByCourse(int nb);
void set_cfg_pickedCoursesByTimeFrame(int nb); void set_cfg_pickedCoursesByTimeFrame(int nb);
void set_cfg_thresholdHLevelMaxOverMin(int thr);
void setTimeFrames(std::vector<int> & v); void setTimeFrames(std::vector<int> & v);
void setCoursesCatalogue(std::vector<Course> &); void setCoursesCatalogue(std::vector<Course> &);
......
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