Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
easea
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Arnaud Kress
easea
Commits
4aba409f
Commit
4aba409f
authored
Jun 02, 2009
by
maitre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
merge test
parent
ff7c803e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
59 additions
and
5 deletions
+59
-5
EaseaLex.l
EaseaLex.l
+37
-4
exemples/easea_stable_tests/weierstrass_original/Generic_T_ad.ez
...s/easea_stable_tests/weierstrass_original/Generic_T_ad.ez
+16
-0
tpl/STD.tpl
tpl/STD.tpl
+6
-1
No files found.
EaseaLex.l
View file @
4aba409f
...
...
@@ -72,7 +72,7 @@ Centre de Math
bool bWaitingForSemiColon,bFinishNB_GEN,bFinishMINIMISE,bFinishMINIMIZE,bGenerationFunction;
bool bCatchNextSemiColon,bWaitingToClosePopulation, bMethodsInGenome, bFinalizationFunction;
bool bWithinCUDA_Initializer, bWithinMAKEFILEOPTION, bWithinCUDA_Evaluator, bBoundCheckingFunction;
bool bIsParentReduce, bIsOffspringReduce;
bool bIsParentReduce, bIsOffspringReduce
, bEndGeneration, bBeginGeneration
;
CSymbol *pASymbol;
public:
...
...
@@ -89,6 +89,7 @@ Centre de Math
bCatchNextSemiColon,bWaitingToClosePopulation=bMethodsInGenome=0;
bBoundCheckingFunction = bWithinCUDA_Initializer=bWithinMAKEFILEOPTION =bWithinCUDA_Evaluator=0;
bIsParentReduce = bIsOffspringReduce = false;
bEndGeneration = bBeginGeneration = false;
}
// macros
...
...
@@ -156,6 +157,26 @@ exponent ([Ee][+-]?[0-9]+)
BEGIN COPY_GENERATION_FUNCTION;
}
<TEMPLATE_ANALYSIS>"\\INSERT_BEGIN_GENERATION_FUNCTION" {
if (bVERBOSE) printf ("Inserting at the begining of each generation function.\n");
yyreset();
yyin = fpGenomeFile;
BEGIN COPY_GENERATION_FUNCTION;
}
<TEMPLATE_ANALYSIS>"\\INSERT_END_GENERATION_FUNCTION" {
if (bVERBOSE) printf ("Inserting at the end of each generation function.\n");
yyreset();
yyin = fpGenomeFile;
bEndGeneration = true;
bBeginGeneration = false;
BEGIN COPY_GENERATION_FUNCTION;
}
<TEMPLATE_ANALYSIS>"\\INSERT_BOUND_CHECKING" {
if (bVERBOSE) printf ("Inserting Bound Checking function.\n");
yyreset();
...
...
@@ -1097,7 +1118,7 @@ exponent ([Ee][+-]?[0-9]+)
fprintf (fpOutputFile,"// Finalization function\nvoid EASEAFinalization(Population* population){");
break;
default:
fprintf (stderr,"
Warning
this template doesn't support finalization function ");
fprintf (stderr,"
Error
this template doesn't support finalization function ");
return -1;
}
bFunction=1; bFinalizationFunction=1;
...
...
@@ -1115,18 +1136,30 @@ exponent ([Ee][+-]?[0-9]+)
<COPY_FINALIZATION_FUNCTION>.|\n {}
<COPY_GENERATION_FUNCTION>"\\At"[ \t\n]+"the"[ \t\n]+"end"[ \t\n]+"of"[ \t\n]+"each"[ \t\n]+"generation"[ \t\n]+"function"[ \t\n]*":" {
if( (TARGET==CUDA || TARGET==STD)&& bEndGeneration ){
fprintf (fpOutputFile,"// Function called at each new generation\nvoid EASEAEndGenerationFunction(EvolutionaryAlgorithm* evolutionaryAlgorithm){\n");
bFunction=1; bGenerationFunction=1;
bEndGeneration = 0;
BEGIN COPY_USER_GENERATION;
}
}
<COPY_GENERATION_FUNCTION>"\\At"[ \t\n]+"each"[ \t\n]+"new"[ \t\n]+"generation"[ \t\n]*":" {
if( TARGET==GALIB){
fprintf (fpOutputFile,"// Function called at each new generation\n\nvoid EASEAGenerationFunction(GAGeneticAlgorithm & g){\n");
fprintf(fpOutputFile," const GAPopulation *pPopulation;\n",sPROJECT_NAME);
fprintf(fpOutputFile," pPopulation=&(g.population()); // to circumvent a bug in GALib\n",sPROJECT_NAME);
bFunction=1; bGenerationFunction=1;
BEGIN COPY_USER_GENERATION;
}
else if(TARGET==CUDA || TARGET==STD){
fprintf (fpOutputFile,"// Function called at each new generation\nvoid EASEAGenerationFunction(EvolutionaryAlgorithm* evolutionaryAlgorithm){\n");
bFunction=1; bGenerationFunction=1;
if( !bEndGeneration && !bBeginGeneration )
BEGIN COPY_USER_GENERATION;
}
bFunction=1; bGenerationFunction=1;
BEGIN COPY_USER_GENERATION;
}
<COPY_GENERATION_FUNCTION><<EOF>> {
bGenerationFunction=0; // No Generation function was found in the .ez file
...
...
exemples/easea_stable_tests/weierstrass_original/Generic_T_ad.ez
View file @
4aba409f
...
...
@@ -227,6 +227,22 @@ return NbMut;
CPPFLAGS+=
\end
\At the beginning of each generation function:
if (NB_GEN-currentGeneration==10) pMutPerGene=0.1;
\end
\At the end of each generation function:
if (NB_GEN-currentGeneration==10) pMutPerGene=0.1;
\end
\At each new generation :
cout << "A new generation is born" << endl;
\end
\Default run parameters : // Please let the parameters appear in this order
Number of generations : 100 // NB_GEN
Mutation probability : 1 // MUT_PROB
...
...
tpl/STD.tpl
View file @
4aba409f
...
...
@@ -85,6 +85,10 @@ extern RandomGenerator* globalRandomGenerator;
\INSERT_INITIALISATION_FUNCTION
\INSERT_FINALIZATION_FUNCTION
\INSERT_GENERATION_FUNCTION
\INSERT_BEGIN_GENERATION_FUNCTION
\INSERT_END_GENERATION_FUNCTION
\INSERT_BOUND_CHECKING
void EASEAFinal(Population* pop){
...
...
@@ -275,6 +279,8 @@ void EvolutionaryAlgorithm::runEvolutionaryLoop(){
population->evaluateOffspringPopulation();
\INSERT_GEN_FCT_CALL
#if \IS_PARENT_REDUCTION
population->reduceParentPopulation(\SURV_PAR_SIZE);
...
...
@@ -287,7 +293,6 @@ void EvolutionaryAlgorithm::runEvolutionaryLoop(){
population->reduceTotalPopulation();
\INSERT_GEN_FCT_CALL
showPopulationStats(begin);
currentGeneration += 1;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment