From 4b013a30dff5f4ab2fec27962d2d19b987fac556 Mon Sep 17 00:00:00 2001 From: maitre Date: Fri, 11 Dec 2009 10:37:12 +0100 Subject: [PATCH] Un-broken INSTEAD_EVAL CUDA.tpl --- Easea.h | 2 + EaseaLex.l | 4 +- EaseaParse.y | 10 +- dev/tgp_regression/data.csv | 78 --- dev/tgp_regression/tgp_regression.ez | 20 +- examples/ant/ant.ez | 648 ++++++++++++++++++++++++ examples/cmaes_cuda_test/cigtabGPU.ez | 120 +++++ examples/cmaes_tests/cigtab.ez | 125 +++++ examples/weierstrass_gpu/weierstrass.ez | 172 +++++++ examples/weierstrass_std/.RData | Bin 0 -> 551 bytes examples/weierstrass_std/weierstrass.ez | 176 +++++++ tpl/CUDA.tpl | 7 +- tpl/CUDA_GP.tpl | 603 ++++++++++++++++++++++ 13 files changed, 1881 insertions(+), 84 deletions(-) delete mode 100644 dev/tgp_regression/data.csv create mode 100644 examples/ant/ant.ez create mode 100755 examples/cmaes_cuda_test/cigtabGPU.ez create mode 100755 examples/cmaes_tests/cigtab.ez create mode 100755 examples/weierstrass_gpu/weierstrass.ez create mode 100644 examples/weierstrass_std/.RData create mode 100755 examples/weierstrass_std/weierstrass.ez create mode 100755 tpl/CUDA_GP.tpl diff --git a/Easea.h b/Easea.h index 900c090..cf042c8 100755 --- a/Easea.h +++ b/Easea.h @@ -27,6 +27,8 @@ Centre de Math #define CUDA_FLAVOR_SO 0 #define CUDA_FLAVOR_MO 1 #define CUDA_FLAVOR_CMAES 2 +#define CUDA_FLAVOR_GP 3 + #define UNIX 1 #define WINDOWS 2 diff --git a/EaseaLex.l b/EaseaLex.l index 4b275ad..58e6252 100644 --- a/EaseaLex.l +++ b/EaseaLex.l @@ -1828,7 +1828,7 @@ int CEASEALexer::create(CEASEAParser* pParser, CSymbolTable* pSymTable) strcat(sTemp,"CUDA.tpl"); else if(TARGET_FLAVOR == CUDA_FLAVOR_CMAES ) strcat(sTemp,"CMAES_CUDA.tpl"); - else + else strcat(sTemp,"CUDA_MO.tpl"); if (!(yyin = fpTemplateFile = fopen(sTemp, "r"))){ @@ -1842,6 +1842,8 @@ int CEASEALexer::create(CEASEAParser* pParser, CSymbolTable* pSymTable) strcat(sTemp,"STD.tpl"); else if (TARGET_FLAVOR == STD_FLAVOR_CMAES) strcat(sTemp,"CMAES.tpl"); + else if( TARGET_FLAVOR == CUDA_FLAVOR_GP ) + strcat(sTemp,"CUDA_GP.tpl"); else strcat(sTemp,"STD_MO.tpl"); if (!(yyin = fpTemplateFile = fopen(sTemp, "r"))){ diff --git a/EaseaParse.y b/EaseaParse.y index 4ea2f13..8779e56 100755 --- a/EaseaParse.y +++ b/EaseaParse.y @@ -657,6 +657,10 @@ int main(int argc, char *argv[]){ TARGET=CUDA; TARGET_FLAVOR = CUDA_FLAVOR_MO; } + else if( !mystricmp(sTemp,"cuda_gp") ){ + TARGET=STD; + TARGET_FLAVOR = CUDA_FLAVOR_GP; + } else if (!mystricmp(sTemp,"std")) { TARGET=STD; @@ -675,8 +679,12 @@ int main(int argc, char *argv[]){ TARGET_FLAVOR = CUDA_FLAVOR_CMAES; } + else if (!mystricmp(sTemp,"v")) bVERBOSE=true; - else if (!mystricmp(sTemp,"tl")) bLINE_NUM_EZ_FILE=false; + else if (!mystricmp(sTemp,"tl")){ + printf("yopyop true line\n"); + bLINE_NUM_EZ_FILE=false; + } else if (!mystricmp(sTemp,"path")) { if (argv[++nParamNb][0]=='"') { strcpy(sEZ_PATH,&(argv[nParamNb][1])); diff --git a/dev/tgp_regression/data.csv b/dev/tgp_regression/data.csv deleted file mode 100644 index 19d0d48..0000000 --- a/dev/tgp_regression/data.csv +++ /dev/null @@ -1,78 +0,0 @@ -77 -0.05,0.61,0.3,5,27.2 -0.05,0.61,0.3,15,44.9 -0.05,0.61,0.3,30,59.3 -0.05,0.61,0.3,45,68.7 -0.05,0.61,0.3,75,80.1 -0.05,0.61,0.3,120,87.2 -0.05,0.61,0.3,180,94.2 -0.05,0.86,0.61,5,27.2 -0.05,0.86,0.61,15,41.6 -0.05,0.86,0.61,30,56.4 -0.05,0.86,0.61,45,64.7 -0.05,0.86,0.61,75,74 -0.05,0.86,0.61,120,81.4 -0.05,0.86,0.61,180,86.2 -0.05,0.76,0.76,5,8.7 -0.05,0.76,0.76,15,21.3 -0.05,0.76,0.76,30,33.9 -0.05,0.76,0.76,45,42.9 -0.05,0.76,0.76,75,57.3 -0.05,0.76,0.76,120,65.5 -0.05,0.76,0.76,180,69.2 -0.06,0.86,0.61,5,17.7 -0.06,0.86,0.61,15,30.1 -0.06,0.86,0.61,30,43.9 -0.06,0.86,0.61,45,52 -0.06,0.86,0.61,75,64.7 -0.06,0.86,0.61,120,74.6 -0.06,0.86,0.61,180,82 -0.25,0.86,0.61,5,8.5 -0.25,0.86,0.61,15,20.9 -0.25,0.86,0.61,30,33.6 -0.25,0.86,0.61,45,44.6 -0.25,0.86,0.61,75,56.6 -0.25,0.86,0.61,120,68.2 -0.25,0.86,0.61,180,76 -0.35,0.76,0.76,5,5 -0.35,0.76,0.76,15,14.9 -0.35,0.76,0.76,30,28.6 -0.35,0.76,0.76,45,37.3 -0.35,0.76,0.76,75,51.3 -0.35,0.76,0.76,120,63.6 -0.35,0.76,0.76,180,72.1 -0.5,0.86,0.61,5,5 -0.5,0.86,0.61,15,14.5 -0.5,0.86,0.61,30,27.6 -0.5,0.86,0.61,45,36.4 -0.5,0.86,0.61,75,52.3 -0.5,0.86,0.61,120,64.3 -0.5,0.86,0.61,180,72 -0.5,1.52,0.76,5,10.5 -0.5,1.52,0.76,15,20.4 -0.5,1.52,0.76,30,34 -0.5,1.52,0.76,45,46.4 -0.5,1.52,0.76,75,61.2 -0.5,1.52,0.76,120,76.2 -0.5,1.52,0.76,180,80 -0.5,1.07,0.76,5,10.5 -0.5,1.07,0.76,15,19.7 -0.5,1.07,0.76,30,32.3 -0.5,1.07,0.76,45,42.3 -0.5,1.07,0.76,75,57.1 -0.5,1.07,0.76,120,70.8 -0.5,1.07,0.76,180,76 -0.5,0.94,0.76,5,9.1 -0.5,0.94,0.76,15,18.4 -0.5,0.94,0.76,30,31.7 -0.5,0.94,0.76,45,40.3 -0.5,0.94,0.76,75,54.1 -0.5,0.94,0.76,120,67.8 -0.5,0.94,0.76,180,74 -0.5,0.76,0.76,5,9.5 -0.5,0.76,0.76,15,17.3 -0.5,0.76,0.76,30,28.3 -0.5,0.76,0.76,45,37.2 -0.5,0.76,0.76,75,49 -0.5,0.76,0.76,120,61.7 -0.5,0.76,0.76,180,66 diff --git a/dev/tgp_regression/tgp_regression.ez b/dev/tgp_regression/tgp_regression.ez index 1456480..c36563b 100644 --- a/dev/tgp_regression/tgp_regression.ez +++ b/dev/tgp_regression/tgp_regression.ez @@ -10,6 +10,11 @@ __________________________________________________________*/ #include #include #include + + +#include + + #define OPERAND 0 @@ -191,7 +196,7 @@ void toDotFile(GPNode* root, const char* baseFileName, int treeId){ std::ostringstream oss; oss << baseFileName << "-" << treeId << ".gv"; - FILE* outputFile = fopen(oss.str().c_str(),"w"); + FILE* outputFile = fopen(oss.str().c_str(),"a"); if( !outputFile ){ perror("Opening file for outputing dot representation "); exit(-1); @@ -356,9 +361,15 @@ GPNode* selectNode( GPNode* root, int* childId, int* depth){ fitnessCasesSetLength = load_data(&inputs,&outputs,"quadra_reg_data.csv"); cout << "number of point in fitness cases set : " << fitnessCasesSetLength << endl; + INSTEAD_EVAL_STEP=true; // Adding another stopping, as we are minimizing, the goal is 0 CGoalCriterion* gc = new CGoalCriterion(0,true); EA->stoppingCriteria.push_back(gc); + + + // Here starts the CUDA parts + cudaSetDevice(1); // on GTX295 ;) we want to use the second card for computation + } \end @@ -393,7 +404,11 @@ GPNode* selectNode( GPNode* root, int* childId, int* depth){ \end \Instead evaluation function: - cout << "yopyop" << endl; +{ + for( int i=0 ; i + + void echangeNoeud(Element *child, Element *parent){ + swap(child->Value,parent->Value); + } + + /* + Creation de la carte avec le chemin. + */ + void initCarte(){ + int i,j; + for(i=0;i<32;i++) + for(j=0;j<32;j++) + carte[i][j]=0; + + carte[0][1]=1;carte[0][2]=1;carte[0][3]=1;carte[1][3]=1;carte[2][3]=1; + carte[3][3]=1;carte[4][3]=1;carte[5][3]=1;carte[5][4]=1;carte[5][5]=1; + carte[5][6]=1;carte[5][8]=1;carte[5][9]=1;carte[5][10]=1;carte[5][11]=1; + carte[5][12]=1;carte[6][12]=1;carte[7][12]=1;carte[8][12]=1;carte[9][12]=1; + carte[11][12]=1;carte[12][12]=1;carte[13][12]=1;carte[14][12]=1;carte[17][12]=1; + carte[18][12]=1;carte[19][12]=1;carte[20][12]=1;carte[21][12]=1;carte[22][12]=1; + carte[23][12]=1;carte[24][11]=1;carte[24][10]=1;carte[24][9]=1;carte[24][8]=1; + carte[24][7]=1; carte[24][4]=1;carte[24][3]=1;carte[25][1]=1;carte[26][1]=1; + carte[27][1]=1;carte[28][1]=1;carte[30][2]=1;carte[30][3]=1;carte[30][4]=1; + carte[30][5]=1;carte[29][7]=1;carte[28][7]=1;carte[27][8]=1;carte[27][9]=1;//50 + + carte[27][10]=1;carte[27][11]=1;carte[27][12]=1;carte[27][13]=1;carte[27][14]=1; + carte[26][16]=1;carte[25][16]=1;carte[24][16]=1;carte[21][16]=1;carte[20][16]=1; + carte[19][16]=1;carte[18][16]=1;carte[15][17]=1;carte[14][20]=1;carte[13][20]=1; + carte[10][20]=1;carte[9][20]=1;carte[8][20]=1;carte[7][20]=1;carte[5][21]=1; + carte[5][22]=1;carte[4][24]=1;carte[3][24]=1;carte[2][25]=1;carte[2][26]=1; + carte[2][27]=1;carte[3][29]=1;carte[4][29]=1;carte[6][29]=1;carte[9][29]=1;//80 + + carte[12][29]=1;carte[14][28]=1;carte[14][27]=1;carte[14][26]=1;carte[15][23]=1; + carte[18][24]=1;carte[19][27]=1;carte[22][26]=1;carte[23][23]=1;//89 + } + + /* + Creation de la carte avec le chemin sans trou. + */ + void initCarteFull(){ + int i,j; + for(i=0;i<32;i++) + for(j=0;j<32;j++) + carte[i][j]=0; + + carte[0][1]=1;carte[0][2]=1;carte[0][3]=1;carte[1][3]=1;carte[2][3]=1; + carte[3][3]=1;carte[4][3]=1;carte[5][3]=1;carte[5][4]=1;carte[5][5]=1; + carte[5][6]=1;carte[5][7]=1;carte[5][8]=1;carte[5][9]=1;carte[5][10]=1; + carte[5][11]=1;carte[5][12]=1;carte[6][12]=1;carte[7][12]=1;carte[8][12]=1; + carte[9][12]=1;carte[10][12]=1;carte[11][12]=1;carte[12][12]=1;carte[13][12]=1; + carte[14][12]=1;carte[15][12]=1;carte[16][12]=1;carte[17][12]=1;carte[18][12]=1; + carte[19][12]=1;carte[20][12]=1;carte[21][12]=1;carte[22][12]=1;carte[23][12]=1; + carte[24][12]=1;carte[24][11]=1;carte[24][10]=1;carte[24][9]=1;carte[24][8]=1; + carte[24][7]=1;carte[24][6]=1;carte[24][5]=1;carte[24][4]=1;carte[24][3]=1; + carte[24][2]=1;carte[24][1]=1;carte[25][1]=1;carte[26][1]=1;carte[27][1]=1;//50 + + carte[28][1]=1;carte[29][1]=1;carte[30][1]=1;carte[30][2]=1;carte[30][3]=1; + carte[30][4]=1;carte[30][5]=1;carte[30][6]=1;carte[30][7]=1;carte[29][7]=1; + carte[28][7]=1;carte[27][7]=1;carte[27][8]=1;carte[27][9]=1;carte[27][10]=1; + carte[27][11]=1;carte[27][12]=1;carte[27][13]=1;carte[27][14]=1;carte[27][15]=1; + carte[27][16]=1;carte[26][16]=1;carte[25][16]=1;carte[24][16]=1;carte[23][16]=1; + carte[22][16]=1;carte[21][16]=1;carte[20][16]=1;carte[19][16]=1;carte[18][16]=1; + carte[17][16]=1;carte[16][16]=1;carte[15][16]=1;carte[15][17]=1;carte[15][18]=1; + carte[15][19]=1;carte[15][20]=1;carte[14][20]=1;carte[13][20]=1;carte[12][20]=1; + carte[11][20]=1;carte[10][20]=1;carte[9][20]=1;carte[8][20]=1;carte[7][20]=1; + carte[6][20]=1;carte[5][20]=1;carte[5][21]=1;carte[5][22]=1;carte[5][23]=1;//100 + + carte[5][24]=1;carte[4][24]=1;carte[3][24]=1;carte[2][24]=1;carte[2][25]=1; + carte[2][26]=1;carte[2][27]=1;carte[2][28]=1;carte[2][29]=1;carte[3][29]=1; + carte[4][29]=1;carte[5][29]=1;carte[6][29]=1;carte[7][29]=1;carte[8][29]=1; + carte[9][29]=1;carte[10][29]=1;carte[11][29]=1;carte[12][29]=1;carte[13][29]=1; + carte[14][29]=1;carte[14][28]=1;carte[14][27]=1;carte[14][26]=1;carte[14][25]=1; + carte[14][24]=1;carte[14][23]=1;carte[15][23]=1;carte[16][23]=1;carte[17][23]=1; + carte[18][23]=1;carte[18][24]=1;carte[18][25]=1;carte[18][26]=1;carte[18][27]=1; + carte[19][27]=1;carte[20][27]=1;carte[21][27]=1;carte[22][27]=1;carte[22][26]=1; + carte[22][25]=1;carte[22][24]=1;carte[22][23]=1;carte[23][23]=1;//144 + } + + /* + Fonction qui recopie un sous arbre. Il s'agit d'un vrai clonage et pas d'un + simple echange de références ! + */ + Element *copierSousArbreRec(Element* ssArbreSource, int profondeur, int pMax){ + Element *elt = new Element; + elt->numero = SIZE++; + elt->profondeur = profondeur; + if(ssArbreSource==NULL) + return NULL; + + if(profondeur == pMax){ + elt->filsG = NULL; + elt->filsD = NULL; + elt->filsC = NULL; + double rnd = random(0.,1.); + //Left + if(rnd<1./3.) + elt->Value = LEFT; + + else if(rnd<2./3.) + elt->Value = RIGHT; + + else + elt->Value = MOVE; + + } + else{ + elt->Value=ssArbreSource->Value; + elt->filsG=copierSousArbreRec(ssArbreSource->filsG,profondeur+1,pMax); + elt->filsC=copierSousArbreRec(ssArbreSource->filsC,profondeur+1,pMax); + elt->filsD=copierSousArbreRec(ssArbreSource->filsD,profondeur+1,pMax); + } + return elt; + } + + /* + Fonction de génération d'un noeud. + */ + Element *genererNoeud(int profondeur, int profondeurMaxAutorisee){ + Element *elt = new Element; + elt->numero = SIZE++; + elt->profondeur = profondeur; + //Cas d'un symbole terminal (feuille) + if(profondeur == profondeurMaxAutorisee ){ + elt->filsG = NULL; + elt->filsD = NULL; + elt->filsC = NULL; + double rnd = random(0.,1.); + //Left + if(rnd<1./3.){ + elt->Value = LEFT; + } + + else if(rnd<2./3.){ + elt->Value = RIGHT; + } + + else{ + elt->Value = MOVE; + } + + } + //Cas d'une fonction (noeud non feuille) + else{ + double rnd = random(0.,1.); + if(rnd<1./3.){ + elt->Value = food_ahead; + elt->filsG = genererNoeud(profondeur+1,profondeurMaxAutorisee); + elt->filsC = NULL; + elt->filsD = genererNoeud(profondeur+1,profondeurMaxAutorisee); + } + else if(rnd<2./3.){ + elt->Value = progn2; + elt->filsG = genererNoeud(profondeur+1,profondeurMaxAutorisee); + elt->filsC = NULL; + elt->filsD = genererNoeud(profondeur+1,profondeurMaxAutorisee); + + } + else{ + elt->Value = progn3; + elt->filsG = genererNoeud(profondeur+1,profondeurMaxAutorisee); + elt->filsC = genererNoeud(profondeur+1,profondeurMaxAutorisee); + elt->filsD = genererNoeud(profondeur+1,profondeurMaxAutorisee); + } + + } + return elt; + } + + /* + Cette fonction cherche un noeud dont le numero est passé en paramètre + dans l'arbre passé également en paramètre. + */ + + Element *chercheNoeud(Element *eltDepart, int numero){ + fflush(stdout); + if(eltDepart == NULL){ + return NULL; + } + if(eltDepart->numero == numero){ + return eltDepart; + } + else{ + Element *tmp = NULL; + if(eltDepart->filsG !=NULL) + tmp = chercheNoeud(eltDepart->filsG, numero); + if(tmp != NULL) + return tmp; + if(eltDepart->filsC !=NULL) + tmp = chercheNoeud(eltDepart->filsC, numero); + if(tmp != NULL) + return tmp; + if(eltDepart->filsD !=NULL) + tmp = chercheNoeud(eltDepart->filsD, numero); + if(tmp != NULL) + return tmp; + } + + return NULL; + } + + /* + Cette fonction remplace le noeud numero "numero" dans l'arbre de racine "dst" + par l'element src. + */ + void remplace(Element *dst, Element *src, int numero){ + + if(dst == NULL){ + return; + } + if(dst->numero == numero){ + dst->Value=src->Value; + dst->filsG=src->filsG; + dst->filsC=src->filsC; + dst->filsD=src->filsD; + } + else{ + if(dst->filsG !=NULL) + remplace(dst->filsG, src, numero); + if(dst->filsC !=NULL) + remplace(dst->filsC, src, numero); + if(dst->filsD !=NULL) + remplace(dst->filsD, src, numero); + } + } + + /* + Renumerote les noeuds de l'arbre et regenere sa taille + */ + void regenSizeRec(Element *racine, int p){ + racine->numero=SIZE++; + racine->profondeur=p; + if(racine->filsG!=NULL) + regenSizeRec(racine->filsG, p+1); + if(racine->filsC!=NULL) + regenSizeRec(racine->filsC, p+1); + if(racine->filsD!=NULL) + regenSizeRec(racine->filsD, p+1); + } + + void regenSize(Element *racine){ + SIZE=0; + regenSizeRec(racine, 0); + } + + + int evaluerFoodAhead(int *orientationCourante, int *ligneCourante, int *colCourante){ + switch(*orientationCourante){ + case nord : { + int l = ((*ligneCourante)-1<0)?(*ligneCourante)-1+taille:(*ligneCourante)-1; + if(carte[l][(*colCourante)]!=1) + return 0; + else + return 1; + } + case sud : { + int l = ((*ligneCourante)+1==taille)?0:(*ligneCourante)+1; + if(carte[l][(*colCourante)]!=1) + return 0; + else + return 1; + } + case est : { + int c = ((*colCourante)+1==taille)?0:(*colCourante)+1; + if(carte[(*ligneCourante)][c]!=1) + return 0; + else + return 1; + } + case ouest : { + int c = ((*colCourante)-1<0)?(*colCourante)-1+taille:(*colCourante)-1; + if(carte[(*ligneCourante)][c]!=1) + return 0; + else + return 1; + } + default:return 0; + } + } + + void evaluerMove(int *orientationCourante, int *ligneCourante, int *colCourante, int *fitnessCourant){ + switch(*orientationCourante){ + case nord : { + (*ligneCourante) = ((*ligneCourante)-1<0)?(*ligneCourante)-1+taille:(*ligneCourante)-1; + break; + } + case sud : { + (*ligneCourante) = ((*ligneCourante)+1==taille)?0:(*ligneCourante)+1; + break; + } + case est : { + (*colCourante) = ((*colCourante)+1==taille)?0:(*colCourante)+1; + break; + } + case ouest : { + (*colCourante) = ((*colCourante)-1<0)?(*colCourante)-1+taille:(*colCourante)-1; + break; + } + } + if(carte[(*ligneCourante)][(*colCourante)]==1){ + *fitnessCourant = *fitnessCourant-1; + carte[(*ligneCourante)][(*colCourante)]=-1; + + //Partie utile si l'on veut stopper l'évolution immédiatement apres avoir trouve l'individu + //(pour calculer le nombre d'évaluations precis) + /* if(*fitnessCourant==0){ + FILE *fichier; + fichier = fopen("sortie.txt","a"); + fprintf(fichier,"Individu idéal trouvé après %d évaluations\t %d\n",nbEvalTotal,nbEvalTotal); + fclose(fichier); + exit(0); + } */ + } + + + } + + void evaluerNoeud(Element *elt, int *orientationCourante, int *ligneCourante, int *colCourante, int *fitnessCourant, int *nbPas){ + + + if(*nbPas>=nbPasMax) + return; + + switch(elt->Value){ + case food_ahead : { + if(evaluerFoodAhead(orientationCourante, ligneCourante, colCourante)>0) + evaluerNoeud(elt->filsG,orientationCourante, ligneCourante, colCourante, fitnessCourant, nbPas); + else + evaluerNoeud(elt->filsD,orientationCourante, ligneCourante, colCourante, fitnessCourant, nbPas); + break; + } + case progn2 : { + evaluerNoeud(elt->filsG,orientationCourante, ligneCourante, colCourante, fitnessCourant, nbPas); + evaluerNoeud(elt->filsD,orientationCourante, ligneCourante, colCourante, fitnessCourant, nbPas); + break; + } + case progn3 : { + evaluerNoeud(elt->filsG,orientationCourante, ligneCourante, colCourante, fitnessCourant, nbPas); + evaluerNoeud(elt->filsC,orientationCourante, ligneCourante, colCourante, fitnessCourant, nbPas); + evaluerNoeud(elt->filsD,orientationCourante, ligneCourante, colCourante, fitnessCourant, nbPas); + break; + } + case LEFT : { + switch(*orientationCourante){ + case est:*orientationCourante=nord;(*nbPas)++;break; + case sud:*orientationCourante=est;(*nbPas)++;break; + case ouest:*orientationCourante=sud;(*nbPas)++;break; + case nord:*orientationCourante=ouest;(*nbPas)++;break; + } + break; + } + case RIGHT : { + switch(*orientationCourante){ + case est:*orientationCourante=sud;(*nbPas)++;break; + case sud:*orientationCourante=ouest;(*nbPas)++;break; + case ouest:*orientationCourante=nord;(*nbPas)++;break; + case nord:*orientationCourante=est;(*nbPas)++;break; + } + + break; + } + case MOVE : { + evaluerMove(orientationCourante, ligneCourante, colCourante, fitnessCourant);(*nbPas)++; + break; + } + + } + } + + void imprimerArbre(Element *elt){ + switch(elt->Value){ + case food_ahead : { + printf("IF_FOOD-"); + imprimerArbre(elt->filsG); + imprimerArbre(elt->filsD); + break; + } + case progn2 : { + printf("PROGN2-"); + imprimerArbre(elt->filsG); + imprimerArbre(elt->filsD); + break; + } + case progn3 : {printf("PROGN3-"); + imprimerArbre(elt->filsG); + imprimerArbre(elt->filsC); + imprimerArbre(elt->filsD); + break; + } + case LEFT : {printf("LEFT-"); + break; + } + case RIGHT : {printf("RIGHT-"); + + break; + } + case MOVE : {printf("MOVE-"); + break; + } + } + } + void imprimerArbreDansFichier(Element *elt, FILE *fichier){ + switch(elt->Value){ + case food_ahead : { + fprintf(fichier,"IF_FOOD-"); + imprimerArbreDansFichier(elt->filsG, fichier); + imprimerArbreDansFichier(elt->filsD, fichier); + break; + } + case progn2 : { + fprintf(fichier,"PROGN2-"); + imprimerArbreDansFichier(elt->filsG, fichier); + imprimerArbreDansFichier(elt->filsD, fichier); + break; + } + case progn3 : {fprintf(fichier,"PROGN3-"); + imprimerArbreDansFichier(elt->filsG, fichier); + imprimerArbreDansFichier(elt->filsC, fichier); + imprimerArbreDansFichier(elt->filsD, fichier); + break; + } + case LEFT : {fprintf(fichier,"LEFT-"); + break; + } + case RIGHT : {fprintf(fichier,"RIGHT-"); + + break; + } + case MOVE : {fprintf(fichier,"MOVE-"); + break; + } + } + } + \end + + \Before everything else function: + if ((argc>1)&&(!strcmp(argv[1],"size"))) SIZE=atoi(argv[2]); + \end + + \User classes: + Element { + int Value; + int numero; + int profondeur; + Element *filsG; + Element *filsC; + Element *filsD; + } + + GenomeClass { + Element *arbre; + int Size; + int nbPas; + int ligneCourante; + int colCourante; + int orientationCourante ; + int fitnessCourant; + int seqlen; + } + \end + + \After everything else function: + /** + *Version utilisée pour les lancement en sequence pour les stats. + * Attention : penser à décommenter dans la fonction evaluerMove + + FILE *fichier; + fichier = fopen("sortie.txt","a"); + fprintf(fichier,"Individu idéal non trouvé \n"); + fclose(fichier); + exit(0); + */ + + /**Version de la fonction de finalisation pour visualiser l'arbre vainqueur + *C'est ce qu'il faut utiliser pour generer le fichier pour le viewer java. + * Attention : penser à commenter dans la fonction evaluerMove + */ + imprimerArbre(bBest->arbre); + printf("\nfitness = %d\n",pPopulation[0]->getFitness()); + FILE *fichier; + fichier = fopen("sortieEasea.txt","w"); + imprimerArbreDansFichier(pPopulation[0]->arbre, fichier); + fclose(fichier); + + \end + + \GenomeClass::initialiser: + SIZE = 0; + //Creation de l'arbre. + Element *pElt = genererNoeud(0,profondeurMax); + Genome.arbre= pElt; + Genome.Size=SIZE; + SIZE=0; + \end + + + \GenomeClass::crossover: + + int locusC = random(0,child1.Size-1); + int locusP2 = random(0,parent2.Size-1); + + Element * elt1=chercheNoeud(child1.arbre,locusC); + Element * eltParent2=chercheNoeud(parent2.arbre,locusP2); + + Element *elt11 = copierSousArbreRec(eltParent2, elt1->profondeur,profondeurMax1); + + remplace(child1.arbre,elt11,locusC); + regenSize(child1.arbre); + child1.Size=SIZE; + + \end + + \GenomeClass::mutator: + int nbMut=0; + int i=0; + Element *racine = Genome.arbre; + int nbMutATest = Genome.Size; + + for(i=1;iValue){ + case food_ahead : { + if(rnd<0.5) + elt->Value = progn2; + else{ + int profondeurMaxVoulue = random(elt->profondeur,profondeurMax1); + elt->Value = progn3; + elt->filsC = genererNoeud(elt->profondeur,profondeurMaxVoulue); + } + break; + } + case progn2 : { + if(rnd<0.5) + elt->Value = food_ahead; + else{ + int profondeurMaxVoulue = random(elt->profondeur,profondeurMax1); + elt->Value = progn3; + elt->filsC = genererNoeud(elt->profondeur,profondeurMaxVoulue); + } + break; + } + case progn3 : { + if(rnd<0.5) + elt->Value = food_ahead; + else{ + elt->Value = progn2; + elt->filsC = NULL; + } + break; + } + case LEFT : { + if(rnd<0.5) + elt->Value = MOVE; + else + elt->Value = RIGHT; + break; + } + case RIGHT : { + if(rnd<0.5) + elt->Value = MOVE; + else + elt->Value = LEFT; + + break; + } + case MOVE : { + if(rnd<0.5) + elt->Value = LEFT; + else + elt->Value = RIGHT; + break; + } + } + regenSize(racine); + Genome.Size = SIZE; + nbMut++; + } + } + + return nbMut; + \end + + \GenomeClass::evaluator: + initCarte(); + nbEvalTotal++; + fitnessCourant=89; + nbPas=0; + ligneCourante=0; + colCourante=0; + orientationCourante = est; + Element *elt = Genome.arbre; + while(nbPas0) + evaluerNoeud(elt,&orientationCourante, &ligneCourante, &colCourante, &fitnessCourant, &nbPas); + + return fitnessCourant; + \end + + \GenomeClass::display: + + \end + \Default run parameters: + + // Variation operators: + Mutation probability: 1.0 + Crossover probability: 1.0 + + // Evolution Engine: + Evaluator goal: minimize + Number of generations: 100 + Population size: 100 + Elite: 4 + Selection operator: Tournament 7 + Offspring size: 50% + Reduce parents operator: Tournament 4 + Surviving parents: 50 + Reduce offspring operator: Tournament 2 + Surviving offspring: 96 + Final reduce operator: Tournament 2 + Elitism: Weak + + \end + diff --git a/examples/cmaes_cuda_test/cigtabGPU.ez b/examples/cmaes_cuda_test/cigtabGPU.ez new file mode 100755 index 0000000..847cdf3 --- /dev/null +++ b/examples/cmaes_cuda_test/cigtabGPU.ez @@ -0,0 +1,120 @@ +*_________________________________________________________ + +Test functions +log normal adaptive mutation +Selection operator: Tournament +__________________________________________________________*/ + +\User declarations : +#define SIZE 22 +#define X_MIN -1. +#define X_MAX 1. +#define ITER 50 +#define SIGMA 1. /* mutation parameter */ +#define PI 3.141592654 + + +float pMutPerGene=0.1; + +struct gpuOptions initOptions; + +\end + +\User functions: +//fitness function +#include + +__device__ __host__ float SQR(float d) +{ + return (d*d); +} + +__device__ __host__ inline float rosenbrock( float const *x, int size) +{ + float qualitaet; + int i; + int DIM = size; + qualitaet = 0.0; + + for( i = DIM-2; i >= 0; --i) + qualitaet += 100.*SQR(SQR(x[i])-x[i+1]) + SQR(1.-x[i]); + return ( qualitaet); +} /* f_rosenbrock() */ + + +__device__ __host__ inline float cigtab(float *x, int size) +{ + int i; + float sum = 0.; + + sum = x[0]*x[0] + 1e8*x[size-1]*x[size-1]; + for (i = 1; i < size-1; ++i) + sum += 1e4*x[i]*x[i]; + return sum; +} +\end + +\GenomeClass::display: + for(int i=0; i(y)?(x):(y)) +#define MIN(x,y) ((x)<(y)?(x):(y)) +#define SIGMA 1. /* mutation parameter */ +#define PI 3.141592654 + + +float pMutPerGene=0.1; + + + +\end + +\User functions: +//fitness function +#include + +static double SQR(double d) +{ + return (d*d); +} + +double rosenbrock( double const *x) +/* + Rosenbrock's Function, generalized. +*/ +{ + double qualitaet; + int i; + int DIM = SIZE; + qualitaet = 0.0; + + for( i = DIM-2; i >= 0; --i) + qualitaet += 100.*SQR(SQR(x[i])-x[i+1]) + SQR(1.-x[i]); + return ( qualitaet); +} /* f_rosenbrock() */ + +double cigtab(double *x) +{ + int i; + double sum = 0.; + + sum = x[0]*x[0] + 1e8*x[SIZE-1]*x[SIZE-1]; + for (i = 1; i < SIZE-1; ++i) + sum += 1e4*x[i]*x[i]; + return sum; +} +\end + +\GenomeClass::display: + for(int i=0; i(y)?(x):(y)) +#define MIN(x,y) ((x)<(y)?(x):(y)) +#define SIGMA 1. /* mutation parameter */ +#define PI 3.141592654 + + +float pMutPerGene=0.1; + +struct gpuOptions; + +\end + +\User functions: +//fitness function +#include + +__device__ __host__ inline float Weierstrass(float *x, int n) // Weierstrass multimidmensionnel h = 0.25 +{ + float res = 0.; + float val[SIZE]; + float b=2.; + float h = 0.25; + + for (int i = 0;i 1.0); + factor = sqrt (-2.0 * log (r) / r); + gset = v1 * factor; + iset = 1; + return (v2 * factor); + } +} +\end + +\GenomeClass::display: + for(int i=0; ii$?XRid=#kwZV*g;m z#(%GMx$K{bEeI{GjkbTi%B1as=PLUT8z1)l-tf%+bK}}qon>bB-+~pNF<-5)|EaK; zciX}j_P^g-E85v1>FJOPNm0G$&7#Cw2FQUKx>AbtUKnh(q!4hhRV8-NNN z5==Yo|NsB*kf6hy0F=O_rRxp=4TRJ28k-=r^bDZ3KMrx9wee^+^91@L!6hP)B%1wjNvPls8zC2_=HdplNQU{Q@u$>3k zU4r@g3&8XlFL{u8LYthx;sVp1_JjC>(LccQ!llAsdxSRrdI09#15XHkB+9?V^!NM-^#9O$=iKTX9KBN^03?0v=7kv`oMZ{{UvGUDQ|#000FD3pfA( literal 0 HcmV?d00001 diff --git a/examples/weierstrass_std/weierstrass.ez b/examples/weierstrass_std/weierstrass.ez new file mode 100755 index 0000000..4af1696 --- /dev/null +++ b/examples/weierstrass_std/weierstrass.ez @@ -0,0 +1,176 @@ +/*_________________________________________________________ + +Test functions +log normal adaptive mutation +Selection operator: Tournament +__________________________________________________________*/ + +\User declarations : +#define SIZE 100 +#define X_MIN -1. +#define X_MAX 1. +#define ITER 120 +#define Abs(x) ((x) < 0 ? -(x) : (x)) +#define MAX(x,y) ((x)>(y)?(x):(y)) +#define MIN(x,y) ((x)<(y)?(x):(y)) +#define SIGMA 1. /* mutation parameter */ +#define PI 3.141592654 + + +float pMutPerGene=0.1; + + +\end + +\User functions: +//fitness function +#include + +__device__ __host__ inline float Weierstrass(float x[SIZE], int n) // Weierstrass multimidmensionnel h = 0.25 +{ + float res = 0.; + float val[SIZE]; + float b=2.; + float h = 0.25; + + for (int i = 0;i 1.0); + factor = sqrt (-2.0 * log (r) / r); + gset = v1 * factor; + iset = 1; + return (v2 * factor); + } +} +\end + + + +\Before everything else function: + //cout<<"Before everything else function called "< +#include +#include +#include "COptionParser.h" +#include "CRandomGenerator.h" +#include "CEvolutionaryAlgorithm.h" +#include "global.h" +#include "EASEAIndividual.hpp" + +using namespace std; + +/** Global variables for the whole algorithm */ +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; +CEvolutionaryAlgorithm* EA; + +int main(int argc, char** argv){ + + + parseArguments("EASEA.prm",argc,argv); + + ParametersImpl p; + p.setDefaultParameters(argc,argv); + CEvolutionaryAlgorithm* ea = p.newEvolutionaryAlgorithm(); + + EA = ea; + + EASEAInit(argc,argv); + + CPopulation* pop = ea->getPopulation(); + + ea->runEvolutionaryLoop(); + + EASEAFinal(pop); + + delete pop; + + +#ifdef WIN32 + system("pause"); +#endif + return 0; +} + +\START_CUDA_GENOME_CU_TPL +#ifdef WIN32 +#define _CRT_SECURE_NO_WARNINGS +#pragma comment(lib, "libEasea.lib") +#endif + +#include +#include +#ifndef WIN32 +#include +#else +#include +#endif +#include "CRandomGenerator.h" +#include "CPopulation.h" +#include "COptionParser.h" +#include "CStoppingCriterion.h" +#include "CEvolutionaryAlgorithm.h" +#include "global.h" +#include "CIndividual.h" + +using namespace std; + +#include "EASEAIndividual.hpp" +bool INSTEAD_EVAL_STEP = false; + +CRandomGenerator* globalRandomGenerator; +extern CEvolutionaryAlgorithm* EA; +#define STD_TPL + +\INSERT_USER_DECLARATIONS +\ANALYSE_USER_CLASSES + +\INSERT_USER_CLASSES + +\INSERT_USER_FUNCTIONS + +\INSERT_INITIALISATION_FUNCTION +\INSERT_FINALIZATION_FUNCTION + +\INSERT_BOUND_CHECKING + +void evale_pop_chunk(CIndividual** population, int popSize){ + printf("evalPopChunk\n"); + \INSTEAD_EVAL_FUNCTION +} + +void EASEAInit(int argc, char** argv){ + \INSERT_INIT_FCT_CALL +} + +void EASEAFinal(CPopulation* pop){ + \INSERT_FINALIZATION_FCT_CALL; +} + +void AESAEBeginningGenerationFunction(CEvolutionaryAlgorithm* evolutionaryAlgorithm){ + \INSERT_BEGIN_GENERATION_FUNCTION +} + +void AESAEEndGenerationFunction(CEvolutionaryAlgorithm* evolutionaryAlgorithm){ + \INSERT_END_GENERATION_FUNCTION +} + +void AESAEGenerationFunctionBeforeReplacement(CEvolutionaryAlgorithm* evolutionaryAlgorithm){ + \INSERT_GENERATION_FUNCTION_BEFORE_REPLACEMENT +} + + +IndividualImpl::IndividualImpl() : CIndividual() { + \GENOME_CTOR + \INSERT_EO_INITIALISER + valid = false; +} + +CIndividual* IndividualImpl::clone(){ + return new IndividualImpl(*this); +} + +IndividualImpl::~IndividualImpl(){ + \GENOME_DTOR +} + + +float IndividualImpl::evaluate(){ + if(valid) + return fitness; + else{ + valid = true; + \INSERT_EVALUATOR + } +} + +IndividualImpl::IndividualImpl(const IndividualImpl& genome){ + + // ******************** + // Problem specific part + \COPY_CTOR + + + // ******************** + // Generic part + this->valid = genome.valid; + this->fitness = genome.fitness; +} + + +CIndividual* IndividualImpl::crossover(CIndividual** ps){ + // ******************** + // Generic part + IndividualImpl** tmp = (IndividualImpl**)ps; + IndividualImpl parent1(*this); + IndividualImpl parent2(*tmp[0]); + IndividualImpl child(*this); + + //DEBUG_PRT("Xover"); + /* cout << "p1 : " << parent1 << endl; */ + /* cout << "p2 : " << parent2 << endl; */ + + // ******************** + // Problem specific part + \INSERT_CROSSOVER + + + child.valid = false; + /* cout << "child : " << child << endl; */ + return new IndividualImpl(child); +} + + +void IndividualImpl::printOn(std::ostream& os) const{ + \INSERT_DISPLAY +} + +std::ostream& operator << (std::ostream& O, const IndividualImpl& B) +{ + // ******************** + // Problem specific part + O << "\nIndividualImpl : "<< std::endl; + O << "\t\t\t"; + B.printOn(O); + + if( B.valid ) O << "\t\t\tfitness : " << B.fitness; + else O << "fitness is not yet computed" << std::endl; + return O; +} + + +size_t IndividualImpl::mutate( float pMutationPerGene ){ + this->valid=false; + + + // ******************** + // Problem specific part + \INSERT_MUTATOR +} + + + + +void ParametersImpl::setDefaultParameters(int argc, char** argv){ + + this->minimizing = \MINIMAXI; + this->nbGen = setVariable("nbGen",(int)\NB_GEN); + + selectionOperator = getSelectionOperator(setVariable("selectionOperator","\SELECTOR_OPERATOR"), this->minimizing, globalRandomGenerator); + replacementOperator = getSelectionOperator(setVariable("reduceFinalOperator","\RED_FINAL_OPERATOR"),this->minimizing, globalRandomGenerator); + parentReductionOperator = getSelectionOperator(setVariable("reduceParentsOperator","\RED_PAR_OPERATOR"),this->minimizing, globalRandomGenerator); + offspringReductionOperator = getSelectionOperator(setVariable("reduceOffspringOperator","\RED_OFF_OPERATOR"),this->minimizing, globalRandomGenerator); + selectionPressure = setVariable("selectionPressure",(float)\SELECT_PRM); + replacementPressure = setVariable("reduceFinalPressure",(float)\RED_FINAL_PRM); + parentReductionPressure = setVariable("reduceParentsPressure",(float)\RED_PAR_PRM); + offspringReductionPressure = setVariable("reduceOffspringPressure",(float)\RED_OFF_PRM); + pCrossover = \XOVER_PROB; + pMutation = \MUT_PROB; + pMutationPerGene = 0.05; + + parentPopulationSize = setVariable("popSize",(int)\POP_SIZE); + offspringPopulationSize = setVariable("nbOffspring",(int)\OFF_SIZE); + + + parentReductionSize = setReductionSizes(parentPopulationSize, setVariable("survivingParents",(float)\SURV_PAR_SIZE)); + offspringReductionSize = setReductionSizes(offspringPopulationSize, setVariable("survivingOffspring",(float)\SURV_OFF_SIZE)); + + this->elitSize = setVariable("elite",(int)\ELITE_SIZE); + this->strongElitism = setVariable("eliteType",(int)\ELITISM); + + if((this->parentReductionSize + this->offspringReductionSize) < this->parentPopulationSize){ + printf("*WARNING* parentReductionSize + offspringReductionSize < parentPopulationSize\n"); + printf("*WARNING* change Sizes in .prm or .ez\n"); + printf("EXITING\n"); + exit(1); + } + if((this->parentPopulationSize-this->parentReductionSize)>this->parentPopulationSize-this->elitSize){ + printf("*WARNING* parentPopulationSize - parentReductionSize > parentPopulationSize - elitSize\n"); + printf("*WARNING* change Sizes in .prm or .ez\n"); + printf("EXITING\n"); + exit(1); + } + if(!this->strongElitism && ((this->offspringPopulationSize - this->offspringReductionSize)>this->offspringPopulationSize-this->elitSize)){ + printf("*WARNING* offspringPopulationSize - offspringReductionSize > offspringPopulationSize - elitSize\n"); + printf("*WARNING* change Sizes in .prm or .ez\n"); + printf("EXITING\n"); + exit(1); + } + + + /* + * The reduction is set to true if reductionSize (parent or offspring) is set to a size less than the + * populationSize. The reduction size is set to populationSize by default + */ + if(offspringReductionSizerandomGenerator = globalRandomGenerator; + + this->printStats = setVariable("printStats",\PRINT_STATS); + this->generateCVSFile = setVariable("generateCVSFile",\GENERATE_CVS_FILE); + this->generateGnuplotScript = setVariable("generateGnuplotScript",\GENERATE_GNUPLOT_SCRIPT); + this->generateRScript = setVariable("generateRScript",\GENERATE_R_SCRIPT); + this->plotStats = setVariable("plotStats",\PLOT_STATS); + this->printInitialPopulation = setVariable("printInitialPopulation",0); + this->printFinalPopulation = setVariable("printFinalPopulation",0); + + this->outputFilename = (char*)"EASEA"; + this->plotOutputFilename = (char*)"EASEA.png"; +} + +CEvolutionaryAlgorithm* ParametersImpl::newEvolutionaryAlgorithm(){ + + pEZ_MUT_PROB = &pMutationPerGene; + pEZ_XOVER_PROB = &pCrossover; + EZ_NB_GEN = (size_t*)setVariable("nbGen",\NB_GEN); + EZ_current_generation=0; + + CEvolutionaryAlgorithm* ea = new EvolutionaryAlgorithmImpl(this); + generationalCriterion->setCounterEa(ea->getCurrentGenerationPtr()); + ea->addStoppingCriterion(generationalCriterion); + ea->addStoppingCriterion(controlCStopingCriterion); + ea->addStoppingCriterion(timeCriterion); + + EZ_NB_GEN=((CGenerationalCriterion*)ea->stoppingCriteria[0])->getGenerationalLimit(); + EZ_current_generation=&(ea->currentGeneration); + + return ea; +} + +void EvolutionaryAlgorithmImpl::initializeParentPopulation(){ + for( unsigned int i=0 ; i< this->params->parentPopulationSize ; i++){ + this->population->addIndividualParentPopulation(new IndividualImpl()); + } +} + + +EvolutionaryAlgorithmImpl::EvolutionaryAlgorithmImpl(Parameters* params) : CEvolutionaryAlgorithm(params){ + ; +} + +EvolutionaryAlgorithmImpl::~EvolutionaryAlgorithmImpl(){ + +} + +\START_CUDA_GENOME_H_TPL + +#ifndef PROBLEM_DEP_H +#define PROBLEM_DEP_H + +//#include "CRandomGenerator.h" +#include +#include +#include +#include +class CRandomGenerator; +class CSelectionOperator; +class CGenerationalCriterion; +class CEvolutionaryAlgorithm; +class CPopulation; +class Parameters; + +\INSERT_USER_CLASSES_DEFINITIONS + +class IndividualImpl : public CIndividual { + +public: // in EASEA the genome is public (for user functions,...) + // Class members + \INSERT_GENOME + + +public: + IndividualImpl(); + IndividualImpl(const IndividualImpl& indiv); + virtual ~IndividualImpl(); + float evaluate(); + static size_t 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); + + friend std::ostream& operator << (std::ostream& O, const IndividualImpl& B) ; + void initRandomGenerator(CRandomGenerator* rg){ IndividualImpl::rg = rg;} + +}; + + +class ParametersImpl : public Parameters { +public: + void setDefaultParameters(int argc, char** argv); + CEvolutionaryAlgorithm* newEvolutionaryAlgorithm(); +}; + +/** + * @TODO ces functions devraient s'appeler weierstrassInit, weierstrassFinal etc... (en gros EASEAFinal dans le tpl). + * + */ + +void EASEAInit(int argc, char** argv); +void EASEAFinal(CPopulation* pop); +void EASEABeginningGenerationFunction(CEvolutionaryAlgorithm* evolutionaryAlgorithm); +void EASEAEndGenerationFunction(CEvolutionaryAlgorithm* evolutionaryAlgorithm); +void EASEAGenerationFunctionBeforeReplacement(CEvolutionaryAlgorithm* evolutionaryAlgorithm); + + +class EvolutionaryAlgorithmImpl: public CEvolutionaryAlgorithm { +public: + EvolutionaryAlgorithmImpl(Parameters* params); + virtual ~EvolutionaryAlgorithmImpl(); + void initializeParentPopulation(); +}; + +#endif /* PROBLEM_DEP_H */ + +\START_CUDA_MAKEFILE_TPL + +EASEALIB_PATH=\EZ_PATHlibeasea/#/home/kruger/Bureau/Easea/libeasea/ + +CXXFLAGS = -O2 -g -Wall -fmessage-length=0 -I$(EASEALIB_PATH)include + +OBJS = EASEA.o EASEAIndividual.o + +LIBS = -lboost_program_options + +TARGET = EASEA + +$(TARGET): $(OBJS) + $(CXX) -o $(TARGET) $(OBJS) $(LIBS) -g $(EASEALIB_PATH)libeasea.a + + +#%.o:%.cpp +# $(CXX) -c $(CXXFLAGS) $^ + +all: $(TARGET) +clean: + rm -f $(OBJS) $(TARGET) +easeaclean: + rm -f $(TARGET) *.o *.cpp *.hpp EASEA.png EASEA.dat EASEA.prm EASEA.mak Makefile EASEA.vcproj EASEA.csv EASEA.r EASEA.plot + +\START_VISUAL_TPL + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +\START_EO_PARAM_TPL#**************************************** +# +# EASEA.prm +# +# Parameter file generated by STD.tpl AESAE v1.0 +# +#*************************************** +# --seed=0 # -S : Random number seed. It is possible to give a specific seed. + +###### Evolution Engine ###### +--popSize=\POP_SIZE # -P : Population Size +--nbOffspring=\OFF_SIZE # -O : Nb of offspring (percentage or absolute) + +###### Stopping Criterions ##### +--nbGen=\NB_GEN #Nb of generations +--timeLimit=\TIME_LIMIT # Time Limit: desactivate with (0) (in Seconds) + +###### Evolution Engine / Replacement ###### +--elite=\ELITE_SIZE # Nb of elite parents (absolute) +--eliteType=\ELITISM # Strong (1) or weak (0) elitism (set elite to 0 for none) +--survivingParents=\SURV_PAR_SIZE # Nb of surviving parents (percentage or absolute) +--survivingOffspring=\SURV_OFF_SIZE # Nb of surviving offspring (percentage or absolute) +--selectionOperator=\SELECTOR_OPERATOR # Selector: Deterministic, Tournament, Random, Roulette +--selectionPressure=\SELECT_PRM +--reduceParentsOperator=\RED_PAR_OPERATOR +--reduceParentsPressure=\RED_PAR_PRM +--reduceOffspringOperator=\RED_OFF_OPERATOR +--reduceOffspringPressure=\RED_OFF_PRM +--reduceFinalOperator=\RED_FINAL_OPERATOR +--reduceFinalPressure=\RED_FINAL_PRM + +##### Stats Ouput ##### +--printStats=\PRINT_STATS #print Stats to screen +--plotStats=\PLOT_STATS #plot Stats with gnuplot (requires Gnuplot) +--printInitialPopulation=0 #Print initial population +--printFinalPopulation=0 #Print final population +--generateCVSFile=\GENERATE_CVS_FILE +--generateGnuplotScript=\GENERATE_GNUPLOT_SCRIPT +--generateRScript=\GENERATE_R_SCRIPT +\TEMPLATE_END -- GitLab