Commit ff5dc5d5 authored by maitre's avatar maitre

Commit from Fred, Og

parent 8630340f
......@@ -18,9 +18,6 @@ Centre de Math
#define true 1
#define false 0
#define GALIB 1
#define EO 2
#define DREAM 3
#define CUDA 4
#define STD 5
......@@ -43,15 +40,14 @@ extern int nClasses_nb;
extern FILE *fpOutputFile, *fpTemplateFile, *fpGenomeFile, *fpExplodedGenomeFile;
extern char sRAW_PROJECT_NAME[], sPROJECT_NAME[], sEO_DIR[], sEZ_PATH[1000], sTPL_DIR[1000], sEZ_FILE_NAME[];
extern char sLOWER_CASE_PROJECT_NAME[];
extern char sREPLACEMENT[], sSELECTOR[], sSELECT_PRM[], sRED_PAR[], sRED_PAR_PRM[], sRED_FINAL[], sRED_FINAL_PRM[], sRED_OFF[], sRED_OFF_PRM[], sDISCARD[], sDISCARD_PRM[];
extern float fSELECT_PRM, fRED_PAR_PRM, fRED_FINAL_PRM, fRED_OFF_PRM;
extern char sSELECTOR[], sSELECTOR_OPERATOR[], sRED_PAR[], sRED_PAR_OPERATOR[], sRED_FINAL[], sRED_FINAL_OPERATOR[], sRED_OFF[], sRED_OFF_OPERATOR[];
extern int nMINIMISE,nELITE;
extern bool bELITISM, bVERBOSE;
extern bool bPROP_SEQ;
extern bool bPRINT_STATS, bPLOT_STATS, bGENERATE_CVS_FILE, bGENERATE_GNUPLOT_SCRIPT, bGENERATE_R_SCRIPT;
extern char* nGENOME_NAME;
extern int nPOP_SIZE, nNB_GEN, nNB_ISLANDS, nOFF_SIZE, nSURV_PAR_SIZE, nSURV_OFF_SIZE, nPROBLEM_DIM;
extern float fMUT_PROB, fXOVER_PROB, fREPL_PERC, fMIG_FREQ;
extern int nMIG_CLONE, nNB_MIG, nIMMIG_REPL;
extern char sMIG_SEL[], sMIGRATOR[], sIMMIG_SEL[],sMIG_TARGET_SELECTOR[];
extern int nPOP_SIZE, nNB_GEN, nOFF_SIZE, nPROBLEM_DIM, nTIME_LIMIT;
extern float fMUT_PROB, fXOVER_PROB, fSURV_PAR_SIZE, fSURV_OFF_SIZE;
extern int nWARNINGS, nERRORS;
extern int TARGET, OPERATING_SYSTEM;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -6,32 +6,31 @@
#include "debug.h"
void pickupSTDSelector(char* sSELECTOR, char* sSELECT_PRM, char* sEZ_FILE_NAME, CEASEALexer* EASEALexer){
void pickupSTDSelector(char* sSELECTOR, float* fSELECT_PRM, char* sEZ_FILE_NAME, CEASEALexer* EASEALexer){
//DEBUG_PRT("Picking up selector without argument %s",sSELECTOR);
if (!mystricmp(sSELECTOR,"RouletteWheel")){
if (!mystricmp(sSELECTOR,"Roulette")){
if (nMINIMISE==1) {
fprintf(stderr,"\n%s - Error line %d: The RouletteWheel selection scheme cannot be\n selected when \"minimising the fitness\" is the evaluator goal.\n",
fprintf(stderr,"\n%s - Error line %d: The Roulette selection scheme cannot be\n selected when \"minimising the fitness\" is the evaluator goal.\n",
sEZ_FILE_NAME,EASEALexer->yylineno);
exit(1);
}
else sprintf(sSELECTOR,"Roulette");
}
else if (!mystricmp(sSELECTOR,"Tournament")){
sprintf(sSELECTOR,"DetTour");
sprintf(sSELECTOR,"Tournament");
// as there is no selection pressure, we put 2
sprintf(sSELECT_PRM,"(2)");
*fSELECT_PRM=(float)2.0;
}
else if (!mystricmp(sSELECTOR,"StochTrn")) sprintf(sSELECTOR,"StochTour");
else if (!mystricmp(sSELECTOR,"Random")){
sprintf(sSELECTOR,"Random");
if( TARGET==CUDA || TARGET==STD )
sprintf(sSELECT_PRM,"(0)");
*fSELECT_PRM = 0.0;
}
else if (!mystricmp(sSELECTOR,"Ranking")) sprintf(sSELECTOR,"Ranking");
else if (!mystricmp(sSELECTOR,"Sequential")){
sprintf(sSELECTOR,"Sequential");
if( TARGET==CUDA || TARGET==STD) sprintf(sSELECT_PRM,"(0)");
else if (!mystricmp(sSELECTOR,"Deterministic")){
sprintf(sSELECTOR,"Deterministic");
if( TARGET==CUDA || TARGET==STD) *fSELECT_PRM = 0.0;
}
else {
fprintf(stderr,"\n%s - Error line %d: The %s selection scheme does not exist in CUDA/STD.\n",sEZ_FILE_NAME,EASEALexer->yylineno, sSELECTOR);
......@@ -40,14 +39,14 @@ void pickupSTDSelector(char* sSELECTOR, char* sSELECT_PRM, char* sEZ_FILE_NAME,
}
void pickupSTDSelectorArgument(char* sSELECTOR, char* sSELECTOR_PRM, char* sEZ_FILE_NAME, float thirdParam, CEASEALexer* EASEALexer){
void pickupSTDSelectorArgument(char* sSELECTOR, float* fSELECT_PRM, char* sEZ_FILE_NAME, float thirdParam, CEASEALexer* EASEALexer){
//DEBUG_PRT("Picking up selector with argument %s %d",sSELECTOR,(int) thirdParam);
if (!mystricmp(sSELECTOR,"Tournament")||!mystricmp(sSELECTOR,"StochTrn")) {
if (thirdParam>=2) {sprintf(sSELECTOR,"DetTour");
sprintf(sSELECTOR_PRM,"(%d)",(int) thirdParam);}
if (thirdParam>=2) {sprintf(sSELECTOR,"Tournament");
*fSELECT_PRM = (float) thirdParam;}
else if ((thirdParam>.5)&&(thirdParam<=1.0)) {
sprintf(sSELECTOR,"StochTour");
sprintf(sSELECTOR_PRM,"(%f)",(float) thirdParam);
*fSELECT_PRM = (float) thirdParam;
}
else {
fprintf(stderr,"\n%s - Error line %d: The parameter of the Tournament selector must be either >=2 or within ]0.5, 1].\n",
......@@ -55,14 +54,13 @@ void pickupSTDSelectorArgument(char* sSELECTOR, char* sSELECTOR_PRM, char* sEZ_F
exit(1);
}
}
else if (!mystricmp(sSELECTOR,"RouletteWheel")) {
else if (!mystricmp(sSELECTOR,"Roulette")) {
sprintf(sSELECTOR,"Roulette");
if (thirdParam<1) {fprintf(stderr,"\n%s - Warning line %d: The parameter of RouletteWheel must be greater than one.\nThe parameter will therefore be ignored.",
if (thirdParam<1) {fprintf(stderr,"\n%s - Warning line %d: The parameter of Roulette must be greater than one.\nThe parameter will therefore be ignored.",
sEZ_FILE_NAME,EASEALexer->yylineno);
nWARNINGS++;
}
else sprintf(sSELECTOR_PRM,"(%f)",(float) thirdParam);
}
else *fSELECT_PRM = (float) thirdParam; }
else if (!mystricmp(sSELECTOR,"Random")) {
sprintf(sSELECTOR,"Random");
fprintf(stderr,"\n%s - Warning line %d: The Uniform selector does not (yet) take any parameter in CUDA/STD.\nThe parameter will therefore be ignored.",
......@@ -74,25 +72,16 @@ void pickupSTDSelectorArgument(char* sSELECTOR, char* sSELECTOR_PRM, char* sEZ_F
if ((thirdParam<=1)||(thirdParam>2)) {
fprintf(stderr,"\n%s - Warning line %d: The parameter of Ranking must be in (1,2].\nThe parameter will default to 2.",sEZ_FILE_NAME,EASEALexer->yylineno);
nWARNINGS++;
sprintf(sSELECTOR_PRM,"(2)");
*fSELECT_PRM = 2.0;
}
else sprintf(sSELECTOR_PRM,"(%f)",(float) thirdParam);
else *fSELECT_PRM = (float) thirdParam;
}
else if (!mystricmp(sSELECTOR,"Sequential")) {
sprintf(sSELECTOR,"Sequential");
else if (!mystricmp(sSELECTOR,"Deterministic")) {
sprintf(sSELECTOR,"Deterministic");
if (thirdParam==0)
if( TARGET==CUDA || TARGET==STD )
sprintf(sSELECT_PRM,"(0)");
else
sprintf(sSELECT_PRM,"(unordered)");
else if (thirdParam==1) sprintf(sSELECTOR_PRM,"(ordered)");
else {
fprintf(stderr,"\n%s - Warning line %d: The parameter of Sequential must be either 0 (unordered) or 1 (ordered).\nThe parameter will default to 1.",
sEZ_FILE_NAME,EASEALexer->yylineno);
nWARNINGS++;
sprintf(sSELECTOR_PRM,"(ordered)");
}
*fSELECT_PRM = 0.0;
}
else {
fprintf(stderr,"\n%s - Error line %d: The %s selection scheme does not exist in CUDA/STD.\n",sEZ_FILE_NAME,EASEALexer->yylineno, sSELECTOR);
......
#include "EaseaLex.h"
void pickupSTDSelector(char* sSELECTOR, char* sSELECT_PRM, char* sEZ_FILE_NAME, CEASEALexer* EASEALexer);
void pickupSTDSelectorArgument(char* sSELECTOR, char* sSELECTOR_PRM, char* sEZ_FILE_NAME, float thirdParam, CEASEALexer* EASEALexer);
void pickupSTDSelector(char* sSELECTOR, float* fSELECT_PRM, char* sEZ_FILE_NAME, CEASEALexer* EASEALexer);
void pickupSTDSelectorArgument(char* sSELECTOR, float* fSELECT_PRM, char* sEZ_FILE_NAME, float thirdParam, CEASEALexer* EASEALexer);
/*_________________________________________________________
This file was automatically created by GUIDE v0.1c
User: collet
Date: Tue May 06 10:02:37 CEST 2003
File name: D:\travail\easea\listsort.ez
Target library: EO
Operating System: Windows XP
_________________________________________________________*/
\User declarations:
int SIZE=10;
double pMutPerGene=0.4;
inline void swap(int& a,int& b) {int c=a; a=b; b=c;}
\end
\User functions:
void cross(GenomeClass *pChild, GenomeClass *pParent, int locus){
Element *p, *pChildList, *pParentList;
pChildList=pChild->pList; pParentList=pParent->pList;
for (int i=0;i<SIZE;i++){
if (i>=locus){
for(p=pChild->pList;pParentList->Value!=p->Value;p=p->pNext);
swap(p->Value, pChildList->Value);
}
pChildList=pChildList->pNext;
pParentList=pParentList->pNext;
}
}
\end
\Initialisation function:
if ((argc>1)&&(!strcmp(argv[1],"size"))) SIZE=atoi(argv[2]);
\end
\User classes:
Element { int Value;
Element *pNext; }
GenomeClass { Element *pList;
int Size; }
\end
\Finalization function:
std::cout << population ;
\end
\GenomeClass::initialiser:
Element *pElt;
Genome.Size=0;
Genome.pList=NULL;
for (int i=0;i<SIZE;i++){ // creation of a linked list of SIZE elements
pElt=new Element; // with the decreasing values:
pElt->Value=i+1; // (SIZE, SIZE-1, ... , 3, 2, 1)
pElt->pNext=Genome.pList;
Genome.pList=pElt;
Genome.Size++;
}
\end
\GenomeClass::crossover:
int locus=random(0,SIZE-1);
cross(&child1, &parent2, locus);
\end
\GenomeClass::mutator:
int NbMut=0;
Element *p=Genome.pList;
while (p->pNext){
if (tossCoin(pMutPerGene)){ //We swap the current value with the next
swap(p->Value,p->pNext->Value);
NbMut++;
}
p=p->pNext;
}
return NbMut;
\end
\GenomeClass::evaluator:
int i=0,eval=0;
Element *p=Genome.pList;
while(p->pNext){
if (p->Value==++i) eval+=10;
if (p->Value<p->pNext->Value) eval+=4;
else eval-=2;
p=p->pNext;
}
if (p->Value==SIZE) eval+=10;
return (eval<0 ? 0 : eval);
\end
\GenomeClass::display:
os << "Size:" << Genome.Size << "\n";
os << "pList:" << *(Genome.pList) << "\n";
os << "This was MY display function !\n";
\end
\At each new generation:
if (NB_GEN-currentGeneration==10) pMutPerGene=0.1;
\end
\Default run parameters:
// Variation operators:
Operators are called: Sequentially
Mutation probability: 1.0
Crossover probability: 0.9
// Evolution Engine:
Evaluator goal: maximize
Number of generations: 34
Evolutionary engine: Custom
Population size: 5
Elite: 5
Fertility: 75
Genitors selector: Tournament 2
Selected genitors: 50
Offspring size: 100%
Reduce parents: Ranking
Surviving parents: 50
Reduce offspring: RouletteWheel
Surviving offspring: 96
Final reduce: Tournament 2
Elitism: Weak
\end
/*_________________________________________________________
Test functions
log normal adaptive mutation
Selection operator: Tournament
__________________________________________________________*/
\User declarations :
#define SIZE 10
#define X_MIN -1.
#define X_MAX 1.
#define ITER 50
#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;
#define N_LIM 10
int n = N_LIM;
EvalCounter* d_counter;
struct gpuOptions{
EvalCounter* counter;
};
\end
\User functions:
//fitness function
#include <math.h>
__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<n; i++) {
val[i] = 0.;
for (int k=0;k<ITER;k++)
val[i] += pow(b,-(float)k*h) * sin(pow(b,(float)k)*x[i]);
res += Abs(val[i]);
}
return (res);
}
float gauss()
/* Generates a normally distributed random value with variance 1 and 0 mean.
Algorithm based on "gasdev" from Numerical recipes' pg. 203. */
{
int iset = 0;
float gset = 0.0;
float v1 = 0.0, v2 = 0.0, r = 0.0;
float factor = 0.0;
if (iset) {
iset = 0;
return gset;
}
else {
do {
v1 = (float)random(0.,1.) * 2.0 - 1.0;
v2 = (float)random(0.,1.) * 2.0 - 1.0;
r = v1 * v1 + v2 * v2;
}
while (r > 1.0);
factor = sqrt (-2.0 * log (r) / r);
gset = v1 * factor;
iset = 1;
return (v2 * factor);
}
}
\end
\GenomeClass::display:
/* for( size_t i=0 ; i<SIZE ; i++){ */
/* // cout << Genome.x[i] << ":" << Genome.sigma[i] << "|"; */
/* printf("%.02f:%.02f|",Genome.x[i],Genome.sigma[i]); */
/* } */
\end
\Initialisation function:
std::cout<<"************* n: "<<n<<std::endl;
/* EvalCounter counter; */
/* counter.a = 0; */
/* d_counter = counter.cudaSendToGpuEvalCounter(); */
/* initOpts.counter=d_counter; */
\end
\Finalization function:
{
cout << "finalization function called" << endl;
/* EvalCounter counter; */
/* counter.cudaGetFromGpuEvalCounter(d_counter); */
/* cout << counter << endl; */
}
\end
\User classes :
EvalCounter {
int a;
}
GenomeClass {
float x[SIZE];
float sigma[SIZE]; // auto-adaptative mutation parameter
}
\end
\GenomeClass::initialiser : // "initializer" is also accepted
for(int i=0; i<n; i++ ) {
Genome.x[i] = (float)random(X_MIN,X_MAX);
Genome.sigma[i]=(float)random(0.,0.5);
}
\end
\GenomeClass::crossover :
for (int i=0; i<n; i++)
{
float alpha = (float)random(0.,1.); // barycentric crossover
child1.x[i] = alpha*parent1.x[i] + (1.-alpha)*parent2.x[i];
}
\end
\GenomeClass::mutator : // Must return the number of mutations
int NbMut=0;
float pond = 1./sqrt((float)n);
for (int i=0; i<n; i++)
if (tossCoin(pMutPerGene)){
NbMut++;
Genome.sigma[i] = Genome.sigma[i] * exp(SIGMA*pond*(float)gauss());
Genome.sigma[i] = MIN(0.5,Genome.sigma[0]);
Genome.sigma[i] = MAX(0.,Genome.sigma[0]);
Genome.x[i] += Genome.sigma[i]*(float)gauss();
Genome.x[i] = MIN(X_MAX,Genome.x[i]); // pour eviter les depassements
Genome.x[i] = MAX(X_MIN,Genome.x[i]);
}
return NbMut;
\end
\GenomeClass::evaluator : // Returns the score
float Score= 0.0;
float Point[SIZE];
for (int i=0; i<N_LIM; i++) Point[i] = Genome.x[i];
Score= Weierstrass(Point, N_LIM);
/* initOpts.counter->a+=2; */
return Score;
\end
\User Makefile options:
CPPFLAGS+=
\end
\Default run parameters : // Please let the parameters appear in this order
Number of generations : 100 // NB_GEN
Mutation probability : 1 // MUT_PROB
Crossover probability : 1 // XOVER_PROB
Population size : 10 // POP_SIZE
Genitors selector: Tournament 2
Final reduce: Tournament 2
// Selection operator : Tournament // RouletteWheel, Deterministic, Ranking, Random
Offspring size : 80% // 40%
//Replacement strategy : Plus // Comma, SteadyState, Generational
// Discarding operator : Worst // Best, Tournament, Parent, Random
Evaluator goal : Minimise // Maximise
Elitism: Strong
Elite: 1
\end
/*_________________________________________________________
Test functions
log normal adaptive mutation
Selection operator: Tournament
__________________________________________________________*/
\User declarations :
#define SIZE 10
#define X_MIN -1.
#define X_MAX 1.
#define ITER 50
#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;
#define N_LIM 10
int n = N_LIM;
double (*Fitness)(double *, int); // pointeur sur la fonction de fitness designee dans argv[1]
double Sphere(double *, int);
double AckleyPath(double *, int);
double Easom(double *, int);
double Griewangk(double *, int);
double Rastrigin(double *, int);
float Rosenbrock(float *, int);
float Schwefel(float *, int);
float Weierstrass(float *, int);
struct gpuOptions{
};
\end
\User functions:
//fitness function
#include <math.h>
inline float Sphere(float x[SIZE], int n) // Ex-DeJong function 1
{
float ret = 0;
for (int i = 0;i<n; i++) ret += x[ i ] * x[ i ];
return ret;
}
inline float AckleyPath(float x[SIZE], int n)
{
//Parameters
float a = 20.;
float b = 0.2;
float c = 2*PI;
float Scale = 32.768; // pour matcher avec les limites [-1,1]
//Function computation
float sum_x2 = 0.0;
float sum_cos_cx = 0.0;
for (int i=0; i<n; i++) {
sum_x2 += Scale*Scale*x[i]*x[i];
sum_cos_cx += cos(c*Scale*x[i]);
}
float res = -a * exp( -b * sqrt( 1/(float)n * sum_x2) ) - exp( 1/(float)n * sum_cos_cx ) + a + exp(1);
return res;
}
inline float Easom(float x[SIZE], int n)
{
float res = 1.;
//function computation
for (int i=0; i<n; i++)
res *= cos(100.*x[i])*exp(-(100.*x[i]-PI)*(100.*x[i]-PI));
return (1.-res); // pour avoir un minimum a 0.
}
inline float Griewangk(float x[SIZE], int n)
{
float res, sum = 0., prod =1.;
float Scale = 600.; // pour matcher avec les limites [-1,1]
for (int i=1; i<=n; i++) {
prod *= cos( Scale*x[i]/sqrt( (float)i ) );
sum += (Scale*Scale*x[i]*x[i]/4000.);
}
res = sum - prod + 1.;
return res;
}
inline float Rastrigin(float x[SIZE], int n)
{
float res = 0.;
float Scale = 5.12; // pour matcher avec les limites [-1,1]
for (int i = 0;i<n; i++)
res += ((Scale*Scale*x[i]*x[i])-10*cos( 2*PI*Scale*x[i]));
return (10.*n + res);
}
inline float Rosenbrock(float x[SIZE], int n)
{
float res = 0.;
float Scale = 2.048; // pour matcher avec les limites [-1,1]
for (int i = 0;i<n; i++)
res += 100.*((Scale*x[i+1] - Scale*Scale*x[i]*x[i])*(Scale*x[i+1]
- Scale*Scale*x[i]*x[i]))+(1-Scale*x[i])*(1-Scale*x[i]);
return (res);
}
inline float Schwefel(float x[SIZE], int n)
{
float res = 0.;
float Scale = 500.; // pour matcher avec les limites [-1,1]
for (int i = 0;i<n; i++)
res += (-Scale*x[i]*sin( sqrt(Abs(Scale*x[i]))));
return ((float)n*418.9829 + res);
}
__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<n; i++) {
val[i] = 0.;
for (int k=0;k<ITER;k++)
val[i] += pow(b,-(float)k*h) * sin(pow(b,(float)k)*x[i]);
res += Abs(val[i]);
}
return (res);
}
float gauss()
/* Generates a normally distributed random value with variance 1 and 0 mean.
Algorithm based on "gasdev" from Numerical recipes' pg. 203. */
{
int iset = 0;
float gset = 0.0;
float v1 = 0.0, v2 = 0.0, r = 0.0;
float factor = 0.0;
if (iset) {
iset = 0;
return gset;
}
else {
do {
v1 = (float)globalRandomGenerator->randFloat(0.,1.) * 2.0 - 1.0;
v2 = (float)globalRandomGenerator->randFloat(0.,1.) * 2.0 - 1.0;
r = v1 * v1 + v2 * v2;
}
while (r > 1.0);
factor = sqrt (-2.0 * log (r) / r);
gset = v1 * factor;
iset = 1;
return (v2 * factor);
}
}
\end
\GenomeClass::display:
for( size_t i=0 ; i<SIZE ; i++){
// cout << Genome.x[i] << ":" << Genome.sigma[i] << "|";
printf("%.02f:%.02f|",Genome.x[i],Genome.sigma[i]);
}
\end
\before everything else function:
std::cout<<"************* n: "<<n<<std::endl;
\end
\after everything else function:
//cout << "xover prob is " << XOVER_PROB << endl;
cout << "finalization function called" << endl;
\end
\User classes :
GenomeClass {
float x[SIZE];
float sigma[SIZE]; // auto-adaptative mutation parameter
}
\end
\GenomeClass::initialiser : // "initializer" is also accepted
for(int i=0; i<n; i++ ) {
Genome.x[i] = (float)random(X_MIN,X_MAX);
Genome.sigma[i]=(float)random(0.,0.5);
}
\end
\GenomeClass::crossover :
for (int i=0; i<n; i++)
{
float alpha = (float)globalRandomGenerator->getRandomIntMax(1.); // barycentric crossover
child1.x[i] = alpha*parent1.x[i] + (1.-alpha)*parent2.x[i];
//if (&child2) child2.x[i] = alpha*parent2.x[i] + (1.-alpha)*parent1.x[i];
}
\end
\At the end of each generation function:
if( currentGeneration==98 ) XOVER_PROB = 0.5;
\end
\At the beginning of each generation function:
\end
\GenomeClass::mutator : // Must return the number of mutations
int NbMut=0;
float pond = 1./sqrt((float)n);
for (int i=0; i<n; i++)
if (tossCoin(pMutPerGene)){
NbMut++;
Genome.sigma[i] = Genome.sigma[i] * exp(SIGMA*pond*(float)gauss());
Genome.sigma[i] = MIN(0.5,Genome.sigma[0]);
Genome.sigma[i] = MAX(0.,Genome.sigma[0]);
Genome.x[i] += Genome.sigma[i]*(float)gauss();
Genome.x[i] = MIN(X_MAX,Genome.x[i]); // pour eviter les depassements
Genome.x[i] = MAX(X_MIN,Genome.x[i]);
}
return NbMut;
\end
\GenomeClass::evaluator : // Returns the score
float Score= 0.0;
float Point[SIZE];
if(0) return 0;
for (int i=0; i<N_LIM; i++) Point[i] = Genome.x[i];
Score= Weierstrass(Point, N_LIM);
return Score;
\end
\User Makefile options:
CPPFLAGS+=
\end
\Default run parameters : // Please let the parameters appear in this order
Evaluator goal : Maximise //Minimise // Maximise
Number of generations : 100 // NB_GEN
Mutation probability : 1 // MUT_PROB
Crossover probability : 0.8 // XOVER_PROB
Population size : 20 // POP_SIZE
Offspring size : 20 // 40%
Genitors selector: RouletteWheel