Commit 9a480ab6 authored by Frederic Kruger's avatar Frederic Kruger

Bound checking function

parent 0fd78b8f
......@@ -2586,17 +2586,18 @@ lineCounter++;
#line 1637 "EaseaLex.l"
if(TARGET==CUDA || TARGET==STD){
fprintf (fpOutputFile,"void EASEABoundChecking(EvolutionaryAlgorithm* evolutionaryAlgorithm){\n");
//fprintf (fpOutputFile,"void EASEABoundChecking(EvolutionaryAlgorithm* evolutionaryAlgorithm){\n");
fprintf (fpOutputFile,"{\n");
}
bFunction=1; bBoundCheckingFunction=1;
BEGIN COPY_USER_GENERATION;
#line 2595 "EaseaLex.cpp"
#line 2596 "EaseaLex.cpp"
}
break;
case 187:
{
#line 1644 "EaseaLex.l"
#line 1645 "EaseaLex.l"
bBoundCheckingFunction=0; // No Generation function was found in the .ez file
if (bVERBOSE) printf("*** No bound checking function was found. ***\n");
fprintf(fpOutputFile,"\n// No Bound checking function.\n");
......@@ -2605,78 +2606,78 @@ bBoundCheckingFunction=0; // No Generation function was found in the .ez file
BEGIN TEMPLATE_ANALYSIS;
bNotFinishedYet=1;
#line 2609 "EaseaLex.cpp"
#line 2610 "EaseaLex.cpp"
}
break;
case 188:
{
#line 1652 "EaseaLex.l"
#line 1653 "EaseaLex.l"
#line 2616 "EaseaLex.cpp"
#line 2617 "EaseaLex.cpp"
}
break;
case 189:
{
#line 1656 "EaseaLex.l"
#line 1657 "EaseaLex.l"
BEGIN GENOME_ANALYSIS; return CLASSES;
#line 2624 "EaseaLex.cpp"
#line 2625 "EaseaLex.cpp"
}
break;
case 190:
{
#line 1658 "EaseaLex.l"
#line 1659 "EaseaLex.l"
#line 2631 "EaseaLex.cpp"
#line 2632 "EaseaLex.cpp"
}
break;
case 191:
{
#line 1664 "EaseaLex.l"
#line 1665 "EaseaLex.l"
(bDoubleQuotes ? bDoubleQuotes=0:bDoubleQuotes=1); fprintf(fpOutputFile,"\"");
#line 2638 "EaseaLex.cpp"
#line 2639 "EaseaLex.cpp"
}
break;
case 192:
{
#line 1665 "EaseaLex.l"
#line 1666 "EaseaLex.l"
fprintf(fpOutputFile,"\\\"");
#line 2645 "EaseaLex.cpp"
#line 2646 "EaseaLex.cpp"
}
break;
case 193:
case 194:
{
#line 1668 "EaseaLex.l"
#line 1669 "EaseaLex.l"
if (bDoubleQuotes) fprintf(fpOutputFile,"currentGeneration");
else switch (TARGET) {
case STD : fprintf(fpOutputFile,"(*EZ_current_generation)"); break;
}
#line 2656 "EaseaLex.cpp"
#line 2657 "EaseaLex.cpp"
}
break;
case 195:
case 196:
{
#line 1673 "EaseaLex.l"
#line 1674 "EaseaLex.l"
if (bDoubleQuotes) fprintf(fpOutputFile,"NB_GEN");
else fprintf(fpOutputFile,"(*EZ_NB_GEN)");
#line 2665 "EaseaLex.cpp"
#line 2666 "EaseaLex.cpp"
}
break;
case 197:
case 198:
{
#line 1676 "EaseaLex.l"
#line 1677 "EaseaLex.l"
if (bDoubleQuotes) fprintf(fpOutputFile,"POP_SIZE");
else fprintf(fpOutputFile,"EZ_POP_SIZE");
#line 2674 "EaseaLex.cpp"
#line 2675 "EaseaLex.cpp"
}
break;
case 199:
case 200:
{
#line 1679 "EaseaLex.l"
#line 1680 "EaseaLex.l"
if (bDoubleQuotes)
fprintf(fpOutputFile,"MUT_PROB");
......@@ -2687,13 +2688,13 @@ if (bDoubleQuotes) fprintf(fpOutputFile,"POP_SIZE");
else fprintf(fpOutputFile,"EZ_MUT_PROB");
#line 2691 "EaseaLex.cpp"
#line 2692 "EaseaLex.cpp"
}
break;
case 201:
case 202:
{
#line 1690 "EaseaLex.l"
#line 1691 "EaseaLex.l"
if (bDoubleQuotes)
fprintf(fpOutputFile,"XOVER_PROB");
......@@ -2701,275 +2702,275 @@ if (bDoubleQuotes) fprintf(fpOutputFile,"POP_SIZE");
fprintf(fpOutputFile,"(*pEZ_XOVER_PROB)");
else fprintf(fpOutputFile,"EZ_XOVER_PROB");
#line 2705 "EaseaLex.cpp"
#line 2706 "EaseaLex.cpp"
}
break;
case 203:
case 204:
{
#line 1698 "EaseaLex.l"
#line 1699 "EaseaLex.l"
if (bDoubleQuotes) fprintf(fpOutputFile,"REPL_PERC");
else fprintf(fpOutputFile,"EZ_REPL_PERC");
#line 2714 "EaseaLex.cpp"
#line 2715 "EaseaLex.cpp"
}
break;
case 205:
case 206:
{
#line 1701 "EaseaLex.l"
#line 1702 "EaseaLex.l"
if (bDoubleQuotes) fprintf(fpOutputFile,"MINIMISE");
else fprintf(fpOutputFile,"EZ_MINIMISE");
#line 2723 "EaseaLex.cpp"
#line 2724 "EaseaLex.cpp"
}
break;
case 207:
case 208:
{
#line 1704 "EaseaLex.l"
#line 1705 "EaseaLex.l"
if (bDoubleQuotes) fprintf(fpOutputFile,"MINIMIZE");
else fprintf(fpOutputFile,"EZ_MINIMIZE");
#line 2732 "EaseaLex.cpp"
#line 2733 "EaseaLex.cpp"
}
break;
case 209:
case 210:
{
#line 1707 "EaseaLex.l"
#line 1708 "EaseaLex.l"
if (bDoubleQuotes) fprintf(fpOutputFile,"MAXIMISE");
else fprintf(fpOutputFile,"EZ_MAXIMISE");
#line 2741 "EaseaLex.cpp"
#line 2742 "EaseaLex.cpp"
}
break;
case 211:
case 212:
{
#line 1710 "EaseaLex.l"
#line 1711 "EaseaLex.l"
if (bDoubleQuotes) fprintf(fpOutputFile,"MAXIMIZE");
else fprintf(fpOutputFile,"EZ_MAXIMIZE");
#line 2750 "EaseaLex.cpp"
#line 2751 "EaseaLex.cpp"
}
break;
case 213:
case 214:
{
#line 1714 "EaseaLex.l"
#line 1715 "EaseaLex.l"
if( TARGET==CUDA ){
fprintf(fpOutputFile,"%s",yytext);
}
#line 2762 "EaseaLex.cpp"
#line 2763 "EaseaLex.cpp"
}
break;
case 215:
{
#line 1720 "EaseaLex.l"
#line 1721 "EaseaLex.l"
fprintf(stderr,"\n%s - Error line %d: The current generation number cannot be changed (not an l-value).\n",sEZ_FILE_NAME,yylineno); exit(1);
#line 2769 "EaseaLex.cpp"
#line 2770 "EaseaLex.cpp"
}
break;
case 216:
{
#line 1721 "EaseaLex.l"
#line 1722 "EaseaLex.l"
fprintf(stderr,"\n%s - Error line %d: The number of generations can only be changed within the generation function.\n",sEZ_FILE_NAME,yylineno); exit (1);
#line 2776 "EaseaLex.cpp"
#line 2777 "EaseaLex.cpp"
}
break;
case 217:
{
#line 1722 "EaseaLex.l"
#line 1723 "EaseaLex.l"
fprintf(stderr,"\n%s - Error line %d: The size of the population can only be changed within the generation function.\n",sEZ_FILE_NAME,yylineno); exit (1);
#line 2783 "EaseaLex.cpp"
#line 2784 "EaseaLex.cpp"
}
break;
case 218:
{
#line 1723 "EaseaLex.l"
#line 1724 "EaseaLex.l"
fprintf(stderr,"\n%s - Error line %d: The mutation probability can only be changed within the generation function.\n",sEZ_FILE_NAME,yylineno);
exit (1);
#line 2793 "EaseaLex.cpp"
#line 2794 "EaseaLex.cpp"
}
break;
case 219:
{
#line 1728 "EaseaLex.l"
#line 1729 "EaseaLex.l"
fprintf(stderr,"\n%s - Error line %d: The crossover proability can only be changed within the generation function.\n",sEZ_FILE_NAME,yylineno); exit (1);
#line 2800 "EaseaLex.cpp"
#line 2801 "EaseaLex.cpp"
}
break;
case 220:
{
#line 1729 "EaseaLex.l"
#line 1730 "EaseaLex.l"
fprintf(stderr,"\n%s - Error line %d: The replacement percentage can only be changed within the generation function.\n",sEZ_FILE_NAME,yylineno); exit (1);
#line 2807 "EaseaLex.cpp"
#line 2808 "EaseaLex.cpp"
}
break;
case 221:
{
#line 1730 "EaseaLex.l"
#line 1731 "EaseaLex.l"
fprintf(stderr,"\n%s - Error line %d: The evaluation goal can only be changed within the generation function.\n",sEZ_FILE_NAME,yylineno); exit (1);
#line 2814 "EaseaLex.cpp"
#line 2815 "EaseaLex.cpp"
}
break;
case 222:
{
#line 1731 "EaseaLex.l"
#line 1732 "EaseaLex.l"
fprintf(stderr,"\n%s - Error line %d: The evaluation goal can only be changed within the generation function.\n",sEZ_FILE_NAME,yylineno); exit (1);
#line 2821 "EaseaLex.cpp"
#line 2822 "EaseaLex.cpp"
}
break;
case 223:
{
#line 1732 "EaseaLex.l"
#line 1733 "EaseaLex.l"
fprintf(stderr,"\n%s - Error line %d: The evaluation goal can only be changed within the generation function.\n",sEZ_FILE_NAME,yylineno); exit (1);
#line 2828 "EaseaLex.cpp"
#line 2829 "EaseaLex.cpp"
}
break;
case 224:
{
#line 1733 "EaseaLex.l"
#line 1734 "EaseaLex.l"
fprintf(stderr,"\n%s - Error line %d: The evaluation goal can only be changed within the generation function.\n",sEZ_FILE_NAME,yylineno); exit (1);
#line 2835 "EaseaLex.cpp"
#line 2836 "EaseaLex.cpp"
}
break;
case 225:
{
#line 1734 "EaseaLex.l"
#line 1735 "EaseaLex.l"
fprintf(fpOutputFile,"false");
#line 2842 "EaseaLex.cpp"
#line 2843 "EaseaLex.cpp"
}
break;
case 226:
{
#line 1735 "EaseaLex.l"
#line 1736 "EaseaLex.l"
fprintf(fpOutputFile,"true");
#line 2849 "EaseaLex.cpp"
#line 2850 "EaseaLex.cpp"
}
break;
case 227:
{
#line 1736 "EaseaLex.l"
#line 1737 "EaseaLex.l"
fprintf(fpOutputFile,yytext);
#line 2857 "EaseaLex.cpp"
#line 2858 "EaseaLex.cpp"
}
break;
case 228:
{
#line 1738 "EaseaLex.l"
#line 1739 "EaseaLex.l"
// local random name
fprintf(fpOutputFile,"globalRandomGenerator->tossCoin");
#line 2865 "EaseaLex.cpp"
#line 2866 "EaseaLex.cpp"
}
break;
case 229:
{
#line 1740 "EaseaLex.l"
#line 1741 "EaseaLex.l"
fprintf(fpOutputFile,"globalRandomGenerator->random");
#line 2873 "EaseaLex.cpp"
#line 2874 "EaseaLex.cpp"
}
break;
case 230:
{
#line 1742 "EaseaLex.l"
#line 1743 "EaseaLex.l"
if (bWithinEO_Function && TARGET!=CUDA && TARGET!=STD) fprintf(fpOutputFile,"_genotype");
else if(bWithinEO_Function && bWithinCUDA_Initializer )fprintf(fpOutputFile,"(*this)");
else fprintf(fpOutputFile,"Genome");
#line 2883 "EaseaLex.cpp"
#line 2884 "EaseaLex.cpp"
}
break;
case 231:
{
#line 1746 "EaseaLex.l"
#line 1747 "EaseaLex.l"
fprintf(fpOutputFile,"genome._evaluated");
#line 2890 "EaseaLex.cpp"
#line 2891 "EaseaLex.cpp"
}
break;
case 232:
{
#line 1747 "EaseaLex.l"
#line 1748 "EaseaLex.l"
fprintf(fpOutputFile,"%s",yytext); BEGIN MACRO_IDENTIFIER;
#line 2897 "EaseaLex.cpp"
#line 2898 "EaseaLex.cpp"
}
break;
case 233:
{
#line 1748 "EaseaLex.l"
#line 1749 "EaseaLex.l"
int i;
for (i=0;(yytext[i]!=' ')&&(yytext[i]!=' ');i++);
yytext[i]=0;
fprintf(fpOutputFile,"template <class fitT> %s %sGenome<fitT>::",yytext,sPROJECT_NAME);
#line 2908 "EaseaLex.cpp"
#line 2909 "EaseaLex.cpp"
}
break;
case 234:
{
#line 1753 "EaseaLex.l"
#line 1754 "EaseaLex.l"
fprintf(fpOutputFile,"template <class fitT> %sGenome<fitT>::",sPROJECT_NAME);
#line 2915 "EaseaLex.cpp"
#line 2916 "EaseaLex.cpp"
}
break;
case 235:
{
#line 1754 "EaseaLex.l"
#line 1755 "EaseaLex.l"
if( TARGET==CUDA || TARGET==STD) fprintf(fpOutputFile,"IndividualImpl");
else fprintf(fpOutputFile,"%sGenome",sPROJECT_NAME);
#line 2924 "EaseaLex.cpp"
#line 2925 "EaseaLex.cpp"
}
break;
case 236:
{
#line 1757 "EaseaLex.l"
#line 1758 "EaseaLex.l"
if(bFinalizationFunction){
bWaitingToClosePopulation=true;
fprintf(fpOutputFile,"((IndividualImpl*)pPopulation[");
}
#line 2936 "EaseaLex.cpp"
#line 2937 "EaseaLex.cpp"
}
break;
case 237:
{
#line 1763 "EaseaLex.l"
#line 1764 "EaseaLex.l"
if (!bWaitingToClosePopulation) fprintf(fpOutputFile,"]");
else {fprintf(fpOutputFile,"])"); ;bWaitingToClosePopulation=false;}
#line 2945 "EaseaLex.cpp"
#line 2946 "EaseaLex.cpp"
}
break;
case 238:
{
#line 1766 "EaseaLex.l"
#line 1767 "EaseaLex.l"
if(bFinalizationFunction){
fprintf(fpOutputFile,"pPopulation");
}
else fprintf(fpOutputFile,"/*pPopulation only in \"After everything else function\" this will cause an error*/ pPopulation");
#line 2957 "EaseaLex.cpp"
#line 2958 "EaseaLex.cpp"
}
break;
case 239:
{
#line 1772 "EaseaLex.l"
#line 1773 "EaseaLex.l"
if(bFinalizationFunction)
fprintf(fpOutputFile,"((IndividualImpl*)bBest)");
else fprintf(fpOutputFile,"/*bBest only in \"After everything else function\" this will cause an error*/ bBest");
#line 2968 "EaseaLex.cpp"
#line 2969 "EaseaLex.cpp"
}
break;
case 240:
{
#line 1777 "EaseaLex.l"
#line 1778 "EaseaLex.l"
if (bFunction==1 && bWithinCUDA_Initializer==0) {
fprintf (fpOutputFile,"}\n");
......@@ -2980,267 +2981,267 @@ fprintf(fpOutputFile,"template <class fitT> %sGenome<fitT>::",sPROJECT_NAME);
rewind(fpGenomeFile);
yyin = fpTemplateFile;
BEGIN TEMPLATE_ANALYSIS;
#line 2984 "EaseaLex.cpp"
#line 2985 "EaseaLex.cpp"
}
break;
case 241:
{
#line 1787 "EaseaLex.l"
#line 1788 "EaseaLex.l"
putc(yytext[0],fpOutputFile);
#line 2991 "EaseaLex.cpp"
#line 2992 "EaseaLex.cpp"
}
break;
case 242:
{
#line 1790 "EaseaLex.l"
#line 1791 "EaseaLex.l"
fprintf(fpOutputFile,"%s",yytext);
pASymbol = new CSymbol(yytext); pASymbol->ObjectType=oMacro;
BEGIN MACRO_DEFINITION;
#line 3000 "EaseaLex.cpp"
#line 3001 "EaseaLex.cpp"
}
break;
case 243:
{
#line 1793 "EaseaLex.l"
#line 1794 "EaseaLex.l"
BEGIN COPY;
#line 3007 "EaseaLex.cpp"
#line 3008 "EaseaLex.cpp"
}
break;
case 244:
{
#line 1795 "EaseaLex.l"
#line 1796 "EaseaLex.l"
fprintf(fpOutputFile,"%s",yytext);
#line 3014 "EaseaLex.cpp"
#line 3015 "EaseaLex.cpp"
}
break;
case 245:
case 246:
case 247:
{
#line 1798 "EaseaLex.l"
#line 1799 "EaseaLex.l"
fprintf(fpOutputFile,"%s",yytext);
pASymbol->dValue = myStrtod();
pSymbolTable->insert(pASymbol);
bSymbolInserted=1;
BEGIN COPY;
#line 3027 "EaseaLex.cpp"
#line 3028 "EaseaLex.cpp"
}
break;
case 248:
{
#line 1803 "EaseaLex.l"
#line 1804 "EaseaLex.l"
fprintf(fpOutputFile,"%s",yytext);
pASymbol->dValue = atoi(yytext);
pSymbolTable->insert(pASymbol);
bSymbolInserted=1;
BEGIN COPY;
#line 3038 "EaseaLex.cpp"
#line 3039 "EaseaLex.cpp"
}
break;
case 249:
{
#line 1808 "EaseaLex.l"
#line 1809 "EaseaLex.l"
if (!bSymbolInserted) delete pASymbol;
else bSymbolInserted=0;
BEGIN COPY;
#line 3047 "EaseaLex.cpp"
#line 3048 "EaseaLex.cpp"
}
break;
case 250:
{
#line 1817 "EaseaLex.l"
#line 1818 "EaseaLex.l"
;
#line 3054 "EaseaLex.cpp"
#line 3055 "EaseaLex.cpp"
}
break;
case 251:
{
#line 1818 "EaseaLex.l"
#line 1819 "EaseaLex.l"
;
#line 3061 "EaseaLex.cpp"
#line 3062 "EaseaLex.cpp"
}
break;
case 252:
{
#line 1819 "EaseaLex.l"
#line 1820 "EaseaLex.l"
;
#line 3068 "EaseaLex.cpp"
#line 3069 "EaseaLex.cpp"
}
break;
case 253:
{
#line 1820 "EaseaLex.l"
#line 1821 "EaseaLex.l"
;
#line 3075 "EaseaLex.cpp"
#line 3076 "EaseaLex.cpp"
}
break;
case 254:
{
#line 1823 "EaseaLex.l"
#line 1824 "EaseaLex.l"
/* do nothing */
#line 3082 "EaseaLex.cpp"
#line 3083 "EaseaLex.cpp"
}
break;
case 255:
{
#line 1824 "EaseaLex.l"
#line 1825 "EaseaLex.l"
/*return '\n';*/
#line 3089 "EaseaLex.cpp"
#line 3090 "EaseaLex.cpp"
}
break;
case 256:
{
#line 1825 "EaseaLex.l"
#line 1826 "EaseaLex.l"
/*return '\n';*/
#line 3096 "EaseaLex.cpp"
#line 3097 "EaseaLex.cpp"
}
break;
case 257:
{
#line 1828 "EaseaLex.l"
#line 1829 "EaseaLex.l"
yylval.pSymbol = pSymbolTable->find("bool");
return BOOL;
#line 3105 "EaseaLex.cpp"
#line 3106 "EaseaLex.cpp"
}
break;
case 258:
{
#line 1831 "EaseaLex.l"
#line 1832 "EaseaLex.l"
yylval.pSymbol = new CSymbol(yytext);
return IDENTIFIER;
#line 3115 "EaseaLex.cpp"
#line 3116 "EaseaLex.cpp"
}
break;
case 259:
{
#line 1835 "EaseaLex.l"
#line 1836 "EaseaLex.l"
yylval.pSymbol = new CSymbol("GPNode");
//yylval.pSymbol->ObjectType = oPointer;
// printf("match gpnode\n");
return GPNODE;
#line 3127 "EaseaLex.cpp"
#line 3128 "EaseaLex.cpp"
}
break;
case 260:
{
#line 1842 "EaseaLex.l"
#line 1843 "EaseaLex.l"
return STATIC;
#line 3134 "EaseaLex.cpp"
#line 3135 "EaseaLex.cpp"
}
break;
case 261:
{
#line 1843 "EaseaLex.l"
#line 1844 "EaseaLex.l"
yylval.pSymbol = pSymbolTable->find("int"); return INT;
#line 3141 "EaseaLex.cpp"
#line 3142 "EaseaLex.cpp"
}
break;
case 262:
{
#line 1844 "EaseaLex.l"
#line 1845 "EaseaLex.l"
yylval.pSymbol = pSymbolTable->find("double"); return DOUBLE;
#line 3148 "EaseaLex.cpp"
#line 3149 "EaseaLex.cpp"
}
break;
case 263:
{
#line 1845 "EaseaLex.l"
#line 1846 "EaseaLex.l"
yylval.pSymbol = pSymbolTable->find("float"); return FLOAT;
#line 3155 "EaseaLex.cpp"
#line 3156 "EaseaLex.cpp"
}