Commit aa2c1b75 authored by Ogier Maitre's avatar Ogier Maitre
Browse files

size_t -> unsigned

parent 40d09af2
......@@ -14,11 +14,11 @@
/* ****************************************
GenerationalCriterion class
****************************************/
CGenerationalCriterion::CGenerationalCriterion(size_t generationalLimit){
CGenerationalCriterion::CGenerationalCriterion(unsigned generationalLimit){
this->generationalLimit = generationalLimit;
}
void CGenerationalCriterion::setCounterEa(size_t* ea_counter){
void CGenerationalCriterion::setCounterEa(unsigned* ea_counter){
this->currentGenerationPtr = ea_counter;
}
......@@ -31,14 +31,14 @@ bool CGenerationalCriterion::reached(){
else return false;
}
size_t* CGenerationalCriterion::getGenerationalLimit(){
unsigned* CGenerationalCriterion::getGenerationalLimit(){
return &(this->generationalLimit);
}
/* ****************************************
TimeCriterion class
****************************************/
CTimeCriterion::CTimeCriterion(size_t timeLimit){
CTimeCriterion::CTimeCriterion(unsigned timeLimit){
this->timeLimit = timeLimit;
this->elapsedTime = 0;
}
......@@ -58,7 +58,7 @@ bool CTimeCriterion::reached(){
else return false;
}
void CTimeCriterion::setElapsedTime(size_t elapsedTime){
void CTimeCriterion::setElapsedTime(unsigned elapsedTime){
this->elapsedTime = elapsedTime;
}
......
......@@ -22,14 +22,14 @@ public:
virtual ~CIndividual();
virtual float evaluate() = 0;
virtual void printOn(std::ostream& O) const = 0;
virtual size_t mutate(float pMutationPerGene) = 0;
virtual unsigned mutate(float pMutationPerGene) = 0;
virtual CIndividual* crossover(CIndividual** p2) = 0;
virtual CIndividual* clone() = 0;
virtual std::string serialize() = 0;
virtual void deserialize(std::string EASEA_Line) = 0;
static size_t getCrossoverArrity(){ return 2; }
static unsigned getCrossoverArrity(){ return 2; }
float getFitness(){ return this->fitness; }
......
......@@ -36,13 +36,13 @@ public:
****************************************/
class CGenerationalCriterion : public CStoppingCriterion {
private:
size_t* currentGenerationPtr;
size_t generationalLimit;
unsigned* currentGenerationPtr;
unsigned generationalLimit;
public:
virtual bool reached();
CGenerationalCriterion(size_t generationalLimit);
void setCounterEa(size_t* ea_counter);
size_t *getGenerationalLimit();
CGenerationalCriterion(unsigned generationalLimit);
void setCounterEa(unsigned* ea_counter);
unsigned *getGenerationalLimit();
};
/* ****************************************
......@@ -50,12 +50,12 @@ class CGenerationalCriterion : public CStoppingCriterion {
****************************************/
class CTimeCriterion : public CStoppingCriterion {
private:
size_t timeLimit;
size_t elapsedTime;
unsigned timeLimit;
unsigned elapsedTime;
public:
virtual bool reached();
CTimeCriterion(size_t timeLimit);
void setElapsedTime(size_t elapsedTime);
CTimeCriterion(unsigned timeLimit);
void setElapsedTime(unsigned elapsedTime);
};
/* ****************************************
......
......@@ -19,8 +19,8 @@ extern CIndividual** pPopulation;
extern CIndividual* bBest;
extern float* pEZ_MUT_PROB;
extern float* pEZ_XOVER_PROB;
extern size_t *EZ_NB_GEN;
extern size_t *EZ_current_generation;
extern unsigned *EZ_NB_GEN;
extern unsigned *EZ_current_generation;
extern CRandomGenerator* globalRandomGenerator;
......
......@@ -26,8 +26,8 @@ CIndividual** pPopulation = NULL;
CIndividual* bBest = NULL;
float* pEZ_MUT_PROB = NULL;
float* pEZ_XOVER_PROB = NULL;
size_t *EZ_NB_GEN;
size_t *EZ_current_generation;
unsigned *EZ_NB_GEN;
unsigned *EZ_current_generation;
CEvolutionaryAlgorithm* EA;
int main(int argc, char** argv){
......@@ -220,7 +220,7 @@ std::ostream& operator << (std::ostream& O, const IndividualImpl& B)
}
size_t IndividualImpl::mutate( float pMutationPerGene ){
unsigned IndividualImpl::mutate( float pMutationPerGene ){
this->valid=false;
......@@ -319,7 +319,7 @@ CEvolutionaryAlgorithm* ParametersImpl::newEvolutionaryAlgorithm(){
pEZ_MUT_PROB = &pMutationPerGene;
pEZ_XOVER_PROB = &pCrossover;
EZ_NB_GEN = (size_t*)setVariable("nbGen",\NB_GEN);
EZ_NB_GEN = (unsigned*)setVariable("nbGen",\NB_GEN);
EZ_current_generation=0;
CEvolutionaryAlgorithm* ea = new EvolutionaryAlgorithmImpl(this);
......@@ -397,13 +397,13 @@ public:
IndividualImpl(const IndividualImpl& indiv);
virtual ~IndividualImpl();
float evaluate();
static size_t getCrossoverArrity(){ return 2; }
static unsigned getCrossoverArrity(){ return 2; }
float getFitness(){ return this->fitness; }
CIndividual* crossover(CIndividual** p2);
void printOn(std::ostream& O) const;
CIndividual* clone();
size_t mutate(float pMutationPerGene);
unsigned mutate(float pMutationPerGene);
string serialize();
void deserialize(string AESAE_Line);
......
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