Commit 178ff2ac authored by maitre's avatar maitre

Implemented crossover (didnt passed valgrind)

parent c49036e4
......@@ -52,6 +52,7 @@ extern float fMUT_PROB, fXOVER_PROB, fSURV_PAR_SIZE, fSURV_OFF_SIZE;
extern int nWARNINGS, nERRORS;
extern int TARGET, OPERATING_SYSTEM;
extern int TARGET_FLAVOR;
extern bool bLINE_NUM_EZ_FILE;
// Prototypes
extern int mystricmp(char *, char *);
......@@ -24,6 +24,7 @@ Centre de Math
size_t genomeSize;
bool genomeSizeValidity=false;
int lineCounter = 0;
// local functions
char* selectorDetermination(int nMINIMISE, char* sSELECTOR){
......@@ -155,7 +156,8 @@ exponent ([Ee][+-]?[0-9]+)
<TEMPLATE_ANALYSIS>"\\INSERT_USER_DECLARATIONS" {
if (bVERBOSE) printf ("Inserting user declarations.\n");
yyreset();
yyin = fpGenomeFile; // switch to .ez file and analyser
yyin = fpGenomeFile; // switch to .ez file and analyser
lineCounter=1;
BEGIN COPY_USER_DECLARATIONS;
}
<TEMPLATE_ANALYSIS>"\\INSERT_INITIALISATION_FUNCTION" {
......@@ -494,12 +496,14 @@ exponent ([Ee][+-]?[0-9]+)
<TEMPLATE_ANALYSIS>"\\INSERT_USER_FUNCTIONS" {
if (bVERBOSE) printf ("Inserting user functions.\n");
yyreset();
yyin = fpGenomeFile; // switch to .ez file and analyser
yyin = fpGenomeFile;
lineCounter=1; // switch to .ez file and analyser
BEGIN COPY_USER_FUNCTIONS;
}
<TEMPLATE_ANALYSIS>"\\INSERT_EO_INITIALISER" {
yyreset();
bWithinEO_Function=1;
lineCounter=1;
if( TARGET==CUDA || TARGET==STD) bWithinCUDA_Initializer = 1;
yyin = fpGenomeFile; // switch to .ez file and analyser
BEGIN COPY_EO_INITIALISER; // not implemented as a function !
......@@ -521,6 +525,7 @@ exponent ([Ee][+-]?[0-9]+)
<TEMPLATE_ANALYSIS>"\\INSERT_CROSSOVER" {
yyreset();
yyin = fpGenomeFile; // switch to .ez file and analyser
lineCounter=1;
BEGIN COPY_CROSSOVER;
}
<TEMPLATE_ANALYSIS>"\\INSERT_MUTATOR" {
......@@ -823,6 +828,8 @@ if(OPERATING_SYSTEM=WINDOWS)
<COPY_EO_INITIALISER>"\\GenomeClass::initiali"[sz]"er"[ \t\n]*":" {
fprintf (fpOutputFile,"// Genome Initialiser\n");
if( bLINE_NUM_EZ_FILE )
fprintf(fpOutputFile,"#line %d \"%s.ez\"\n",lineCounter, sRAW_PROJECT_NAME);
BEGIN COPY;
}
<COPY_EO_INITIALISER><<EOF>> {
......@@ -832,10 +839,13 @@ if(OPERATING_SYSTEM=WINDOWS)
BEGIN TEMPLATE_ANALYSIS;
bNotFinishedYet=1;
}
<COPY_EO_INITIALISER>.|\n {}
<COPY_EO_INITIALISER>. {}
<COPY_EO_INITIALISER>\n {lineCounter++;}
<COPY_USER_DECLARATIONS>"\\User"[ \t\n]+"declarations"[ \t\n]*":" {
fprintf (fpOutputFile,"// User declarations\n");
if( bLINE_NUM_EZ_FILE )
fprintf(fpOutputFile,"#line %d \"%s.ez\"\n",lineCounter, sRAW_PROJECT_NAME);
BEGIN COPY;
}
<COPY_USER_DECLARATIONS><<EOF>> {
......@@ -845,10 +855,16 @@ if(OPERATING_SYSTEM=WINDOWS)
BEGIN TEMPLATE_ANALYSIS;
bNotFinishedYet=1;
}
<COPY_USER_DECLARATIONS>.|\n {}
<COPY_USER_DECLARATIONS>. {}
<COPY_USER_DECLARATIONS>\n {
lineCounter++;
}
<COPY_USER_FUNCTIONS>"\\User"[ \t\n]+"functions"[ \t\n]*":" {
fprintf (fpOutputFile,"// User functions\n\n");
if( bLINE_NUM_EZ_FILE )
fprintf(fpOutputFile,"#line %d \"%s.ez\"\n",lineCounter, sRAW_PROJECT_NAME);
BEGIN COPY;
}
<COPY_USER_FUNCTIONS><<EOF>> {
......@@ -859,7 +875,10 @@ if(OPERATING_SYSTEM=WINDOWS)
BEGIN TEMPLATE_ANALYSIS;
bNotFinishedYet=1;
}
<COPY_USER_FUNCTIONS>.|\n {}
<COPY_USER_FUNCTIONS>. {}
<COPY_USER_FUNCTIONS>\n {
lineCounter++;
}
<COPY_INITIALISATION_FUNCTION>"\\Before"[ \t\n]+"everything"[ \t\n]+"else"[ \t\n]+"function"[ \t\n]*":" {
fprintf (fpOutputFile,"// Initialisation function\nvoid EASEAInitFunction(int argc, char *argv[]){");
......@@ -1273,10 +1292,13 @@ if(OPERATING_SYSTEM=WINDOWS)
<COPY_INITIALISER>.|\n {}
<COPY_CROSSOVER>"\\GenomeClass::crossover"[ \t\n]*":" {
bWithinXover=1;
if( bLINE_NUM_EZ_FILE )
fprintf(fpOutputFile,"#line %d \"%s.ez\"\n",lineCounter, sRAW_PROJECT_NAME);
BEGIN COPY_USER_FUNCTION;
return USER_XOVER;
}
<COPY_CROSSOVER>.|\n {}
<COPY_CROSSOVER>. {}
<COPY_CROSSOVER>\n {lineCounter++;}
<COPY_MUTATOR>"\\GenomeClass::mutator"[ \t\n]*":" {
bWithinMutator=1;
BEGIN COPY_USER_FUNCTION;
......@@ -1651,7 +1673,9 @@ if(OPERATING_SYSTEM=WINDOWS)
// end of .ez file : resume tpl analysis
<GET_PARAMETERS>"\\end" {rewind(fpGenomeFile); yyin = fpTemplateFile; BEGIN TEMPLATE_ANALYSIS;} // switch back to .tpl file and analyser
//<GET_PARAMETERS>.|\n {}
\n {
lineCounter++;
}
//****************************************
......
......@@ -42,6 +42,7 @@ int nMINIMISE=2;
int nELITE;
bool bELITISM=0;
bool bVERBOSE=0;
bool bLINE_NUM_EZ_FILE=1;
bool bPRINT_STATS=1;
bool bPLOT_STATS=0;
bool bGENERATE_CVS_FILE=0, bGENERATE_R_SCRIPT=0, bGENERATE_GNUPLOT_SCRIPT=0;
......@@ -675,6 +676,7 @@ int main(int argc, char *argv[]){
}
else if (!mystricmp(sTemp,"v")) bVERBOSE=true;
else if (!mystricmp(sTemp,"tl")) bLINE_NUM_EZ_FILE=false;
else if (!mystricmp(sTemp,"path")) {
if (argv[++nParamNb][0]=='"') {
strcpy(sEZ_PATH,&(argv[nParamNb][1]));
......
77
0.05,0.61,0.3,5,27.2
0.05,0.61,0.3,15,44.9
0.05,0.61,0.3,30,59.3
0.05,0.61,0.3,45,68.7
0.05,0.61,0.3,75,80.1
0.05,0.61,0.3,120,87.2
0.05,0.61,0.3,180,94.2
0.05,0.86,0.61,5,27.2
0.05,0.86,0.61,15,41.6
0.05,0.86,0.61,30,56.4
0.05,0.86,0.61,45,64.7
0.05,0.86,0.61,75,74
0.05,0.86,0.61,120,81.4
0.05,0.86,0.61,180,86.2
0.05,0.76,0.76,5,8.7
0.05,0.76,0.76,15,21.3
0.05,0.76,0.76,30,33.9
0.05,0.76,0.76,45,42.9
0.05,0.76,0.76,75,57.3
0.05,0.76,0.76,120,65.5
0.05,0.76,0.76,180,69.2
0.06,0.86,0.61,5,17.7
0.06,0.86,0.61,15,30.1
0.06,0.86,0.61,30,43.9
0.06,0.86,0.61,45,52
0.06,0.86,0.61,75,64.7
0.06,0.86,0.61,120,74.6
0.06,0.86,0.61,180,82
0.25,0.86,0.61,5,8.5
0.25,0.86,0.61,15,20.9
0.25,0.86,0.61,30,33.6
0.25,0.86,0.61,45,44.6
0.25,0.86,0.61,75,56.6
0.25,0.86,0.61,120,68.2
0.25,0.86,0.61,180,76
0.35,0.76,0.76,5,5
0.35,0.76,0.76,15,14.9
0.35,0.76,0.76,30,28.6
0.35,0.76,0.76,45,37.3
0.35,0.76,0.76,75,51.3
0.35,0.76,0.76,120,63.6
0.35,0.76,0.76,180,72.1
0.5,0.86,0.61,5,5
0.5,0.86,0.61,15,14.5
0.5,0.86,0.61,30,27.6
0.5,0.86,0.61,45,36.4
0.5,0.86,0.61,75,52.3
0.5,0.86,0.61,120,64.3
0.5,0.86,0.61,180,72
0.5,1.52,0.76,5,10.5
0.5,1.52,0.76,15,20.4
0.5,1.52,0.76,30,34
0.5,1.52,0.76,45,46.4
0.5,1.52,0.76,75,61.2
0.5,1.52,0.76,120,76.2
0.5,1.52,0.76,180,80
0.5,1.07,0.76,5,10.5
0.5,1.07,0.76,15,19.7
0.5,1.07,0.76,30,32.3
0.5,1.07,0.76,45,42.3
0.5,1.07,0.76,75,57.1
0.5,1.07,0.76,120,70.8
0.5,1.07,0.76,180,76
0.5,0.94,0.76,5,9.1
0.5,0.94,0.76,15,18.4
0.5,0.94,0.76,30,31.7
0.5,0.94,0.76,45,40.3
0.5,0.94,0.76,75,54.1
0.5,0.94,0.76,120,67.8
0.5,0.94,0.76,180,74
0.5,0.76,0.76,5,9.5
0.5,0.76,0.76,15,17.3
0.5,0.76,0.76,30,28.3
0.5,0.76,0.76,45,37.2
0.5,0.76,0.76,75,49
0.5,0.76,0.76,120,61.7
0.5,0.76,0.76,180,66
This diff is collapsed.
EXEC = easea
CPPFLAGS += -DUNIX_OS -Ialexyacc/include/ -g -Wno-deprecated -DDEBUG
CPPFLAGS += -DUNIX_OS -Ialexyacc/include/ -g -Wno-deprecated -DDEBUG -DLINE_NUM_EZ_FILE
CPPC = g++
LDFLAGS =
......
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