Commit 0d7a963c authored by kruger's avatar kruger

Modification Sans Bug Jespere

parent 7b125b06
......@@ -569,13 +569,9 @@ Parameter
}
}
| ELITE NUMBER2 {
if ($2!=0) bELITISM=1;
else bELITISM=0;
nELITE=(int)$2;
}
| ELITE NUMBER2 '%' {
if ($2!=0) bELITISM=1;
else bELITISM=0;
nELITE=(int)$2*nPOP_SIZE/100;
}
| ELITISM IDENTIFIER2{
......@@ -586,11 +582,11 @@ Parameter
bELITISM=1;
}}
| BALDWINISM IDENTIFIER2{
if (!mystricmp($2->sName,"False")) bELITISM=0;
else if (!mystricmp($2->sName,"True")) bELITISM=1;
if (!mystricmp($2->sName,"False")) bBALDWINISM=0;
else if (!mystricmp($2->sName,"True")) bBALDWINISM=1;
else {
fprintf(stderr,"\n%s - Warning line %d: Lamarckism must be \"True\" or \"False\".\nDefault value \"True\" inserted.\n.",sEZ_FILE_NAME,EASEALexer.yylineno);nWARNINGS++;
bELITISM=1;
fprintf(stderr,"\n%s - Warning line %d: Baldwinism must be \"True\" or \"False\".\nDefault value \"True\" inserted.\n.",sEZ_FILE_NAME,EASEALexer.yylineno);nWARNINGS++;
bBALDWINISM=1;
}}
| PRINT_STATS NUMBER2{
......
......@@ -159,7 +159,7 @@ return NbMut;
\GenomeClass::evaluator : // Returns the score
float Score= 0.0;
Score= Weierstrass(Genome.x, SIZE);
// Score= rosenbrock(Genome.x);
//Score= rosenbrock(Genome.x);
return Score;
\end
......
......@@ -158,8 +158,8 @@ return NbMut;
\GenomeClass::evaluator : // Returns the score
float Score= 0.0;
//Score= Weierstrass(Genome.x, SIZE);
Score= rosenbrock(Genome.x);
Score= Weierstrass(Genome.x, SIZE);
// Score= rosenbrock(Genome.x);
return Score;
\end
......@@ -175,8 +175,8 @@ return NbMut;
for(int i=0; i<100; i++){
tmp[index] += pas;
//fitnesstmp = Weierstrass(tmp, SIZE);
fitnesstmp = rosenbrock(tmp);
fitnesstmp = Weierstrass(tmp, SIZE);
//fitnesstmp = rosenbrock(tmp);
if(fitnesstmp < Genome.fitness){
Genome.fitness = fitnesstmp;
......
......@@ -27,6 +27,23 @@ struct gpuOptions;
//fitness function
#include <math.h>
__device__ __host__ inline static float SQR(float d)
{
return (d*d);
}
__device__ __host__ inline float rosenbrock( float const *x)
{
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 Weierstrass(float *x, int n) // Weierstrass multimidmensionnel h = 0.25
{
float res = 0.;
......@@ -138,6 +155,7 @@ return NbMut;
\GenomeClass::evaluator : // Returns the score
float Score= 0.0;
Score= Weierstrass(Genome.x, SIZE);
//Score= rosenbrock(Genome.x);
return Score;
\end
......
......@@ -26,6 +26,23 @@ float pMutPerGene=0.1;
//fitness function
#include <math.h>
__device__ __host__ inline static float SQR(float d)
{
return (d*d);
}
__device__ __host__ inline float rosenbrock( float const *x)
{
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 Weierstrass(float x[SIZE], int n) // Weierstrass multimidmensionnel h = 0.25
{
float res = 0.;
......@@ -141,7 +158,8 @@ return NbMut;
\GenomeClass::evaluator : // Returns the score
float Score= 0.0;
Score= Weierstrass(Genome.x, SIZE);
//Score= Weierstrass(Genome.x, SIZE);
Score= rosenbrock(Genome.x);
return Score;
\end
......@@ -165,7 +183,7 @@ CPPFLAGS+=
Final reduce operator: Tournament 2
Elitism: Strong //Weak or Strong
Elite: 1
Elite: 0
Print stats:1 //Default: 1
Generate csv stats file:0
Generate gnuplot script:0
......
......@@ -133,13 +133,6 @@ void evale_pop_chunk(CIndividual** population, int popSize){
void EASEAInit(int argc, char** argv){
\INSERT_INIT_FCT_CALL
//Initialiazing GPU
printf("Initializing GPU\n");
void *allocatedDeviceBuffer;
cudaMalloc(&allocatedDeviceBuffer,0);
cudaFree(allocatedDeviceBuffer);
free(allocatedDeviceBuffer);
}
void EASEAFinal(CPopulation* pop){
......
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