Commit fef1bee4 authored by maitre's avatar maitre
Browse files

XOVER_PROB ok

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