Commit 645844ef authored by Frederic's avatar Frederic

currentGeneration

parent 3ca1ba93
......@@ -1282,7 +1282,8 @@ exponent ([Ee][+-]?[0-9]+)
<COPY>"currentGeneration"/[ \t\n]*"==" {if (bDoubleQuotes) fprintf(fpOutputFile,"currentGeneration");
else switch (TARGET) {
case GALIB : fprintf(fpOutputFile,"EZ_currentGeneration"); break;
case EO : fprintf(fpOutputFile,"generationCounter.value()");
case EO : fprintf(fpOutputFile,"generationCounter.value()"); break;
case STD : fprintf(fpOutputFile,"(*EZ_current_generation)"); break;
}} // local genome name
<COPY>"NB_GEN" |
<COPY>"NB_GEN"/[ \t\n]*"==" {if (bDoubleQuotes) fprintf(fpOutputFile,"NB_GEN");
......@@ -1595,7 +1596,7 @@ exponent ([Ee][+-]?[0-9]+)
fprintf(fpOutputFile,"generationCounter.value()"); break;
case CUDA:
case STD:
fprintf(fpOutputFile,"(evolutionaryAlgorithm->getCurrentGeneration())");
fprintf(fpOutputFile,"(*EZ_current_generation)");
break;
}} // local genome name
<COPY_USER_GENERATION>"NB_GEN" |
......@@ -1851,7 +1852,8 @@ exponent ([Ee][+-]?[0-9]+)
<COPY_USER_FUNCTION>"currentGeneration"/[ \t\n]*"==" {if (bDoubleQuotes) fprintf(fpOutputFile,"currentGeneration");
else switch (TARGET) {
case GALIB : fprintf(fpOutputFile,"EZ_currentGeneration"); break;
case EO : fprintf(fpOutputFile,"generationCounter.value()");
case EO : fprintf(fpOutputFile,"generationCounter.value()"); break;
case STD : fprintf(fpOutputFile,"(*EZ_current_generation)"); break;
}} // local genome name
<COPY_USER_FUNCTION>"NB_GEN" |
<COPY_USER_FUNCTION>"NB_GEN"/[ \t\n]*"==" {if (bDoubleQuotes) fprintf(fpOutputFile,"NB_GEN");
......
......@@ -11,6 +11,7 @@ using namespace std;
RandomGenerator* globalRandomGenerator;
size_t *EZ_NB_GEN;
size_t *EZ_current_generation;
int main(int argc, char** argv){
......@@ -22,6 +23,8 @@ int main(int argc, char** argv){
float pCrossover = \XOVER_PROB;
float pMutation = \MUT_PROB;
float pMutationPerGene = 0.05;
EZ_NB_GEN=(size_t*)setVariable("nbGen",\NB_GEN);
EZ_current_generation=0;
time_t seed = setVariable("seed",time(0));
globalRandomGenerator = new RandomGenerator(seed);
......@@ -48,6 +51,7 @@ int main(int argc, char** argv){
StoppingCriterion* sc = new GenerationalCriterion(&ea,setVariable("nbGen",\NB_GEN));
ea.addStoppingCriterion(sc);
EZ_current_generation=&(ea.currentGeneration);
EZ_NB_GEN=((GenerationalCriterion*)ea.stoppingCriteria[0])->getGenerationalLimit();
Population* pop = ea.getPopulation();
......@@ -1979,6 +1983,7 @@ class Individual;
class Population;
extern size_t *EZ_NB_GEN;
extern size_t *EZ_current_generation;
#define EZ_MINIMIZE \MINIMAXI
#define EZ_MINIMISE \MINIMAXI
......
......@@ -9,6 +9,8 @@ using namespace std;
/** Global variables for the whole algorithm */
float* pEZ_MUT_PROB = NULL;
float* pEZ_XOVER_PROB = NULL;
size_t *EZ_NB_GEN;
size_t *EZ_current_generation;
#include <iostream>
#include "EASEATools.hpp"
......@@ -18,7 +20,6 @@ float* pEZ_XOVER_PROB = NULL;
RandomGenerator* globalRandomGenerator;
size_t *EZ_NB_GEN;
int main(int argc, char** argv){
......@@ -33,6 +34,8 @@ int main(int argc, char** argv){
pEZ_MUT_PROB = &pMutationPerGene;
pEZ_XOVER_PROB = &pCrossover;
EZ_NB_GEN = (size_t*)setVariable("nbGen",\NB_GEN);
EZ_current_generation=0;
time_t seed = setVariable("seed",time(0));
globalRandomGenerator = new RandomGenerator(seed);
......@@ -61,7 +64,8 @@ int main(int argc, char** argv){
ea.addStoppingCriterion(sc);
EZ_NB_GEN=((GenerationalCriterion*)ea.stoppingCriteria[0])->getGenerationalLimit();
EZ_current_generation=&(ea.currentGeneration);
Population* pop = ea.getPopulation();
......@@ -1280,6 +1284,7 @@ class Individual;
class Population;
extern size_t *EZ_NB_GEN;
extern size_t *EZ_current_generation;
#define EZ_MINIMIZE \MINIMAXI
#define EZ_MINIMISE \MINIMAXI
......
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