Commit e8851788 authored by Ogier Maitre's avatar Ogier Maitre

Suppression des warnings

parent 8622278c
......@@ -62,4 +62,4 @@ extern float fSELECT_PRM, fRED_PAR_PRM, fRED_FINAL_PRM, fRED_OFF_PRM;
extern unsigned iMAX_INIT_TREE_D,iMIN_INIT_TREE_D,iMAX_TREE_D,iNB_GPU,iPRG_BUF_SIZE,iMAX_TREE_DEPTH,iNO_FITNESS_CASES;
// Prototypes
extern int mystricmp(char *, char *);
extern int mystricmp(const char *, const char *);
......@@ -4343,7 +4343,7 @@ inline char mytolower(char c) {
return ((c>=65)&&(c<=90)) ? c+=32:c;
}
inline int mystricmp(char *string1, char *string2){
inline int mystricmp(const char *string1, const char *string2){
int i;
for (i=0; string1[i]&&string2[i];i++){
if (mytolower(string1[i])<mytolower(string2[i])) return -(i+1);
......
......@@ -2207,7 +2207,7 @@ inline char mytolower(char c) {
return ((c>=65)&&(c<=90)) ? c+=32:c;
}
inline int mystricmp(char *string1, char *string2){
inline int mystricmp(const char *string1, const char *string2){
int i;
for (i=0; string1[i]&&string2[i];i++){
if (mytolower(string1[i])<mytolower(string2[i])) return -(i+1);
......
......@@ -149,7 +149,7 @@ void CSymbol::print(FILE *fp){
if (pSym->Object->ObjectType==oPointer)
fprintf(fp," %s=NULL;\n",pSym->Object->sName);
if (pSym->Object->ObjectType==oArrayPointer){
fprintf(fp," for(int EASEA_Ndx=0; EASEA_Ndx<%d; EASEA_Ndx++)\n",pSym->Object->nSize/sizeof(char*));
fprintf(fp," for(int EASEA_Ndx=0; EASEA_Ndx<%d; EASEA_Ndx++)\n",(int)(pSym->Object->nSize/sizeof(char*)));
fprintf(fp," %s[EASEA_Ndx]=NULL;\n",pSym->Object->sName);
}
}
......@@ -168,7 +168,7 @@ void CSymbol::print(FILE *fp){
fprintf(fp," %s=(EASEA_Var.%s ? new %s(*(EASEA_Var.%s)) : NULL);\n",pSym->Object->sName,pSym->Object->sName,pSym->Object->pType->sName,pSym->Object->sName);
}
if( pSym->Object->ObjectType==oArrayPointer ){
fprintf(fp," for(int EASEA_Ndx=0; EASEA_Ndx<%d; EASEA_Ndx++)\n",pSym->Object->nSize/sizeof(char*));
fprintf(fp," for(int EASEA_Ndx=0; EASEA_Ndx<%d; EASEA_Ndx++)\n",(int)(pSym->Object->nSize/sizeof(char*)));
fprintf(fp," if( EASEA_Var.%s[EASEA_Ndx] ) %s[EASEA_Ndx] = new %s(*(EASEA_Var.%s[EASEA_Ndx]));\n",pSym->Object->sName,pSym->Object->sName,pSym->Object->pType->sName,pSym->Object->sName);
fprintf(fp," else %s[EASEA_Ndx] = NULL;\n",pSym->Object->sName);
}
......@@ -181,7 +181,7 @@ void CSymbol::print(FILE *fp){
if (pSym->Object->ObjectType==oPointer)
fprintf(fp," if (%s) delete %s;\n %s=NULL;\n",pSym->Object->sName,pSym->Object->sName,pSym->Object->sName);
if( pSym->Object->ObjectType==oArrayPointer ){
fprintf(fp," for(int EASEA_Ndx=0; EASEA_Ndx<%d; EASEA_Ndx++)\n",pSym->Object->nSize/sizeof(char*));
fprintf(fp," for(int EASEA_Ndx=0; EASEA_Ndx<%d; EASEA_Ndx++)\n",(int)(pSym->Object->nSize/sizeof(char*)));
fprintf(fp," if( %s[EASEA_Ndx] ) delete %s[EASEA_Ndx];\n",pSym->Object->sName,pSym->Object->sName);
}
}
......@@ -249,7 +249,7 @@ void CSymbol::print(FILE *fp){
fprintf(fp," %s[EASEA_Ndx] = EASEA_Var.%s[EASEA_Ndx];}\n",pSym->Object->sName,pSym->Object->sName);
}
if (pSym->Object->ObjectType==oArrayPointer){
fprintf(fp," for(int EASEA_Ndx=0; EASEA_Ndx<%d; EASEA_Ndx++)\n",pSym->Object->nSize/sizeof(char*));
fprintf(fp," for(int EASEA_Ndx=0; EASEA_Ndx<%d; EASEA_Ndx++)\n",(int)(pSym->Object->nSize/sizeof(char*)));
fprintf(fp," if(EASEA_Var.%s[EASEA_Ndx]) %s[EASEA_Ndx] = new %s(*(EASEA_Var.%s[EASEA_Ndx]));\n",pSym->Object->sName,pSym->Object->sName,pSym->Object->pType->sName,pSym->Object->sName);
}
if (pSym->Object->ObjectType==oPointer){
......@@ -270,7 +270,7 @@ void CSymbol::print(FILE *fp){
fprintf(fp," if (%s[EASEA_Ndx]!=EASEA_Var.%s[EASEA_Ndx]) return false;}\n",pSym->Object->sName,pSym->Object->sName);
}
if ( pSym->Object->ObjectType==oArrayPointer){
fprintf(fp," {for(int EASEA_Ndx=0; EASEA_Ndx<%d; EASEA_Ndx++)\n",pSym->Object->nSize/sizeof(char*));
fprintf(fp," {for(int EASEA_Ndx=0; EASEA_Ndx<%d; EASEA_Ndx++)\n",(int)(pSym->Object->nSize/sizeof(char*)));
fprintf(fp," if (%s[EASEA_Ndx]!=EASEA_Var.%s[EASEA_Ndx]) return false;}\n",pSym->Object->sName,pSym->Object->sName);
}
if (pSym->Object->ObjectType==oPointer){
......@@ -295,7 +295,7 @@ void CSymbol::print(FILE *fp){
}
if( pSym->Object->ObjectType==oArrayPointer){
fprintf(fp," {os << \"Array %s : \";\n",pSym->Object->sName);
fprintf(fp," for(int EASEA_Ndx=0; EASEA_Ndx<%d; EASEA_Ndx++)\n",pSym->Object->nSize/sizeof(char*));
fprintf(fp," for(int EASEA_Ndx=0; EASEA_Ndx<%d; EASEA_Ndx++)\n",(int)(pSym->Object->nSize/sizeof(char*)));
fprintf(fp," if( EASEA_Var.%s[EASEA_Ndx] ) os << \"[\" << EASEA_Ndx << \"]:\" << *(EASEA_Var.%s[EASEA_Ndx]) << \"\\t\";}\n os << \"\\n\";\n",pSym->Object->sName,pSym->Object->sName);
}
if (pSym->Object->ObjectType==oPointer)
......@@ -334,7 +334,7 @@ void CSymbol::print(FILE *fp){
if ((pSym->Object->ObjectType==oArray))
fprintf(fp," %s %s[%d];\n",pSym->Object->pType->sName,pSym->Object->sName,pSym->Object->nSize/pSym->Object->pType->nSize);
if ((pSym->Object->ObjectType==oArrayPointer))
fprintf(fp," %s* %s[%d];\n",pSym->Object->pType->sName,pSym->Object->sName,pSym->Object->nSize/sizeof(char*));
fprintf(fp," %s* %s[%d];\n",pSym->Object->pType->sName,pSym->Object->sName,(int)(pSym->Object->nSize/sizeof(char*)));
}
......
......@@ -82,6 +82,9 @@ endif
EaseaParse.o: EaseaParse.cpp EaseaLex.cpp
$(CPPC) $(CPPFLAGS) $< -o $@ -c 2>/dev/null
EaseaLex.o: EaseaLex.cpp
$(CPPC) $(CPPFLAGS) $< -o $@ -c 2>/dev/null
%.o:%.cpp
$(CPPC) $(CPPFLAGS) -c -o $@ $<
......
......@@ -44,8 +44,8 @@ extern bool INSTEAD_EVAL_STEP;
/**
* @DEPRECATED the next contructor has to be used instead of this one.
*/
/*CEvolutionaryAlgorithm::CEvolutionaryAlgorithm( size_t parentPopulationSize,
size_t offspringPopulationSize,
/*CEvolutionaryAlgorithm::CEvolutionaryAlgorithm( unsigned parentPopulationSize,
unsigned offspringPopulationSize,
float selectionPressure, float replacementPressure, float parentReductionPressure, float offspringReductionPressure,
CSelectionOperator* selectionOperator, CSelectionOperator* replacementOperator,
CSelectionOperator* parentReductionOperator, CSelectionOperator* offspringReductionOperator,
......@@ -285,7 +285,7 @@ void CEvolutionaryAlgorithm::showPopulationStats(struct timeval beginTime){
//Calcul de la moyenne et de l'ecart type
population->Best=population->parents[0];
for(size_t i=0; i<population->parentPopulationSize; i++){
for(unsigned i=0; i<population->parentPopulationSize; i++){
currentAverageFitness+=population->parents[i]->getFitness();
// here we are looking for the smaller individual's fitness if we are minimizing
......@@ -297,7 +297,7 @@ void CEvolutionaryAlgorithm::showPopulationStats(struct timeval beginTime){
currentAverageFitness/=population->parentPopulationSize;
for(size_t i=0; i<population->parentPopulationSize; i++){
for(unsigned i=0; i<population->parentPopulationSize; i++){
currentSTDEV+=(population->parents[i]->getFitness()-currentAverageFitness)*(population->parents[i]->getFitness()-currentAverageFitness);
}
currentSTDEV/=population->parentPopulationSize;
......@@ -332,7 +332,7 @@ void CEvolutionaryAlgorithm::showPopulationStats(struct timeval beginTime){
f = fopen(fichier.c_str(),"a"); //ajouter .csv
if(f!=NULL){
if(currentGeneration==0)
fprintf(f,"#GEN\tTIME\t\tEVAL\tBEST\t\tAVG\t\tSTDEV\n\n");
fprintf(f,"#GEN\tTIME\t\tEVAL\tBEST\t\tAVG\t\tSTDEV\n\n");
#ifdef WIN32
fprintf(f,"%lu\t%2.6f\t%lu\t%.15e\t%.15e\t%.15e\n",currentGeneration,duration,population->currentEvaluationNb,population->Best->getFitness(),currentAverageFitness,currentSTDEV);
#else
......@@ -352,7 +352,7 @@ void CEvolutionaryAlgorithm::showPopulationStats(struct timeval beginTime){
#ifdef WIN32
fprintf(f,"%lu,%2.6f,%lu,%.15e,%.15e,%.15e\n",currentGeneration,duration,population->currentEvaluationNb,population->Best->getFitness(),currentAverageFitness,currentSTDEV);
#else
fprintf(f,"%d,%ld.%d,%d,%f,%f,%f\n",currentGeneration,res.tv_sec,res.tv_usec,population->currentEvaluationNb,population->Best->getFitness(),currentAverageFitness,currentSTDEV);
fprintf(f,"%d,%ld.%ld,%d,%f,%f,%f\n",currentGeneration,res.tv_sec,res.tv_usec,population->currentEvaluationNb,population->Best->getFitness(),currentAverageFitness,currentSTDEV);
#endif
fclose(f);
}
......@@ -404,7 +404,7 @@ void CEvolutionaryAlgorithm::sendIndividual(){
if(this->currentGeneration%(10+this->myClientNumber)==0){
//cout << "I'm going to send an Individual now" << endl;
//this->population->selectionOperator->initialize(this->population->parents, 7, this->population->actualParentPopulationSize);
//size_t index = this->population->selectionOperator->selectNext(this->population->actualParentPopulationSize);
//unsigned index = this->population->selectionOperator->selectNext(this->population->actualParentPopulationSize);
//cout << "Going to send individual " << index << " with fitness " << this->population->parents[index]->fitness << endl;
//selecting a client randomly
......@@ -429,7 +429,7 @@ void CEvolutionaryAlgorithm::receiveIndividuals(){
//selecting the individual to erase
CSelectionOperator *antiTournament = getSelectionOperator("Tournament",!this->params->minimizing, globalRandomGenerator);
antiTournament->initialize(this->population->parents, 7, this->population->actualParentPopulationSize);
size_t index = antiTournament->selectNext(this->population->actualParentPopulationSize);
unsigned index = antiTournament->selectNext(this->population->actualParentPopulationSize);
//cout << "old individual fitness :" << this->population->parents[index]->fitness << endl;
//cout << "old Individual :" << this->population->parents[index]->serialize() << endl;
......@@ -487,7 +487,7 @@ void CEvolutionaryAlgorithm::generateRScript(){
bool CEvolutionaryAlgorithm::allCriteria(){
for( size_t i=0 ; i<stoppingCriteria.size(); i++ ){
for( unsigned i=0 ; i<stoppingCriteria.size(); i++ ){
if( stoppingCriteria.at(i)->reached() ){
std::cout << "Stopping criterion reached" << std::endl;
return true;
......
......@@ -35,7 +35,7 @@ extern CIndividual* bBest;
CPopulation::CPopulation(){
}
CPopulation::CPopulation(size_t parentPopulationSize, size_t offspringPopulationSize,
CPopulation::CPopulation(unsigned parentPopulationSize, unsigned offspringPopulationSize,
float pCrossover, float pMutation, float pMutationPerGene,
CRandomGenerator* rg, Parameters* params){
......@@ -63,14 +63,14 @@ CPopulation::CPopulation(size_t parentPopulationSize, size_t offspringPopulation
}
void CPopulation::syncInVector(){
for( size_t i = 0 ; i<actualParentPopulationSize ; i++ ){
for( unsigned i = 0 ; i<actualParentPopulationSize ; i++ ){
parents[i] = pop_vect.at(i);
}
}
void CPopulation::syncOutVector(){
pop_vect.clear();
for( size_t i = 0 ; i<actualParentPopulationSize ; i++ ){
for( unsigned i = 0 ; i<actualParentPopulationSize ; i++ ){
pop_vect.push_back(parents[i]);
}
#ifndef WIN32
......@@ -79,8 +79,8 @@ void CPopulation::syncOutVector(){
}
CPopulation::~CPopulation(){
for( size_t i=0 ; i<actualOffspringPopulationSize ; i++ ) delete(offsprings[i]);
for( size_t i=0 ; i<actualParentPopulationSize ; i++ ) delete(parents[i]);
for( unsigned i=0 ; i<actualOffspringPopulationSize ; i++ ) delete(offsprings[i]);
for( unsigned i=0 ; i<actualParentPopulationSize ; i++ ) delete(parents[i]);
delete[](this->parents);
delete[](this->offsprings);
......@@ -107,12 +107,12 @@ void CPopulation::initPopulation(CSelectionOperator* selectionOperator,
void CPopulation::evaluatePopulation(CIndividual** population, size_t populationSize){
for( size_t i=0 ; i < populationSize ; i++ )
void CPopulation::evaluatePopulation(CIndividual** population, unsigned populationSize){
for( unsigned i=0 ; i < populationSize ; i++ )
population[i]->evaluate();
}
void CPopulation::optimisePopulation(CIndividual** population, size_t populationSize){
void CPopulation::optimisePopulation(CIndividual** population, unsigned populationSize){
}
void CPopulation::evaluateParentPopulation(){
......@@ -141,17 +141,17 @@ void CPopulation::optimiseOffspringPopulation(){
*/
void CPopulation::reducePopulation(CIndividual** population, size_t populationSize,
CIndividual** reducedPopulation, size_t obSize,
void CPopulation::reducePopulation(CIndividual** population, unsigned populationSize,
CIndividual** reducedPopulation, unsigned obSize,
CSelectionOperator* replacementOperator){
replacementOperator->initialize(population,replacementPressure,populationSize);
for( size_t i=0 ; i<obSize ; i++ ){
for( unsigned i=0 ; i<obSize ; i++ ){
// select an CIndividual and add it to the reduced population
size_t selectedIndex = replacementOperator->selectNext(populationSize - i);
unsigned selectedIndex = replacementOperator->selectNext(populationSize - i);
// std::cout << "Selected " << selectedIndex << "/" << populationSize
// << " replaced by : " << populationSize-(i+1)<< std::endl;
reducedPopulation[i] = population[selectedIndex];
......@@ -166,7 +166,7 @@ void CPopulation::reducePopulation(CIndividual** population, size_t populationSi
}
CIndividual** CPopulation::reduceParentPopulation(size_t obSize){
CIndividual** CPopulation::reduceParentPopulation(unsigned obSize){
CIndividual** nextGeneration;
if(obSize==0){
nextGeneration = new CIndividual*[1];
......@@ -178,7 +178,7 @@ CIndividual** CPopulation::reduceParentPopulation(size_t obSize){
CPopulation::parentReductionOperator);
// free no longer needed CIndividuals
for( size_t i=0 ; i<actualParentPopulationSize-obSize ; i++ )
for( unsigned i=0 ; i<actualParentPopulationSize-obSize ; i++ )
delete(parents[i]);
delete[](parents);
......@@ -191,7 +191,7 @@ CIndividual** CPopulation::reduceParentPopulation(size_t obSize){
CIndividual** CPopulation::reduceOffspringPopulation(size_t obSize){
CIndividual** CPopulation::reduceOffspringPopulation(unsigned obSize){
// this array has offspringPopulationSize because it will be used as offspring population in
// the next generation
CIndividual** nextGeneration = new CIndividual*[offspringPopulationSize];
......@@ -201,7 +201,7 @@ CIndividual** CPopulation::reduceOffspringPopulation(size_t obSize){
//printf("POPULATION SIZE %d\n",actualOffspringPopulationSize-obSize);
// free no longer needed CIndividuals
for( size_t i=0 ; i<actualOffspringPopulationSize-obSize ; i++ )
for( unsigned i=0 ; i<actualOffspringPopulationSize-obSize ; i++ )
delete(offsprings[i]);
delete[](offsprings);
//printf("DANS LA FONCTION DE REMPLACEMENT\n");
......@@ -230,11 +230,11 @@ static int CIndividualRCompare(const void* p1, const void* p2){
}
void CPopulation::sortPopulation(CIndividual** population, size_t populationSize){
void CPopulation::sortPopulation(CIndividual** population, unsigned populationSize){
qsort(population,populationSize,sizeof(CIndividual*),CIndividualCompare);
}
void CPopulation::sortRPopulation(CIndividual** population, size_t populationSize){
void CPopulation::sortRPopulation(CIndividual** population, unsigned populationSize){
qsort(population,populationSize,sizeof(CIndividual*),CIndividualRCompare);
}
......@@ -266,7 +266,7 @@ void CPopulation::reduceTotalPopulation(CIndividual** elitPop){
if(params->elitSize)
memcpy(nextGeneration,elitPop, sizeof(CIndividual*)*params->elitSize);
size_t actualGlobalSize = actualParentPopulationSize+actualOffspringPopulationSize;
unsigned actualGlobalSize = actualParentPopulationSize+actualOffspringPopulationSize;
CIndividual** globalPopulation = new CIndividual*[actualGlobalSize]();
......@@ -303,19 +303,19 @@ void CPopulation::reduceTotalPopulation(CIndividual** elitPop){
void CPopulation::produceOffspringPopulation(){
size_t crossoverArrity = CIndividual::getCrossoverArrity();
unsigned crossoverArrity = CIndividual::getCrossoverArrity();
CIndividual* p1;
CIndividual** ps = new CIndividual*[crossoverArrity]();
CIndividual* child;
selectionOperator->initialize(parents,selectionPressure,actualParentPopulationSize);
for( size_t i=0 ; i<offspringPopulationSize ; i++ ){
size_t index = selectionOperator->selectNext(parentPopulationSize);
for( unsigned i=0 ; i<offspringPopulationSize ; i++ ){
unsigned index = selectionOperator->selectNext(parentPopulationSize);
p1 = parents[index];
if( rg->tossCoin(pCrossover) ){
for( size_t j=0 ; j<crossoverArrity-1 ; j++ ){
for( unsigned j=0 ; j<crossoverArrity-1 ; j++ ){
index = selectionOperator->selectNext(parentPopulationSize);
ps[j] = parents[index];
}
......@@ -345,22 +345,22 @@ void CPopulation::produceOffspringPopulation(){
@ARG outPopulationSize the size of the output population
*/
void CPopulation::strongElitism(size_t elitismSize, CIndividual** population, size_t populationSize,
CIndividual** outPopulation, size_t outPopulationSize){
void CPopulation::strongElitism(unsigned elitismSize, CIndividual** population, unsigned populationSize,
CIndividual** outPopulation, unsigned outPopulationSize){
float bestFitness = population[0]->getFitness();
size_t bestCIndividual = 0;
unsigned bestCIndividual = 0;
#ifndef WIN32
if( elitismSize >= 5 )DEBUG_PRT("Warning, elitism has O(n) complexity, elitismSize is maybe too big (%d)",elitismSize);
#endif
//printf("MINIMIZING ? %d\n",params->minimizing);
for(size_t i = 0 ; i<elitismSize ; i++ ){
for(unsigned i = 0 ; i<elitismSize ; i++ ){
//bestFitness = replacementOperator->getExtremum();
bestFitness = population[0]->getFitness();
bestCIndividual = 0;
for( size_t j=0 ; j<populationSize-i ; j++ ){
for( unsigned j=0 ; j<populationSize-i ; j++ ){
if( (params->minimizing && bestFitness > population[j]->getFitness() ) ||
( !params->minimizing && bestFitness < population[j]->getFitness() )){
......@@ -374,7 +374,7 @@ void CPopulation::strongElitism(size_t elitismSize, CIndividual** population, si
}
}
void CPopulation::weakElitism(size_t elitismSize, CIndividual** parentsPopulation, CIndividual** offspringPopulation, size_t* parentPopSize, size_t* offPopSize, CIndividual** outPopulation, size_t outPopulationSize){
void CPopulation::weakElitism(unsigned elitismSize, CIndividual** parentsPopulation, CIndividual** offspringPopulation, unsigned* parentPopSize, unsigned* offPopSize, CIndividual** outPopulation, unsigned outPopulationSize){
float bestParentFitness = parentsPopulation[0]->getFitness();
float bestOffspringFitness = offspringPopulation[0]->getFitness();
......@@ -436,7 +436,7 @@ void CPopulation::weakElitism(size_t elitismSize, CIndividual** parentsPopulatio
}
void CPopulation::addIndividualParentPopulation(CIndividual* indiv, size_t id){
void CPopulation::addIndividualParentPopulation(CIndividual* indiv, unsigned id){
parents[id] = indiv;
}
void CPopulation::addIndividualParentPopulation(CIndividual* indiv){
......@@ -446,11 +446,11 @@ void CPopulation::addIndividualParentPopulation(CIndividual* indiv){
std::ostream& operator << (std::ostream& O, const CPopulation& B)
{
size_t offspringPopulationSize = B.offspringPopulationSize;
size_t realOffspringPopulationSize = B.actualOffspringPopulationSize;
unsigned offspringPopulationSize = B.offspringPopulationSize;
unsigned realOffspringPopulationSize = B.actualOffspringPopulationSize;
size_t parentPopulationSize = B.parentPopulationSize;
size_t realParentPopulationSize = B.actualParentPopulationSize;
unsigned parentPopulationSize = B.parentPopulationSize;
unsigned realParentPopulationSize = B.actualParentPopulationSize;
O << "CPopulation : "<< std::endl;
......@@ -459,7 +459,7 @@ std::ostream& operator << (std::ostream& O, const CPopulation& B)
O << "\t Offspring size : "<< realOffspringPopulationSize << "/" <<
offspringPopulationSize << std::endl;
for( size_t i=0 ; i<realParentPopulationSize ; i++){
for( unsigned i=0 ; i<realParentPopulationSize ; i++){
B.parents[i]->printOn(O);
O << "\n";
......
......@@ -36,22 +36,22 @@ public:
CEvolutionaryAlgorithm( Parameters* params );
virtual void initializeParentPopulation() = 0;
size_t* getCurrentGenerationPtr(){ return &currentGeneration;}
unsigned* getCurrentGenerationPtr(){ return &currentGeneration;}
void addStoppingCriterion(CStoppingCriterion* sc);
void runEvolutionaryLoop();
bool allCriteria();
CPopulation* getPopulation(){ return population;}
size_t getCurrentGeneration() { return currentGeneration;}
unsigned getCurrentGeneration() { return currentGeneration;}
public:
size_t currentGeneration;
unsigned currentGeneration;
CPopulation* population;
size_t reduceParents;
size_t reduceOffsprings;
unsigned reduceParents;
unsigned reduceOffsprings;
//methods and variables for remote island model
size_t treatedIndividuals;
size_t numberOfClients;
size_t myClientNumber;
unsigned treatedIndividuals;
unsigned numberOfClients;
unsigned myClientNumber;
CComUDPServer *server;
CComUDPClient **Clients;
void initializeClients();
......
......@@ -39,18 +39,18 @@ public:
CIndividual** parents;
CIndividual** offsprings;
size_t parentPopulationSize;
size_t offspringPopulationSize;
unsigned parentPopulationSize;
unsigned offspringPopulationSize;
size_t actualParentPopulationSize;
size_t actualOffspringPopulationSize;
unsigned actualParentPopulationSize;
unsigned actualOffspringPopulationSize;
static CSelectionOperator* selectionOperator;
static CSelectionOperator* replacementOperator;
static CSelectionOperator* parentReductionOperator;
static CSelectionOperator* offspringReductionOperator;
size_t currentEvaluationNb;
unsigned currentEvaluationNb;
CRandomGenerator* rg;
std::vector<CIndividual*> pop_vect;
......@@ -58,27 +58,27 @@ public:
public:
CPopulation();
CPopulation(size_t parentPopulationSize, size_t offspringPopulationSize,
CPopulation(unsigned parentPopulationSize, unsigned offspringPopulationSize,
float pCrossover, float pMutation, float pMutationPerGene, CRandomGenerator* rg, Parameters* params);
virtual ~CPopulation();
//virtual void initializeParentPopulation() = 0;
void addIndividualParentPopulation(CIndividual* indiv, size_t id);
void addIndividualParentPopulation(CIndividual* indiv, unsigned id);
void addIndividualParentPopulation(CIndividual* indiv);
void evaluatePopulation(CIndividual** population, size_t populationSize);
virtual void optimisePopulation(CIndividual** population, size_t populationSize);
void evaluatePopulation(CIndividual** population, unsigned populationSize);
virtual void optimisePopulation(CIndividual** population, unsigned populationSize);
virtual void evaluateParentPopulation();
virtual void optimiseParentPopulation();
void strongElitism(size_t elitismSize, CIndividual** population, size_t populationSize, CIndividual** outPopulation, size_t outPopulationSize);
void weakElitism(size_t elitismSize, CIndividual** parentsPopulation, CIndividual** offspringPopulation, size_t* parentPopSize, size_t* offPopSize, CIndividual** outPopulation, size_t outPopulationSize);
void strongElitism(unsigned elitismSize, CIndividual** population, unsigned populationSize, CIndividual** outPopulation, unsigned outPopulationSize);
void weakElitism(unsigned elitismSize, CIndividual** parentsPopulation, CIndividual** offspringPopulation, unsigned* parentPopSize, unsigned* offPopSize, CIndividual** outPopulation, unsigned outPopulationSize);
virtual void evaluateOffspringPopulation();
virtual void optimiseOffspringPopulation();
CIndividual** reducePopulations(CIndividual** population, size_t populationSize,
CIndividual** reducedPopulation, size_t obSize);
CIndividual** reduceParentPopulation(size_t obSize);
CIndividual** reduceOffspringPopulation(size_t obSize);
CIndividual** reducePopulations(CIndividual** population, unsigned populationSize,
CIndividual** reducedPopulation, unsigned obSize);
CIndividual** reduceParentPopulation(unsigned obSize);
CIndividual** reduceOffspringPopulation(unsigned obSize);
void reduceTotalPopulation(CIndividual** elitPop);
void evolve();
......@@ -94,9 +94,9 @@ public:
float selectionPressure, float replacementPressure,
float parentReductionPressure, float offspringReductionPressure);
static void sortPopulation(CIndividual** population, size_t populationSize);
static void sortPopulation(CIndividual** population, unsigned populationSize);
static void sortRPopulation(CIndividual** population, size_t populationSize);
static void sortRPopulation(CIndividual** population, unsigned populationSize);
void serializePopulation();
......@@ -107,13 +107,13 @@ public:
friend std::ostream& operator << (std::ostream& O, const CPopulation& B);
void setParentPopulation(CIndividual** population, size_t actualParentPopulationSize){
void setParentPopulation(CIndividual** population, unsigned actualParentPopulationSize){
this->parents = population;
this->actualParentPopulationSize = actualParentPopulationSize;
}
static void reducePopulation(CIndividual** population, size_t populationSize,
CIndividual** reducedPopulation, size_t obSize,
static void reducePopulation(CIndividual** population, unsigned populationSize,
CIndividual** reducedPopulation, unsigned obSize,
CSelectionOperator* replacementOperator);
void syncOutVector();
void syncInVector();
......
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