Commit ff5dc5d5 authored by maitre's avatar maitre
Browse files

Commit from Fred, Og

parent 8630340f
......@@ -18,9 +18,6 @@ Centre de Math
#define true 1
#define false 0
#define GALIB 1
#define EO 2
#define DREAM 3
#define CUDA 4
#define STD 5
......@@ -43,15 +40,14 @@ extern int nClasses_nb;
extern FILE *fpOutputFile, *fpTemplateFile, *fpGenomeFile, *fpExplodedGenomeFile;
extern char sRAW_PROJECT_NAME[], sPROJECT_NAME[], sEO_DIR[], sEZ_PATH[1000], sTPL_DIR[1000], sEZ_FILE_NAME[];
extern char sLOWER_CASE_PROJECT_NAME[];
extern char sREPLACEMENT[], sSELECTOR[], sSELECT_PRM[], sRED_PAR[], sRED_PAR_PRM[], sRED_FINAL[], sRED_FINAL_PRM[], sRED_OFF[], sRED_OFF_PRM[], sDISCARD[], sDISCARD_PRM[];
extern float fSELECT_PRM, fRED_PAR_PRM, fRED_FINAL_PRM, fRED_OFF_PRM;
extern char sSELECTOR[], sSELECTOR_OPERATOR[], sRED_PAR[], sRED_PAR_OPERATOR[], sRED_FINAL[], sRED_FINAL_OPERATOR[], sRED_OFF[], sRED_OFF_OPERATOR[];
extern int nMINIMISE,nELITE;
extern bool bELITISM, bVERBOSE;
extern bool bPROP_SEQ;
extern bool bPRINT_STATS, bPLOT_STATS, bGENERATE_CVS_FILE, bGENERATE_GNUPLOT_SCRIPT, bGENERATE_R_SCRIPT;
extern char* nGENOME_NAME;
extern int nPOP_SIZE, nNB_GEN, nNB_ISLANDS, nOFF_SIZE, nSURV_PAR_SIZE, nSURV_OFF_SIZE, nPROBLEM_DIM;
extern float fMUT_PROB, fXOVER_PROB, fREPL_PERC, fMIG_FREQ;
extern int nMIG_CLONE, nNB_MIG, nIMMIG_REPL;
extern char sMIG_SEL[], sMIGRATOR[], sIMMIG_SEL[],sMIG_TARGET_SELECTOR[];
extern int nPOP_SIZE, nNB_GEN, nOFF_SIZE, nPROBLEM_DIM, nTIME_LIMIT;
extern float fMUT_PROB, fXOVER_PROB, fSURV_PAR_SIZE, fSURV_OFF_SIZE;
extern int nWARNINGS, nERRORS;
extern int TARGET, OPERATING_SYSTEM;
......
......@@ -36,11 +36,13 @@ Centre de Math
strcpy(selectorName,"Max");
if( mystricmp("tournament",sSELECTOR)==0 )
if( mystricmp("Tournament",sSELECTOR)==0 )
strcat(selectorName,"Tournament(globalRandomGenerator)");
else if( mystricmp("dettour",sSELECTOR)==0 )
strcat(selectorName,"Tournament(globalRandomGenerator)");
else if( mystricmp("Sequential",sSELECTOR)==0 )
else if( mystricmp("Deterministic",sSELECTOR)==0 )
strcat(selectorName,"Deterministic()");
else if( mystricmp("deterministic",sSELECTOR)==0 )
strcat(selectorName,"Deterministic()");
else if( mystricmp("Random",sSELECTOR)==0 )
strcat(selectorName,"Random(globalRandomGenerator)");
......@@ -72,7 +74,7 @@ Centre de Math
%start COPY_EO_INITIALISER
%start COPY COPY_INITIALISER COPY_CROSSOVER COPY_MUTATOR COPY_EVALUATOR COPY_FINALIZATION_FUNCTION
%start COPY_DISPLAY COPY_USER_FUNCTION COPY_USER_GENERATION PARAMETERS_ANALYSIS GET_PARAMETERS
%start COPY_USER_FUNCTIONS COPY_GENERATION_FUNCTION GET_METHODS COPY_MAKEFILE_OPTION COPY_BOUND_CHECKING_FUNCTION COPY_BEG_GENERATION_FUNCTION COPY_END_GENERATION_FUNCTION
%start COPY_USER_FUNCTIONS COPY_GENERATION_FUNCTION_BEFORE_REPLACEMENT GET_METHODS COPY_MAKEFILE_OPTION COPY_BOUND_CHECKING_FUNCTION COPY_BEG_GENERATION_FUNCTION COPY_END_GENERATION_FUNCTION
// lexical analyser name and class definition
%name CEASEALexer {
......@@ -81,10 +83,10 @@ Centre de Math
bool bSymbolInserted,bWithinEvaluator; // used to change evalutor type from double to float
bool bInitFunction,bDisplayFunction,bFunction, bNotFinishedYet, bWithinEO_Function;
bool bDoubleQuotes,bWithinDisplayFunction,bWithinInitialiser,bWithinMutator,bWithinXover;
bool bWaitingForSemiColon,bFinishNB_GEN,bFinishMINIMISE,bFinishMINIMIZE,bGenerationFunction;
bool bWaitingForSemiColon,bFinishNB_GEN,bFinishMINIMISE,bFinishMINIMIZE,bGenerationReplacementFunction;
bool bCatchNextSemiColon,bWaitingToClosePopulation, bMethodsInGenome, bFinalizationFunction;
bool bWithinCUDA_Initializer, bWithinMAKEFILEOPTION, bWithinCUDA_Evaluator, bBoundCheckingFunction;
bool bIsParentReduce, bIsOffspringReduce, bEndGeneration, bBeginGeneration, bEndGenerationFunction, bBeginGenerationFunction;
bool bIsParentReduce, bIsOffspringReduce, bEndGeneration, bBeginGeneration, bEndGenerationFunction, bBeginGenerationFunction, bGenerationFunctionBeforeReplacement;
CSymbol *pASymbol;
public:
......@@ -97,11 +99,11 @@ Centre de Math
{
bFunction=bWithinEvaluator=bDisplayFunction=bInitFunction=bNotFinishedYet=0;
bSymbolInserted=bDoubleQuotes=bWithinDisplayFunction=bWithinInitialiser=bWithinMutator=bWithinXover=0;
bWaitingForSemiColon=bFinishNB_GEN=bFinishMINIMISE=bFinishMINIMIZE=bGenerationFunction=0;
bWaitingForSemiColon=bFinishNB_GEN=bFinishMINIMISE=bFinishMINIMIZE=bGenerationReplacementFunction=0;
bCatchNextSemiColon,bWaitingToClosePopulation=bMethodsInGenome=0;
bBoundCheckingFunction = bWithinCUDA_Initializer=bWithinMAKEFILEOPTION =bWithinCUDA_Evaluator=0;
bIsParentReduce = bIsOffspringReduce = false;
bEndGeneration = bBeginGeneration = bEndGenerationFunction = bBeginGenerationFunction = false;
bGenerationFunctionBeforeReplacement = bEndGeneration = bBeginGeneration = bEndGenerationFunction = bBeginGenerationFunction = false;
}
// macros
......@@ -132,7 +134,6 @@ exponent ([Ee][+-]?[0-9]+)
char sFileName[1000];
strcpy(sFileName, sRAW_PROJECT_NAME);
switch (TARGET) {
case DREAM : strcat(sFileName,".java"); break;
case STD :
case CUDA : strcat(sFileName,".cpp"); break;
default : strcat(sFileName,".cpp");
......@@ -163,11 +164,13 @@ exponent ([Ee][+-]?[0-9]+)
yyin = fpGenomeFile; // switch to .ez file and analyser
BEGIN COPY_INITIALISATION_FUNCTION;
}
<TEMPLATE_ANALYSIS>"\\INSERT_GENERATION_FUNCTION" {
if (bVERBOSE) printf ("Inserting generation function.\n");
<TEMPLATE_ANALYSIS>"\\INSERT_GENERATION_FUNCTION_BEFORE_REPLACEMENT" {
if (bVERBOSE) printf ("Inserting generation before reduce function.\n");
yyreset();
yyin = fpGenomeFile; // switch to .ez file and analyser
BEGIN COPY_GENERATION_FUNCTION;
bGenerationFunctionBeforeReplacement = true;
BEGIN COPY_GENERATION_FUNCTION_BEFORE_REPLACEMENT;
}
......@@ -193,7 +196,6 @@ exponent ([Ee][+-]?[0-9]+)
}
<TEMPLATE_ANALYSIS>"\\INSERT_BOUND_CHECKING" {
if (bVERBOSE) printf ("Inserting Bound Checking function.\n");
yyreset();
......@@ -208,9 +210,10 @@ exponent ([Ee][+-]?[0-9]+)
yyin = fpGenomeFile; // switch to .ez file and analyser
BEGIN ANALYSE_USER_CLASSES;
}
<TEMPLATE_ANALYSIS>"\\INSERT_USER_CLASSES" {
if (bVERBOSE) printf ("Inserting User classes.\n");
if (TARGET!=DREAM) fprintf (fpOutputFile,"// User classes\n");
fprintf (fpOutputFile,"// User classes\n");
CListItem<CSymbol*> *pSym;
pGENOME->pSymbolList->reset();
while (pSym=pGENOME->pSymbolList->walkToNextItem())
......@@ -238,11 +241,8 @@ exponent ([Ee][+-]?[0-9]+)
pGENOME->pSymbolList->reset();
while (pSym=pGENOME->pSymbolList->walkToNextItem()){
if (pSym->Object->ObjectQualifier==1) continue; // 1=Static
if ((pSym->Object->ObjectType==oArray)&&(TARGET==DREAM))
fprintf(fpOutputFile," %s = new %s[%d];\n",pSym->Object->sName,pSym->Object->pType->sName,pSym->Object->nSize/pSym->Object->pType->nSize);
if (pSym->Object->ObjectType==oPointer){
if (TARGET==DREAM) fprintf(fpOutputFile," %s=null;\n",pSym->Object->sName);
else fprintf(fpOutputFile," %s=NULL;\n",pSym->Object->sName);
fprintf(fpOutputFile," %s=NULL;\n",pSym->Object->sName);
}
}
}
......@@ -277,11 +277,8 @@ exponent ([Ee][+-]?[0-9]+)
while (pSym=pGENOME->pSymbolList->walkToNextItem()){
if (pSym->Object->ObjectQualifier==1) continue; // 1=Static
if ((pSym->Object->ObjectType==oArray)&&(TARGET==DREAM))
fprintf(fpOutputFile," %s = new %s[%d];\n",pSym->Object->sName,pSym->Object->pType->sName,pSym->Object->nSize/pSym->Object->pType->nSize);
if (pSym->Object->ObjectType==oPointer){
if (TARGET==DREAM) fprintf(fpOutputFile," %s=null;\n",pSym->Object->sName);
else fprintf(fpOutputFile," %s=NULL;\n",pSym->Object->sName);
fprintf(fpOutputFile," %s=NULL;\n",pSym->Object->sName);
}
}
......@@ -353,18 +350,6 @@ exponent ([Ee][+-]?[0-9]+)
pGENOME->pSymbolList->reset();
while (pSym=pGENOME->pSymbolList->walkToNextItem()){
if (pSym->Object->ObjectQualifier==1) continue; // 1=Static
if (TARGET==DREAM){
if (pSym->Object->ObjectType==oObject)
fprintf(fpOutputFile," %s=EZ_genome.%s;\n",pSym->Object->sName,pSym->Object->sName);
if (pSym->Object->ObjectType==oPointer)
fprintf(fpOutputFile," %s=((EZ_genome.%s!=null) ? new %s(EZ_genome.%s) : null);\n",pSym->Object->sName,pSym->Object->sName,pSym->Object->pType->sName,pSym->Object->sName);
if (pSym->Object->ObjectType==oArray){
fprintf(fpOutputFile," {for(int EASEA_Ndx=0; EASEA_Ndx<%d; EASEA_Ndx++)\n",pSym->Object->nSize/pSym->Object->pType->nSize);
if (pSym->Object->pType->ObjectType==oUserClass) fprintf(fpOutputFile," this.%s[EASEA_Ndx]=new %s(EZ_genome.%s[EASEA_Ndx]);}\n",pSym->Object->sName, pSym->Object->pType->sName, pSym->Object->sName);
else fprintf(fpOutputFile," this.%s[EASEA_Ndx]=EZ_genome.%s[EASEA_Ndx];}\n",pSym->Object->sName,pSym->Object->sName);
}
}
else {
if (pSym->Object->ObjectType==oObject)
fprintf(fpOutputFile," %s=genome.%s;\n",pSym->Object->sName,pSym->Object->sName);
if (pSym->Object->ObjectType==oPointer)
......@@ -373,7 +358,6 @@ exponent ([Ee][+-]?[0-9]+)
fprintf(fpOutputFile," {for(int EASEA_Ndx=0; EASEA_Ndx<%d; EASEA_Ndx++)\n",pSym->Object->nSize/pSym->Object->pType->nSize);
fprintf(fpOutputFile," %s[EASEA_Ndx]=genome.%s[EASEA_Ndx];}\n",pSym->Object->sName,pSym->Object->sName);
}
}
}
}
......@@ -384,18 +368,6 @@ exponent ([Ee][+-]?[0-9]+)
pGENOME->pSymbolList->reset();
while (pSym=pGENOME->pSymbolList->walkToNextItem()){
if (pSym->Object->ObjectQualifier==1) continue; // 1=Static
if (TARGET==DREAM){
if (pSym->Object->ObjectType==oObject)
fprintf(fpOutputFile," EZ_genome.%s=%s;\n",pSym->Object->sName,pSym->Object->sName);
if (pSym->Object->ObjectType==oPointer)
fprintf(fpOutputFile," EZ_genome.%s=(%s!=null ? new %s(%s) : null);\n",pSym->Object->sName,pSym->Object->sName,pSym->Object->pType->sName,pSym->Object->sName);
if (pSym->Object->ObjectType==oArray){
fprintf(fpOutputFile," {for(int EASEA_Ndx=0; EASEA_Ndx<%d; EASEA_Ndx++)\n",pSym->Object->nSize/pSym->Object->pType->nSize);
if (pSym->Object->pType->ObjectType==oUserClass) fprintf(fpOutputFile," EZ_genome.%s[EASEA_Ndx]=new %s(this.%s[EASEA_Ndx]);}\n",pSym->Object->sName, pSym->Object->pType->sName, pSym->Object->sName);
else fprintf(fpOutputFile," EZ_genome.%s[EASEA_Ndx]=this.%s[EASEA_Ndx];}\n",pSym->Object->sName, pSym->Object->sName);
}
}
else {
if (pSym->Object->ObjectType==oObject)
fprintf(fpOutputFile," %s=genome.%s;\n",pSym->Object->sName,pSym->Object->sName);
if (pSym->Object->ObjectType==oPointer)
......@@ -404,7 +376,6 @@ exponent ([Ee][+-]?[0-9]+)
fprintf(fpOutputFile," {for(int EASEA_Ndx=0; EASEA_Ndx<%d; EASEA_Ndx++)\n",pSym->Object->nSize/pSym->Object->pType->nSize);
fprintf(fpOutputFile," %s[EASEA_Ndx]=genome.%s[EASEA_Ndx];}\n",pSym->Object->sName,pSym->Object->sName);
}
}
}
}
<TEMPLATE_ANALYSIS>"\\GENOME_DTOR" {
......@@ -414,8 +385,7 @@ exponent ([Ee][+-]?[0-9]+)
pGENOME->pSymbolList->reset();
while (pSym=pGENOME->pSymbolList->walkToNextItem())
if (pSym->Object->ObjectType==oPointer){
if (TARGET==DREAM) fprintf(fpOutputFile," if (%s) delete %s;\n %s=null;\n",pSym->Object->sName,pSym->Object->sName,pSym->Object->sName);
else fprintf(fpOutputFile," if (%s) delete %s;\n %s=NULL;\n",pSym->Object->sName,pSym->Object->sName,pSym->Object->sName);
fprintf(fpOutputFile," if (%s) delete %s;\n %s=NULL;\n",pSym->Object->sName,pSym->Object->sName,pSym->Object->sName);
}
}
<TEMPLATE_ANALYSIS>"\\EQUAL" {
......@@ -457,26 +427,6 @@ exponent ([Ee][+-]?[0-9]+)
pGENOME->pSymbolList->reset();
while (pSym=pGENOME->pSymbolList->walkToNextItem()){
if (pSym->Object->ObjectQualifier==1) continue; // 1=Static
if (TARGET==GALIB) {
if ((pSym->Object->ObjectType==oObject)&&(strcmp(pSym->Object->pType->sName, "bool")))
fprintf(fpOutputFile," is >> %s;\n",pSym->Object->sName);
if ((pSym->Object->ObjectType==oArray)&&(strcmp(pSym->Object->pType->sName, "bool"))){
fprintf(fpOutputFile," {for(int EASEA_Ndx=0; EASEA_Ndx<%d; EASEA_Ndx++)\n",pSym->Object->nSize/pSym->Object->pType->nSize);
fprintf(fpOutputFile," is >> %s[EASEA_Ndx];}\n",pSym->Object->sName);
}
if (pSym->Object->ObjectType==oPointer)
fprintf(fpOutputFile," is >> *%s;\n",pSym->Object->sName);
}
if (TARGET==EO) {
if (pSym->Object->ObjectType==oObject)
fprintf(fpOutputFile," is >> %s;\n",pSym->Object->sName);
if (pSym->Object->ObjectType==oArray){
fprintf(fpOutputFile," {for(int EASEA_Ndx=0; EASEA_Ndx<%d; EASEA_Ndx++)\n",pSym->Object->nSize/pSym->Object->pType->nSize);
fprintf(fpOutputFile," is >> %s[EASEA_Ndx];}\n",pSym->Object->sName);
}
if (pSym->Object->ObjectType==oPointer)
fprintf(fpOutputFile," is >> *(%s);\n",pSym->Object->sName);
}
}
}
<TEMPLATE_ANALYSIS>"\\INSERT_DISPLAY" {
......@@ -502,51 +452,20 @@ exponent ([Ee][+-]?[0-9]+)
pGENOME->pSymbolList->reset();
while (pSym=pGENOME->pSymbolList->walkToNextItem()){
if (pSym->Object->ObjectQualifier==1) continue; // 1=Static
if (TARGET==DREAM) {
if (pSym->Object->ObjectType==oObject){
if (bDisplayFunction) printf("//");
fprintf(fpOutputFile," EASEA_S = EASEA_S + \"%s:\" + %s + \"\\n\";\n",pSym->Object->sName,pSym->Object->sName);
}
if (pSym->Object->ObjectType==oArray){
if (bDisplayFunction) printf("//");
fprintf(fpOutputFile," {EASEA_S = \"Array %s : \";\n",pSym->Object->sName);
if (bDisplayFunction) printf("//");
fprintf(fpOutputFile," for(int EASEA_Ndx=0; EASEA_Ndx<%d; EASEA_Ndx++)\n",pSym->Object->nSize/pSym->Object->pType->nSize);
if (bDisplayFunction) printf("//");
fprintf(fpOutputFile," EASEA_S = EASEA_S + \"\\t\"+ %s[EASEA_Ndx];}\n",pSym->Object->sName);
if (bDisplayFunction) printf("//");
fprintf(fpOutputFile," os << \"\\n\";\n",pSym->Object->sName);
}
if (pSym->Object->ObjectType==oPointer){
if (bDisplayFunction) printf("//");
fprintf(fpOutputFile," if (%s!=null) EASEA_S = EASEA_S + \"%s:\" + %s + \"\\n\";\n",pSym->Object->sName,pSym->Object->sName,pSym->Object->sName);
}
}
else {
if (pSym->Object->ObjectType==oObject){
if (bDisplayFunction) printf("//");
if (TARGET==GALIB) fprintf(fpOutputFile," os << \"%s:\" << %s << \"\\n\";\n",pSym->Object->sName,pSym->Object->sName);
if (TARGET==EO) fprintf(fpOutputFile," os << \"%s:\" << %s << \"\\n\";\n",pSym->Object->sName,pSym->Object->sName);
}
if (pSym->Object->ObjectType==oArray){
if (bDisplayFunction) printf("//");
if (TARGET == GALIB) fprintf(fpOutputFile," {os << \"Array %s : \";\n",pSym->Object->sName);
if (TARGET == DREAM) fprintf(fpOutputFile," {EASEA_S = \"Array %s : \";\n",pSym->Object->sName);
if (TARGET == EO) fprintf(fpOutputFile," {",pSym->Object->sName);
if (bDisplayFunction) printf("//");
fprintf(fpOutputFile," for(int EASEA_Ndx=0; EASEA_Ndx<%d; EASEA_Ndx++)\n",pSym->Object->nSize/pSym->Object->pType->nSize);
if (bDisplayFunction) printf("//");
if (TARGET==GALIB) fprintf(fpOutputFile," os << \"[\" << EASEA_Ndx << \"]:\" << %s[EASEA_Ndx] << \"\\t\";}\n",pSym->Object->sName);
if (TARGET==EO) fprintf(fpOutputFile," os << %s[EASEA_Ndx];}\n",pSym->Object->sName);
if (TARGET==DREAM) fprintf(fpOutputFile," EASEA_S = EASEA_S + \"\\t\"+ %s[EASEA_Ndx];}\n",pSym->Object->sName);
if (bDisplayFunction) printf("//");
if (TARGET!=DREAM) fprintf(fpOutputFile," os << \"\\n\";\n",pSym->Object->sName);
}
if (pSym->Object->ObjectType==oPointer){
if (bDisplayFunction) printf("//");
if (TARGET==GALIB) fprintf(fpOutputFile," os << \"%s:\" << *%s << \"\\n\";\n",pSym->Object->sName,pSym->Object->sName);
if (TARGET==EO) fprintf(fpOutputFile," os << \"%s:\" << *%s << \"\\n\";\n",pSym->Object->sName,pSym->Object->sName);
}
}
}
}
}
......@@ -606,13 +525,11 @@ exponent ([Ee][+-]?[0-9]+)
BEGIN PARAMETERS_ANALYSIS;
}
<TEMPLATE_ANALYSIS>"\\INSERT_GEN_FCT_CALL" {
if (bGenerationFunction) {
if (bGenerationReplacementFunction) {
if( bVERBOSE ) fprintf(stdout,"Inserting generation function call\n");
if( TARGET==CUDA || TARGET==STD ){
fprintf(fpOutputFile,"\n\tEASEAGenerationFunction(this);");
}
else fprintf(fpOutputFile,"\n EASEAGenerationFunction(ga);\n");
}
}
......@@ -677,8 +594,14 @@ exponent ([Ee][+-]?[0-9]+)
}
else fprintf(fpOutputFile,"%s",sSELECTOR);
}
//<TEMPLATE_ANALYSIS>"\\GEN_SELECTOR" {fprintf(fpOutputFile,"%s(%s,%d)",sGEN_SELECTOR);}
<TEMPLATE_ANALYSIS>"\\SELECT_PRM" {fprintf(fpOutputFile,"%s",sSELECT_PRM);}
<TEMPLATE_ANALYSIS>"\\SELECTOR_OPERATOR" {fprintf(fpOutputFile,"%s",sSELECTOR_OPERATOR);}
<TEMPLATE_ANALYSIS>"\\SELECT_PRM" {fprintf(fpOutputFile,"%f",fSELECT_PRM);}
<TEMPLATE_ANALYSIS>"\\RED_PAR_OPERATOR" {fprintf(fpOutputFile,"%s",sRED_PAR_OPERATOR);}
<TEMPLATE_ANALYSIS>"\\RED_PAR_PRM" {fprintf(fpOutputFile,"%f",fRED_PAR_PRM);}
<TEMPLATE_ANALYSIS>"\\RED_OFF_OPERATOR" {fprintf(fpOutputFile,"%s",sRED_OFF_OPERATOR);}
<TEMPLATE_ANALYSIS>"\\RED_OFF_PRM" {fprintf(fpOutputFile,"%f",fRED_OFF_PRM);}
<TEMPLATE_ANALYSIS>"\\RED_FINAL_OPERATOR" {fprintf(fpOutputFile,"%s",sRED_FINAL_OPERATOR);}
<TEMPLATE_ANALYSIS>"\\RED_FINAL_PRM" {fprintf(fpOutputFile,"%f",fRED_FINAL_PRM);}
<TEMPLATE_ANALYSIS>"\\POP_SIZE" {fprintf(fpOutputFile,"%d",nPOP_SIZE);}
<TEMPLATE_ANALYSIS>"\\OFF_SIZE" {fprintf(fpOutputFile,"%d",nOFF_SIZE);}
<TEMPLATE_ANALYSIS>"\\ELITE_SIZE" {
......@@ -699,12 +622,6 @@ exponent ([Ee][+-]?[0-9]+)
}
else fprintf(fpOutputFile,"%s",sRED_PAR);
}
<TEMPLATE_ANALYSIS>"\\RED_PAR_PRM" {
if( (TARGET==CUDA || TARGET==STD) && strlen(sRED_PAR_PRM)==0)
fprintf(fpOutputFile,"0");
else
fprintf(fpOutputFile,"%s",sRED_PAR_PRM);
}
<TEMPLATE_ANALYSIS>"\\RED_OFF" {
if( TARGET==CUDA || TARGET==STD){
//DEBUG_PRT_PRT("Offspring reduction is \"%s\" | Goal is %s",sSELECTOR,(nMINIMISE?"Minimize":"Maximize"));
......@@ -718,11 +635,6 @@ exponent ([Ee][+-]?[0-9]+)
}
else fprintf(fpOutputFile,"%s",sRED_OFF);
}
<TEMPLATE_ANALYSIS>"\\RED_OFF_PRM" {
if( (TARGET==CUDA || TARGET==STD ) && strlen(sRED_OFF_PRM)==0 )
fprintf(fpOutputFile,"0");
else
fprintf(fpOutputFile,"%s",sRED_OFF_PRM);}
<TEMPLATE_ANALYSIS>"\\RED_FINAL" {
if( TARGET==CUDA || TARGET==STD){
//DEBUG_PRT_PRT("Replacement selector is \"%s\" | Goal is %s",sRED_FINAL,(nMINIMISE?"Minimize":"Maximize"));
......@@ -740,66 +652,32 @@ exponent ([Ee][+-]?[0-9]+)
if(OPERATING_SYSTEM=WINDOWS)
fprintf(fpOutputFile,"%s\\",getenv("NVSDKCUDA_ROOT"));
}
<TEMPLATE_ANALYSIS>"\\RED_FINAL_PRM" {fprintf(fpOutputFile,"%s",sRED_FINAL_PRM);}
<TEMPLATE_ANALYSIS>"\\SURV_PAR_SIZE" {fprintf(fpOutputFile,"%d",nSURV_PAR_SIZE);}
<TEMPLATE_ANALYSIS>"\\SURV_OFF_SIZE" {fprintf(fpOutputFile,"%d",nSURV_OFF_SIZE);}
<TEMPLATE_ANALYSIS>"\\SURV_PAR_SIZE" {if(fSURV_PAR_SIZE>=0.0)fprintf(fpOutputFile,"%f",fSURV_PAR_SIZE); else fprintf(fpOutputFile,"%f",(float)nPOP_SIZE);}
<TEMPLATE_ANALYSIS>"\\SURV_OFF_SIZE" {if(fSURV_OFF_SIZE>=0.0)fprintf(fpOutputFile,"%f",fSURV_OFF_SIZE); else fprintf(fpOutputFile,"%f",(float)nOFF_SIZE);}
<TEMPLATE_ANALYSIS>"\\GENOME_NAME" {fprintf(fpOutputFile,"%s",nGENOME_NAME);}
<TEMPLATE_ANALYSIS>"\\PROBLEM_DIM" {fprintf(fpOutputFile,"%d",nPROBLEM_DIM);}
<TEMPLATE_ANALYSIS>"\\NB_GEN" {fprintf(fpOutputFile,"%d",nNB_GEN);}
<TEMPLATE_ANALYSIS>"\\NB_ISLANDS" {fprintf(fpOutputFile,"%d",nNB_ISLANDS);}
<TEMPLATE_ANALYSIS>"\\PROP_OR_SEQ" {fprintf(fpOutputFile,"%s",bPROP_SEQ?"Prop":"Seq");}
<TEMPLATE_ANALYSIS>"\\MUT_PROB" {if (TARGET==GALIB)fprintf(fpOutputFile,"(float)%f",fMUT_PROB);
else fprintf(fpOutputFile,"%f",fMUT_PROB);}
<TEMPLATE_ANALYSIS>"\\XOVER_PROB" {if (TARGET==GALIB)fprintf(fpOutputFile,"(float)%f",fXOVER_PROB);
else fprintf(fpOutputFile,"%f",fXOVER_PROB);}
<TEMPLATE_ANALYSIS>"\\REPLACEMENT" {fprintf(fpOutputFile,"%s",sREPLACEMENT);}
<TEMPLATE_ANALYSIS>"\\REPL_PERC" {fprintf(fpOutputFile,"(float)%f/100",fREPL_PERC);}
<TEMPLATE_ANALYSIS>"\\DISCARD_PRM" {fprintf(fpOutputFile,"%s",sDISCARD_PRM);}
<TEMPLATE_ANALYSIS>"\\STEADYSTATE" {if ((fREPL_PERC==0)||(!strcmp(sREPLACEMENT,"Incremental"))||(!strcmp(sREPLACEMENT,"Simple")))
fprintf(fpOutputFile,"// undefined ");}
<TEMPLATE_ANALYSIS>"\\COMMENT" {if (mystricmp(sREPLACEMENT,"SSGA")) fprintf(fpOutputFile,"//");}
<TEMPLATE_ANALYSIS>"\\TIME_LIMIT" {fprintf(fpOutputFile,"%d",nTIME_LIMIT);}
<TEMPLATE_ANALYSIS>"\\MUT_PROB" {fprintf(fpOutputFile,"%f",fMUT_PROB);}
<TEMPLATE_ANALYSIS>"\\XOVER_PROB" {fprintf(fpOutputFile,"%f",fXOVER_PROB);}
<TEMPLATE_ANALYSIS>"\\MINIMAXI" {
switch (TARGET) {
case GALIB : fprintf(fpOutputFile,"%d",nMINIMISE? -1:1); break;
case EO : fprintf(fpOutputFile,"%s",nMINIMISE? "eoMinimizingFitness" : "eoMaximizingFitness"); break;
//case DREAM : fprintf(fpOutputFile,"%s",nMINIMISE? "false" : "true"); break;
case DREAM : fprintf(fpOutputFile,"%s",nMINIMISE? "true" : "false"); break;
case STD:
//case CUDA: fprintf(fpOutputFile,"%s",(nMINIMISE? "false" : "true")); break;
case CUDA: fprintf(fpOutputFile,"%s",(nMINIMISE? "true" : "false")); break;
}
}
<TEMPLATE_ANALYSIS>"\\ELITIST_REPLACE_NAME" {if (TARGET==EO) {if (bELITISM) fprintf(fpOutputFile,"standardR");
else fprintf(fpOutputFile,"r");}}
<TEMPLATE_ANALYSIS>"\\ELITISM" {
switch (TARGET) {
case GALIB : if (!mystricmp(sREPLACEMENT,"simple"))
if (bELITISM) fprintf(fpOutputFile," ga.elitist(gaTrue);\n");
else fprintf(fpOutputFile," ga.elitist(gaFalse);\n");
break;
case EO : fprintf(fpOutputFile,"%d",bELITISM);
break;
case STD:
case CUDA: fprintf(fpOutputFile,"%d",bELITISM);
} }
<TEMPLATE_ANALYSIS>"\\IMMIG_SEL" {fprintf(fpOutputFile,"%s",sIMMIG_SEL);}
<TEMPLATE_ANALYSIS>"\\IMMIG_REPL" {fprintf(fpOutputFile,"%d",nIMMIG_REPL);}
<TEMPLATE_ANALYSIS>"\\MIGRATOR" {fprintf(fpOutputFile,"%s",sMIGRATOR);}
<TEMPLATE_ANALYSIS>"\\MIG_SEL" {fprintf(fpOutputFile,"%s",sMIG_SEL);}
<TEMPLATE_ANALYSIS>"\\MIG_CLONE" {fprintf(fpOutputFile,"%d",nMIG_CLONE);}
<TEMPLATE_ANALYSIS>"\\NB_MIG" {fprintf(fpOutputFile,"%d",nNB_MIG);}
<TEMPLATE_ANALYSIS>"\\MIG_FREQ" {fprintf(fpOutputFile,"%f",fMIG_FREQ);}
<TEMPLATE_ANALYSIS>"\\MIG_TARGET_SELECTOR" {fprintf(fpOutputFile,"%s",sMIG_TARGET_SELECTOR);}
<TEMPLATE_ANALYSIS>"\\START_EO_GENOME_H_TPL" {
char sFileName[1000];
fclose(fpOutputFile);
strcpy(sFileName, sRAW_PROJECT_NAME);
strcat(sFileName,"Genome.h");
fpOutputFile=fopen(sFileName,"w");
if (bVERBOSE) printf("Creating %s...\n",sFileName);
}
<TEMPLATE_ANALYSIS>"\\PRINT_STATS" {fprintf(fpOutputFile,"%d",bPRINT_STATS);}
<TEMPLATE_ANALYSIS>"\\PLOT_STATS" {fprintf(fpOutputFile,"%d",bPLOT_STATS);}
<TEMPLATE_ANALYSIS>"\\GENERATE_CVS_FILE" {fprintf(fpOutputFile,"%d",bGENERATE_CVS_FILE);}
<TEMPLATE_ANALYSIS>"\\GENERATE_GNUPLOT_SCRIPT" {fprintf(fpOutputFile,"%d",bGENERATE_GNUPLOT_SCRIPT);}
<TEMPLATE_ANALYSIS>"\\GENERATE_R_SCRIPT" {fprintf(fpOutputFile,"%d",bGENERATE_R_SCRIPT);}
<TEMPLATE_ANALYSIS>"\\START_CUDA_GENOME_H_TPL" {
char sFileName[1000];
......@@ -809,17 +687,6 @@ if(OPERATING_SYSTEM=WINDOWS)
fpOutputFile=fopen(sFileName,"w");
if (bVERBOSE) printf("Creating %s...\n",sFileName);
}
<TEMPLATE_ANALYSIS>"\\START_CUDA_USER_CLASSES_H_TPL" {
char sFileName[1000];
fclose(fpOutputFile);
strcpy(sFileName, sRAW_PROJECT_NAME);
strcat(sFileName,"UserClasses.hpp");
fpOutputFile=fopen(sFileName,"w");
if (bVERBOSE) printf("Creating %s...\n",sFileName);
}
<TEMPLATE_ANALYSIS>"\\START_CUDA_GENOME_CU_TPL" {
char sFileName[1000];
fclose(fpOutputFile);
......@@ -831,101 +698,6 @@ if(OPERATING_SYSTEM=WINDOWS)
fpOutputFile=fopen(sFileName,"w");
if (bVERBOSE) printf("Creating %s...\n",sFileName);
}
<TEMPLATE_ANALYSIS>"\\START_CUDA_TOOLS_CPP_TPL" {
char sFileName[1000];
fclose(fpOutputFile);
strcpy(sFileName, sRAW_PROJECT_NAME);
strcat(sFileName,"Tools.cpp");
fpOutputFile=fopen(sFileName,"w");
if (bVERBOSE) printf("Creating %s...\n",sFileName);
}
<TEMPLATE_ANALYSIS>"\\START_CUDA_TOOLS_H_TPL" {
char sFileName[1000];
fclose(fpOutputFile);
strcpy(sFileName, sRAW_PROJECT_NAME);
strcat(sFileName,"Tools.hpp");
fpOutputFile=fopen(sFileName,"w");
if (bVERBOSE) printf("Creating %s...\n",sFileName);
}
<TEMPLATE_ANALYSIS>"\\START_CUDA_POPULATION_CPP_TPL" {
char sFileName[1000];
fclose(fpOutputFile);
strcpy(sFileName, sRAW_PROJECT_NAME);
strcat(sFileName,"Population.cpp");
fpOutputFile=fopen(sFileName,"w");
if (bVERBOSE) printf("Creating %s...\n",sFileName);
}
<TEMPLATE_ANALYSIS>"\\START_CUDA_POPULATION_H_TPL" {
char sFileName[1000];
fclose(fpOutputFile);
strcpy(sFileName, sRAW_PROJECT_NAME);
strcat(sFileName,"Population.hpp");
fpOutputFile=fopen(sFileName,"w");
if (bVERBOSE) printf("Creating %s...\n",sFileName);
}
<TEMPLATE_ANALYSIS>"\\START_EO_EVAL_TPL" {
char sFileName[1000];
fclose(fpOutputFile);
strcpy(sFileName, sRAW_PROJECT_NAME);
strcat(sFileName,"EvalFunc.h");
if (bVERBOSE) printf("Creating %s...\n",sFileName);
fpOutputFile=fopen(sFileName,"w");
}
<TEMPLATE_ANALYSIS>"\\START_EO_INITER_TPL" {
char sFileName[1000];
fclose(fpOutputFile);
strcpy(sFileName, sRAW_PROJECT_NAME);
strcat(sFileName,"Init.h");
if (bVERBOSE) printf("Creating %s...\n",sFileName);
fpOutputFile=fopen(sFileName,"w");
}
<TEMPLATE_ANALYSIS>"\\START_EO_MUT_TPL" {
char sFileName[1000];
fclose(fpOutputFile);
strcpy(sFileName, sRAW_PROJECT_NAME);
strcat(sFileName,"Mutation.h");
if (bVERBOSE) printf("Creating %s...\n",sFileName);
fpOutputFile=fopen(sFileName,"w");
}
<TEMPLATE_ANALYSIS>"\\START_EO_QUAD_XOVER_TPL" {
char sFileName[1000];
fclose(fpOutputFile);
strcpy(sFileName, sRAW_PROJECT_NAME);
strcat(sFileName,"QuadCrossover.h");
if (bVERBOSE) printf("Creating %s...\n",sFileName);
fpOutputFile=fopen(sFileName,"w");
}
<TEMPLATE_ANALYSIS>"\\START_EO_CONTINUE_TPL" {
char sFileName[1000];
fclose(fpOutputFile);
strcpy(sFileName, sRAW_PROJECT_NAME);
strcat(sFileName,"_make_continue.h");
if (bVERBOSE) printf("Creating %s...\n",sFileName);
fpOutputFile=fopen(sFileName,"w");
}
<TEMPLATE_ANALYSIS>"\\START_EO_MAKE_GENOTYPE_TPL" {
char sFileName[1000];
fclose(fpOutputFile);
strcpy(sFileName, sRAW_PROJECT_NAME);
strcat(sFileName,"_make_genotype.h");
if (bVERBOSE) printf("Creating %s...\n",sFileName);
fpOutputFile=fopen(sFileName,"w");
}
<TEMPLATE_ANALYSIS>"\\START_EO_MAKE_OPERATORS_TPL" {
char sFileName[1000];
fclose(fpOutputFile);
strcpy(sFileName, sRAW_PROJECT_NAME);
strcat(sFileName,"_make_operators.h");
if (bVERBOSE) printf("Creating %s...\n",sFileName);
fpOutputFile=fopen(sFileName,"w");
}
<TEMPLATE_ANALYSIS>"\\START_EO_PARAM_TPL" {
char sFileName[1000];
fclose(fpOutputFile);
......@@ -989,15 +761,16 @@ if(OPERATING_SYSTEM=WINDOWS)
// create a symbolic link from Makefile to EASEA.mak
#ifndef WIN32
symlink(sFullFileName,sPathName);
#endif
}
else{
//DEBUG_PRT_PRT("file name : %s",sFileName);
#ifndef WIN32
if( symlink(sFileName,"Makefile") ) perror("Symlink creation error ");
#endif
}
if (bVERBOSE){
printf("Creating %s...\n",sFileName);
printf("Creating %s symbolic link...\n",sPathName);
......@@ -1008,88 +781,11 @@ if(OPERATING_SYSTEM=WINDOWS)
exit(-1);
}
}
<TEMPLATE_ANALYSIS>"\\START_EVAL_TPL" {
char sFileName[1000];
fclose(fpOutputFile);
strcpy(sFileName, sRAW_PROJECT_NAME);
strcat(sFileName,"Evaluator.java");
if (bVERBOSE) printf("Creating %s...\n",sFileName);
fpOutputFile=fopen(sFileName,"w");
}
<TEMPLATE_ANALYSIS>"\\START_INITER_TPL" {
char sFileName[1000];
fclose(fpOutputFile);
strcpy(sFileName, sRAW_PROJECT_NAME);
strcat(sFileName,"Initer.java");
fpOutputFile=fopen(sFileName,"w");
if (bVERBOSE) printf("Creating %s...\n",sFileName);
}
<TEMPLATE_ANALYSIS>"\\START_GENOME_TPL" {
char sFileName[1000];
fclose(fpOutputFile);
strcpy(sFileName, sRAW_PROJECT_NAME);
strcat(sFileName,"Genome.java");
fpOutputFile=fopen(sFileName,"w");
if (bVERBOSE) printf("Creating %s...\n",sFileName);
}
<TEMPLATE_ANALYSIS>"\\START_MUT_TPL" {
char sFileName[1000];
fclose(fpOutputFile);
strcpy(sFileName, sRAW_PROJECT_NAME);
strcat(sFileName,"Mutator.java");
if (bVERBOSE) printf("Creating %s...\n",sFileName);
fpOutputFile=fopen(sFileName,"w");
}
<TEMPLATE_ANALYSIS>"\\START_RECOMB_TPL" {
char sFileName[1000];
fclose(fpOutputFile);
strcpy(sFileName, sRAW_PROJECT_NAME);
strcat(sFileName,"Recombine.java");
if (bVERBOSE) printf("Creating %s...\n",sFileName);
fpOutputFile=fopen(sFileName,"w");
}
<TEMPLATE_ANALYSIS>"\\START_IHDEF_TPL" {
char sFileName[1000];
fclose(fpOutputFile);
strcpy(sFileName, sRAW_PROJECT_NAME);
strcat(sFileName,"IHDefIniter.java");
if (bVERBOSE) printf("Creating %s...\n",sFileName);
fpOutputFile=fopen(sFileName,"w");
}
<TEMPLATE_ANALYSIS>"\\START_FITINIT_TPL" {
char sFileName[1000];
fclose(fpOutputFile);
strcpy(sFileName, sRAW_PROJECT_NAME);
strcat(sFileName,"FitnessIniter.java");
if (bVERBOSE) printf("Creating %s...\n",sFileName);
fpOutputFile=fopen(sFileName,"w");
}
<TEMPLATE_ANALYSIS>"\\START_ISLAND_TPL" {
char sFileName[1000];
fclose(fpOutputFile);
strcpy(sFileName, sRAW_PROJECT_NAME);
strcat(sFileName,"Island.java");
if (bVERBOSE) printf("Creating %s...\n",sFileName);
fpOutputFile=fopen(sFileName,"w");
}
<TEMPLATE_ANALYSIS>"\\TEMPLATE_END" {
if (nWARNINGS) printf ("\nWARNING !!!\nTarget file(s) generation went through WITH %d WARNING(S) !\n",nWARNINGS);
else printf ("\nCONGRATULATIONS !!!\nTarget file(s) generation succeeded with no warning.\n");
if (OPERATING_SYSTEM==UNIX){
if (TARGET==GALIB) {
printf ("\nYou may now compile your file with:\n");
printf ("\ng++ %s.cpp -o %s %sgdc.o %sgdchart.o %sprice_conv.o -lga -L%sgdchart0.94b/gd1.3 -lgd -lm\n\n",sPROJECT_NAME,sPROJECT_NAME,sEZ_PATH,sEZ_PATH,sEZ_PATH,sEZ_PATH);
}
if (TARGET==EO) {
printf ("\nYou may now compile your file with:\n");
printf ("\nmake -f %s.mak\n\n",sPROJECT_NAME);
printf ("and run it with:\n\n",sPROJECT_NAME);
printf ("%s @%s.prm\n\n",sPROJECT_NAME,sPROJECT_NAME);
} }
printf ("Have a nice compile time.\n");
if (TARGET==EO || TARGET==CUDA || TARGET==STD) fprintf(fpOutputFile,"\n# That's all folks ! \n");
if (TARGET==CUDA || TARGET==STD) fprintf(fpOutputFile,"\n# That's all folks ! \n");
else fprintf(fpOutputFile,"\n// That's all folks ! \n");
fflush(fpOutputFile);
fclose(fpOutputFile);
......@@ -1143,10 +839,7 @@ if(OPERATING_SYSTEM=WINDOWS)
}
<COPY_USER_FUNCTIONS>.|\n {}
<COPY_INITIALISATION_FUNCTION>"\\before"[ \t\n]+"everything"[ \t\n]+"else"[ \t\n]+"function"[ \t\n]*":" {
if (TARGET==DREAM)
fprintf (fpOutputFile,"// Evaluator Constructor\n\n public %sEvaluator(){",sPROJECT_NAME);
else
<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[]){");
bFunction=1; bInitFunction=1;