Commit 12aad2df authored by Alexis Lebis's avatar Alexis Lebis

start dev problem implem + test in ceao_csdvp.cpp

parent 11aaef16
......@@ -8,6 +8,7 @@ ADD_EXECUTABLE(ceao main.cpp)
ADD_EXECUTABLE(ceao_competency ceao_competency.cpp)
ADD_EXECUTABLE(ceao_course ceao_course.cpp)
ADD_EXECUTABLE(ceao_profession ceao_profession.cpp)
ADD_EXECUTABLE(ceao_csdvp ceao_csdvp.cpp)
ADD_EXECUTABLE(tryInit tryInit.cpp)
ADD_EXECUTABLE(tryMutation tryMutation.cpp)
......@@ -18,6 +19,7 @@ ADD_DEPENDENCIES(ceao lQueen lModel)
ADD_DEPENDENCIES(ceao_competency lQueen lModel)
ADD_DEPENDENCIES(ceao_course lQueen lModel)
ADD_DEPENDENCIES(ceao_profession lQueen lModel)
ADD_DEPENDENCIES(ceao_csdvp lQueen lModel)
ADD_DEPENDENCIES(tryInit lQueen)
ADD_DEPENDENCIES(tryMutation lQueen)
......@@ -30,6 +32,7 @@ TARGET_LINK_LIBRARIES(ceao ${PARADISEO_LIBRARIES} lQueen lModel)
TARGET_LINK_LIBRARIES(ceao_competency ${PARADISEO_LIBRARIES} lQueen lModel)
TARGET_LINK_LIBRARIES(ceao_course ${PARADISEO_LIBRARIES} lQueen lModel)
TARGET_LINK_LIBRARIES(ceao_profession ${PARADISEO_LIBRARIES} lQueen lModel)
TARGET_LINK_LIBRARIES(ceao_csdvp ${PARADISEO_LIBRARIES} lQueen lModel)
TARGET_LINK_LIBRARIES(tryInit ${PARADISEO_LIBRARIES} lQueen)
TARGET_LINK_LIBRARIES(tryMutation ${PARADISEO_LIBRARIES} lQueen)
......
#include <eo>
#include <iostream>
#include <string>
#include <cassert>
#include <utility>
#include <vector>
#include "model/problem.h"
#include "model/course.h"
#include "model/competency.h"
int main(int argc, char* argv[])
{
CSDVP pb;
assert(pb.id() == 1);
assert(pb.seed() == -1);
assert(pb.cfg_quantityCompetencies() == -1);
std::cout << "CSDVP constructor OK" << std::endl;
assert(pb.checkConfig() == false);
std::cout << "OK! CSDVP is not cofig yet here" << std::endl;
return EXIT_SUCCESS;
}
\ No newline at end of file
......@@ -8,6 +8,7 @@ SET (EXERCICE_SOURCES
competency.cpp
course.cpp
profession.cpp
problem.cpp
)
ADD_LIBRARY(lModel STATIC ${EXERCICE_SOURCES})
......
#include <iostream>
#include <utility>
#include <vector>
#include <algorithm>
#include "problem.h"
int CSDVP::CSDVP_COUNTER = 0;
// === FACTORY
// No factory. Only one constructor : all config has to be manually set
// === END FACTORY
// === CONSTRUCTOR
CSDVP::CSDVP()
{
this->_id = CSDVP::assignID();
this->_isConfig = false;
this-> _seed = -1;
this->_quantityAvailableCompetencies = -1;
this->_quantityAvailableCourses = -1;
this->_quantityOfTimeFrame = -1;
this->_minimalECTSValue = -1;
this->_maximalECTSValue = -1;
this->_minimalCoursesByTimeFrame = -1;
this->_maximalCoursesByTimeFrame = -1;
}
// === END CONSTRUCTOR
// === MUTATOR
// SETTER
// ADDER
// === END MUTATOR
// === FUNC
bool CSDVP::checkConfig()
{
//If one of the following is true, CSDVP is not config
if( this->_seed < 0 ||
this->_quantityAvailableCompetencies < 0||
this->_quantityAvailableCourses < 0 ||
this->_quantityOfTimeFrame < 0 ||
this->_minimalECTSValue < 0 ||
this->_maximalECTSValue < 0 ||
this->_minimalCoursesByTimeFrame < 0 ||
this->_maximalCoursesByTimeFrame < 0 )
{
this->_isConfig = false;
return this->_isConfig;
}
this->_isConfig = true;
return this->_isConfig;
}
// === END FUNC
// === STATIC
void CSDVP::generateProblem(CSDVP & csdvp, int seed)
{
csdvp._seed = seed;
if(! csdvp.checkConfig() ) //if csdvp is not configurated, aborting generation
return;
std::cout << "generateProblem TODO" << std::endl;
}
int CSDVP::assignID()
{ return ++CSDVP::CSDVP_COUNTER;}
\ No newline at end of file
......@@ -17,31 +17,74 @@ class CSDVP
private:
int _id;
int _quantityAvailableCompetencies;
std::vector<Competency> _availableCompentecies;
/// Seed used to generate the problem
int _seed;
/// Use to determine if CSDVP has been config by the user.
bool _isConfig;
// ----------- CONFIGURATION ATTRIBUTES ----------
// Config attributes are used to generate a problem instance. This way, two differents problems can be generated within the same definition space. Random is made by _seed.
int _quantityAvailableCompetencies;
int _quantityAvailableCourses;
std::vector<Course> _availableCourses;
int _quantityOfTimeFrame;
/// ECTS values, defining the intervale [_minimal,_maximal] for random
int _minimalECTSValue;
int _maximalECTSValue;
int _minimalCoursesByTimeFrame;
int _maximalCoursesByTimeFrame;
// ---------- END CONFIGURATION ATTRIBUTES ----------
int _numberOfTimeFrame;
// ---------- PROBLEM SPECIFIC ATTRIBUTES ----------
// Theses attributes represent the CSDVP
std::vector<int> _timeFrames;
std::vector<Course> _availableCourses;
std::vector<Competency> _availableCompentecies;
///@todo implements a decay politics
//DecayPolitics
// --------- END PROBLEM SPECIFIC ATTRIBUTES ---------
// Static
static int PROBLEM_COUNTER;
static int CSDVP_COUNTER;
static int assignID();
public:
// === CONSTRUCTOR
CSDVP();
/// Generate an instance of the CSDVP iff isConfig is true. Thus, seed != -1;
void generateProblem(CSDVP & csdvp, int seed= -1 );
// === GETTER
const int id() const{return this->_id;}
const int seed() const{return this->_seed;}
const int cfg_quantityCompetencies() const{return this->_quantityAvailableCompetencies;}
const int cfg_quantityCourses() const{return this->_quantityAvailableCourses;}
const int cfg_quantityTimeFrames() const{return this->_quantityOfTimeFrame;}
const int cfg_ectsMax() const{return this->_maximalECTSValue;}
const int cfg_ectsMin() const{return this->_minimalECTSValue;}
const int cfg_courseByTFMax() const{return this->_maximalCoursesByTimeFrame;}
const int cfg_courseByTFMin() const{return this->_minimalECTSValue;}
const std::vector<int> timeFrames() const{return this->_timeFrames;}
const std::vector<Course> coursesCatalogue() const{return this->_availableCourses;}
const std::vector<Competency> competencyCatalogue() const{return this->_availableCompentecies;}
std::vector<int> unlocked_timeFrames(){return this->_timeFrames;}
std::vector<Course> unlocked_coursesCatalogue(){return this->_availableCourses;}
std::vector<Competency> unlocked_competencyCatalogue(){return this->_availableCompentecies;}
///@todo getDecayPolitic
// === MUTATOR
// SETTER
// ADDER
// === FUNC
/// Checks all configuration attributes. If they have been all set, then isConfig is set to true
bool checkConfig();
};
......
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