Commit eb7e004a authored by kruger's avatar kruger

correction des bug du gnuplot

parent 9b2022e6
This diff is collapsed.
...@@ -134,11 +134,7 @@ exponent ([Ee][+-]?[0-9]+) ...@@ -134,11 +134,7 @@ exponent ([Ee][+-]?[0-9]+)
<TEMPLATE_ANALYSIS>"\\TEMPLATE_START" { <TEMPLATE_ANALYSIS>"\\TEMPLATE_START" {
char sFileName[1000]; char sFileName[1000];
strcpy(sFileName, sRAW_PROJECT_NAME); strcpy(sFileName, sRAW_PROJECT_NAME);
switch (TARGET) { strcat(sFileName,".cpp");
case STD :
case CUDA : strcat(sFileName,".cpp"); break;
default : strcat(sFileName,".cpp");
}
fpOutputFile=fopen(sFileName,"w"); fpOutputFile=fopen(sFileName,"w");
} }
<TEMPLATE_ANALYSIS>"AESAE" {fprintf(fpOutputFile,"EASEA");} <TEMPLATE_ANALYSIS>"AESAE" {fprintf(fpOutputFile,"EASEA");}
...@@ -728,18 +724,8 @@ if(OPERATING_SYSTEM=WINDOWS) ...@@ -728,18 +724,8 @@ if(OPERATING_SYSTEM=WINDOWS)
<TEMPLATE_ANALYSIS>"\\TIME_LIMIT" {fprintf(fpOutputFile,"%d",nTIME_LIMIT);} <TEMPLATE_ANALYSIS>"\\TIME_LIMIT" {fprintf(fpOutputFile,"%d",nTIME_LIMIT);}
<TEMPLATE_ANALYSIS>"\\MUT_PROB" {fprintf(fpOutputFile,"%f",fMUT_PROB);} <TEMPLATE_ANALYSIS>"\\MUT_PROB" {fprintf(fpOutputFile,"%f",fMUT_PROB);}
<TEMPLATE_ANALYSIS>"\\XOVER_PROB" {fprintf(fpOutputFile,"%f",fXOVER_PROB);} <TEMPLATE_ANALYSIS>"\\XOVER_PROB" {fprintf(fpOutputFile,"%f",fXOVER_PROB);}
<TEMPLATE_ANALYSIS>"\\MINIMAXI" { <TEMPLATE_ANALYSIS>"\\MINIMAXI" {fprintf(fpOutputFile,"%s",(nMINIMISE? "true" : "false")); }
switch (TARGET) { <TEMPLATE_ANALYSIS>"\\ELITISM" {fprintf(fpOutputFile,"%d",bELITISM);}
case STD:
//case CUDA: fprintf(fpOutputFile,"%s",(nMINIMISE? "false" : "true")); break;
case CUDA: fprintf(fpOutputFile,"%s",(nMINIMISE? "true" : "false")); break;
}
}
<TEMPLATE_ANALYSIS>"\\ELITISM" {
switch (TARGET) {
case STD:
case CUDA: fprintf(fpOutputFile,"%d",bELITISM);
} }
<TEMPLATE_ANALYSIS>"\\NB_OPT_IT" {fprintf(fpOutputFile,"%d",nNB_OPT_IT);} <TEMPLATE_ANALYSIS>"\\NB_OPT_IT" {fprintf(fpOutputFile,"%d",nNB_OPT_IT);}
<TEMPLATE_ANALYSIS>"\\BALDWINISM" {fprintf(fpOutputFile,"%d",bBALDWINISM);} <TEMPLATE_ANALYSIS>"\\BALDWINISM" {fprintf(fpOutputFile,"%d",bBALDWINISM);}
...@@ -943,16 +929,7 @@ if(OPERATING_SYSTEM=WINDOWS) ...@@ -943,16 +929,7 @@ if(OPERATING_SYSTEM=WINDOWS)
// Easea GPGPU & EO Finalization function // Easea GPGPU & EO Finalization function
//**************************************** //****************************************
<COPY_FINALIZATION_FUNCTION>"\\After"[ \t\n]+"everything"[ \t\n]+"else"[ \t\n]+"function"[ \t\n]*":" { <COPY_FINALIZATION_FUNCTION>"\\After"[ \t\n]+"everything"[ \t\n]+"else"[ \t\n]+"function"[ \t\n]*":" {
switch( TARGET ){ fprintf (fpOutputFile,"// Finalization function\nvoid EASEAFinalization(CPopulation* population){");
case STD:
case CUDA:
fprintf (fpOutputFile,"// Finalization function\nvoid EASEAFinalization(CPopulation* population){");
break;
default:
fprintf (stderr," Error this template doesn't support finalization function ");
return -1;
}
bFunction=1; bFinalizationFunction=1; bFunction=1; bFinalizationFunction=1;
BEGIN COPY; BEGIN COPY;
} }
...@@ -1421,38 +1398,24 @@ if(OPERATING_SYSTEM=WINDOWS) ...@@ -1421,38 +1398,24 @@ if(OPERATING_SYSTEM=WINDOWS)
<COPY_USER_GENERATION>"currentGeneration" | <COPY_USER_GENERATION>"currentGeneration" |
<COPY_USER_GENERATION>"currentGeneration"/[ \t\n]*"==" { <COPY_USER_GENERATION>"currentGeneration"/[ \t\n]*"==" {
if (bDoubleQuotes) fprintf(fpOutputFile,"currentGeneration"); if (bDoubleQuotes) fprintf(fpOutputFile,"currentGeneration");
else switch (TARGET) { else {
case CUDA: fprintf(fpOutputFile,"(*EZ_current_generation)");}} // local genome name
case STD:
fprintf(fpOutputFile,"(*EZ_current_generation)");
break;
}} // local genome name
<COPY_USER_GENERATION>"NB_GEN" | <COPY_USER_GENERATION>"NB_GEN" |
<COPY_USER_GENERATION>"NB_GEN"/[ \t\n]*"==" {if (bDoubleQuotes) fprintf(fpOutputFile,"NB_GEN"); <COPY_USER_GENERATION>"NB_GEN"/[ \t\n]*"==" {if (bDoubleQuotes) fprintf(fpOutputFile,"NB_GEN");
else switch (TARGET) { else {fprintf(fpOutputFile,"(*EZ_NB_GEN)"); }} // local genome name
case STD :
case CUDA :
fprintf(fpOutputFile,"(*EZ_NB_GEN)");
break;
}} // local genome name
<COPY_USER_GENERATION>"POP_SIZE" | <COPY_USER_GENERATION>"POP_SIZE" |
<COPY_USER_GENERATION>"POP_SIZE"/[ \t\n]*"==" {if (bDoubleQuotes) fprintf(fpOutputFile,"POP_SIZE"); <COPY_USER_GENERATION>"POP_SIZE"/[ \t\n]*"==" {if (bDoubleQuotes) fprintf(fpOutputFile,"POP_SIZE");
} // local genome name } // local genome name
<COPY_USER_GENERATION>"MUT_PROB" | <COPY_USER_GENERATION>"MUT_PROB" |
<COPY_USER_GENERATION>"MUT_PROB"/[ \t\n]*"==" { <COPY_USER_GENERATION>"MUT_PROB"/[ \t\n]*"==" {
if (bDoubleQuotes) fprintf(fpOutputFile,"MUT_PROB"); if (bDoubleQuotes) fprintf(fpOutputFile,"MUT_PROB");
else switch (TARGET) { else {fprintf(fpOutputFile,"(*pEZ_MUT_PROB)");
case STD:
case CUDA:
fprintf(fpOutputFile,"(*pEZ_MUT_PROB)");
} }
} // local genome name } // local genome name
<COPY_USER_GENERATION>"XOVER_PROB" | <COPY_USER_GENERATION>"XOVER_PROB" |
<COPY_USER_GENERATION>"XOVER_PROB"/[ \t\n]*"==" { <COPY_USER_GENERATION>"XOVER_PROB"/[ \t\n]*"==" {
if (bDoubleQuotes) fprintf(fpOutputFile,"XOVER_PROB"); if (bDoubleQuotes) fprintf(fpOutputFile,"XOVER_PROB");
else switch (TARGET) { else {
case STD:
case CUDA:
fprintf(fpOutputFile,"(*pEZ_XOVER_PROB)"); fprintf(fpOutputFile,"(*pEZ_XOVER_PROB)");
} }
} // local genome name } // local genome name
...@@ -1476,26 +1439,18 @@ if(OPERATING_SYSTEM=WINDOWS) ...@@ -1476,26 +1439,18 @@ if(OPERATING_SYSTEM=WINDOWS)
exit(1); exit(1);
} }
<COPY_USER_GENERATION>"NB_GEN"[ \t\n]*"=" {if (bDoubleQuotes) fprintf(fpOutputFile,"%s",yytext); <COPY_USER_GENERATION>"NB_GEN"[ \t\n]*"=" {if (bDoubleQuotes) fprintf(fpOutputFile,"%s",yytext);
else switch (TARGET) { else {
case CUDA :
case STD :
fprintf(fpOutputFile,"(*EZ_NB_GEN)="); fprintf(fpOutputFile,"(*EZ_NB_GEN)=");
break;
}} // local genome name }} // local genome name
<COPY_USER_GENERATION>"POP_SIZE"[ \t\n]*"=" {if (bDoubleQuotes) fprintf(fpOutputFile,"%s",yytext); <COPY_USER_GENERATION>"POP_SIZE"[ \t\n]*"=" {if (bDoubleQuotes) fprintf(fpOutputFile,"%s",yytext);
} // local genome name } // local genome name
<COPY_USER_GENERATION>"MUT_PROB"[ \t\n]*"=" {if (bDoubleQuotes) fprintf(fpOutputFile,"%s",yytext); <COPY_USER_GENERATION>"MUT_PROB"[ \t\n]*"=" {if (bDoubleQuotes) fprintf(fpOutputFile,"%s",yytext);
else switch (TARGET) { else {
case CUDA:
case STD:
fprintf(fpOutputFile,"(*pEZ_MUT_PROB)="); fprintf(fpOutputFile,"(*pEZ_MUT_PROB)=");
break;
} }
} // local genome name } // local genome name
<COPY_USER_GENERATION>"XOVER_PROB"[ \t\n]*"=" {if (bDoubleQuotes) fprintf(fpOutputFile,"%s",yytext); <COPY_USER_GENERATION>"XOVER_PROB"[ \t\n]*"=" {if (bDoubleQuotes) fprintf(fpOutputFile,"%s",yytext);
else switch (TARGET) { else {
case CUDA:
case STD:
fprintf(fpOutputFile,"(*pEZ_XOVER_PROB)="); fprintf(fpOutputFile,"(*pEZ_XOVER_PROB)=");
} }
} // local genome name } // local genome name
......
...@@ -269,7 +269,9 @@ void CEvolutionaryAlgorithm::showPopulationStats(struct timeval beginTime){ ...@@ -269,7 +269,9 @@ void CEvolutionaryAlgorithm::showPopulationStats(struct timeval beginTime){
if((this->params->plotStats && this->gnuplot->valid) || this->params->generateGnuplotScript){ if((this->params->plotStats && this->gnuplot->valid) || this->params->generateGnuplotScript){
FILE *f; FILE *f;
f = fopen(params->outputFilename,"a"); //ajouter .dat string fichier = params->outputFilename;
fichier.append(".dat");
f = fopen(fichier.c_str(),"a"); //ajouter .csv
if(f!=NULL){ if(f!=NULL){
if(currentGeneration==0) if(currentGeneration==0)
fprintf(f,"#GEN\tTIME\t\tEVAL\tBEST\t\tAVG\t\tSTDEV\n\n"); fprintf(f,"#GEN\tTIME\t\tEVAL\tBEST\t\tAVG\t\tSTDEV\n\n");
...@@ -301,7 +303,7 @@ void CEvolutionaryAlgorithm::showPopulationStats(struct timeval beginTime){ ...@@ -301,7 +303,7 @@ void CEvolutionaryAlgorithm::showPopulationStats(struct timeval beginTime){
#ifdef __linux__ #ifdef __linux__
if(this->params->plotStats && this->gnuplot->valid){ if(this->params->plotStats && this->gnuplot->valid){
if(currentGeneration==0) if(currentGeneration==0)
fprintf(this->gnuplot->fWrit,"plot \'%s\' using 3:4 t \'Best Fitness\' w lines, \'%s\' using 3:5 t \'Average\' w lines, \'%s\' using 3:6 t \'StdDev\' w lines\n", params->outputFilename,params->outputFilename,params->outputFilename); fprintf(this->gnuplot->fWrit,"plot \'%s.dat\' using 3:4 t \'Best Fitness\' w lines, \'%s.dat\' using 3:5 t \'Average\' w lines, \'%s.dat\' using 3:6 t \'StdDev\' w lines\n", params->outputFilename,params->outputFilename,params->outputFilename);
else else
fprintf(this->gnuplot->fWrit,"replot\n"); fprintf(this->gnuplot->fWrit,"replot\n");
fflush(this->gnuplot->fWrit); fflush(this->gnuplot->fWrit);
......
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