Commit fef1bee4 authored by maitre's avatar maitre

XOVER_PROB ok

parent c143ea0c
......@@ -1302,8 +1302,13 @@ exponent ([Ee][+-]?[0-9]+)
} // local genome name
<COPY>"XOVER_PROB" |
<COPY>"XOVER_PROB"/[ \t\n]*"==" {if (bDoubleQuotes) fprintf(fpOutputFile,"XOVER_PROB");
else fprintf(fpOutputFile,"EZ_XOVER_PROB");} // local genome name
<COPY>"XOVER_PROB"/[ \t\n]*"==" {
if (bDoubleQuotes)
fprintf(fpOutputFile,"XOVER_PROB");
else if( TARGET==CUDA || TARGET==STD )
fprintf(fpOutputFile,"(*pEZ_XOVER_PROB)");
else fprintf(fpOutputFile,"EZ_XOVER_PROB");
} // local genome name
<COPY>"REPL_PERC" |
<COPY>"REPL_PERC"/[ \t\n]*"==" {if (bDoubleQuotes) fprintf(fpOutputFile,"REPL_PERC");
else fprintf(fpOutputFile,"EZ_REPL_PERC");} // local genome name
......@@ -1617,11 +1622,16 @@ exponent ([Ee][+-]?[0-9]+)
}
} // local genome name
<COPY_USER_GENERATION>"XOVER_PROB" |
<COPY_USER_GENERATION>"XOVER_PROB"/[ \t\n]*"==" {if (bDoubleQuotes) fprintf(fpOutputFile,"XOVER_PROB");
<COPY_USER_GENERATION>"XOVER_PROB"/[ \t\n]*"==" {
if (bDoubleQuotes) fprintf(fpOutputFile,"XOVER_PROB");
else switch (TARGET) {
case GALIB : fprintf(fpOutputFile,"g.pCrossover()"); break;
case EO : fprintf(fpOutputFile,"EZ_XOVER_PROB");
}} // local genome name
case EO : fprintf(fpOutputFile,"EZ_XOVER_PROB"); break;
case STD:
case CUDA:
fprintf(fpOutputFile,"(*pEZ_XOVER_PROB)");
}
} // local genome name
<COPY_USER_GENERATION>"REPL_PERC" |
<COPY_USER_GENERATION>"REPL_PERC"/[ \t\n]*"==" {if (bDoubleQuotes) fprintf(fpOutputFile,"REPL_PERC");
else switch (TARGET) {
......@@ -1690,8 +1700,12 @@ exponent ([Ee][+-]?[0-9]+)
else switch (TARGET) {
case GALIB :fprintf(fpOutputFile,"g.pCrossover((EZ_XOVER_PROB=");
bWaitingForSemiColon=1; break;
case EO : fprintf(fpOutputFile,"EZ_MUT_PROB=");
}} // local genome name
case EO : fprintf(fpOutputFile,"EZ_XOVER_PROB="); break;
case CUDA:
case STD:
fprintf(fpOutputFile,"(*pEZ_XOVER_PROB)=");
}
} // local genome name
<COPY_USER_GENERATION>"REPL_PERC"[ \t\n]*"=" {if (bDoubleQuotes) fprintf(fpOutputFile,"%s",yytext);
else switch (TARGET) {
case GALIB :fprintf(fpOutputFile,"g.pReplacement((1/100)*(EZ_REPL_PERC=");
......@@ -1845,7 +1859,11 @@ exponent ([Ee][+-]?[0-9]+)
else fprintf(fpOutputFile,"EZ_MUT_PROB");
} // local genome name
<COPY_USER_FUNCTION>"XOVER_PROB" |
<COPY_USER_FUNCTION>"XOVER_PROB"/[ \t\n]*"==" {if (bDoubleQuotes) fprintf(fpOutputFile,"XOVER_PROB");
<COPY_USER_FUNCTION>"XOVER_PROB"/[ \t\n]*"==" {
if (bDoubleQuotes)
fprintf(fpOutputFile,"XOVER_PROB");
else if( TARGET==CUDA || TARGET==STD )
fprintf(fpOutputFile,"(*pEZ_XOVER_PROB)");
else fprintf(fpOutputFile,"EZ_XOVER_PROB");} // local genome name
<COPY_USER_FUNCTION>"REPL_PERC" |
<COPY_USER_FUNCTION>"REPL_PERC"/[ \t\n]*"==" {if (bDoubleQuotes) fprintf(fpOutputFile,"REPL_PERC");
......
......@@ -119,8 +119,6 @@ inline float Schwefel(float x[SIZE], int n)
__device__ __host__ inline float Weierstrass(float x[SIZE], int n) // Weierstrass multimidmensionnel h = 0.25
{
cout << MUT_PROB << endl;
float res = 0.;
float val[SIZE];
float b=2.;
......@@ -169,11 +167,12 @@ float gauss()
printf("%.02f:%.02f|",Genome.x[i],Genome.sigma[i]);
}
\end
\Initialisation function:
\before everything else function:
std::cout<<"************* n: "<<n<<std::endl;
\end
\Finalization function:
\after everything else function:
cout << "xover prob is " << XOVER_PROB << endl;
cout << "finalization function called" << endl;
\end
......@@ -202,6 +201,7 @@ GenomeClass {
\At the end of each generation function:
if( currentGeneration==98 ) XOVER_PROB = 0.5;
\end
......@@ -240,7 +240,7 @@ CPPFLAGS+=
\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
Crossover probability : 0.8 // XOVER_PROB
Population size : 20 // POP_SIZE
Offspring size : 20 // 40%
Genitors selector: Tournament 2
......
......@@ -8,6 +8,7 @@ using namespace std;
#include <stdlib.h>
/** Global variables for the whole algorithm */
float* pEZ_MUT_PROB = NULL;
float* pEZ_XOVER_PROB = NULL;
#include <iostream>
#include "EASEATools.hpp"
......@@ -30,6 +31,9 @@ int main(int argc, char** argv){
float pMutation = \MUT_PROB;
float pMutationPerGene = 0.05;
pEZ_MUT_PROB = &pMutationPerGene;
pEZ_XOVER_PROB = &pCrossover;
time_t seed = setVariable("seed",time(0));
globalRandomGenerator = new RandomGenerator(seed);
......@@ -709,6 +713,7 @@ Population::Population(size_t parentPopulationSize, size_t offspringPopulationSi
this->pCrossover = pCrossover;
this->pMutation = pMutation;
pEZ_MUT_PROB = &this->pMutation;
pEZ_XOVER_PROB = &this->pCrossover;
this->pMutationPerGene = pMutationPerGene;
this->rg = rg;
......@@ -1262,6 +1267,7 @@ string setVariable(const string optionName, string defaultValue){
#include <boost/serialization/vector.hpp>
extern float* pEZ_MUT_PROB;
extern float* pEZ_XOVER_PROB;
class EvolutionaryAlgorithm;
class Individual;
......
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