Commit 68361aa3 authored by moh_lo's avatar moh_lo

almost ok version

parent d471b20f
...@@ -21,6 +21,7 @@ Centre de Math ...@@ -21,6 +21,7 @@ Centre de Math
#define GALIB 1 #define GALIB 1
#define EO 2 #define EO 2
#define DREAM 3 #define DREAM 3
#define GPU 4
#define UNIX 1 #define UNIX 1
#define WINDOWS 2 #define WINDOWS 2
#define UNKNOWN_OS 3 #define UNKNOWN_OS 3
......
This diff is collapsed.
...@@ -457,7 +457,7 @@ StandardFunctionAnalysis ...@@ -457,7 +457,7 @@ StandardFunctionAnalysis
} } } }
END_OF_FUNCTION { END_OF_FUNCTION {
if (TARGET==DREAM) fprintf(fpOutputFile," }\n"); if (TARGET==DREAM) fprintf(fpOutputFile," }\n");
fprintf(fpOutputFile,"}"); if (TARGET!=GPU) fprintf(fpOutputFile,"}");
} }
| USER_EVALUATOR { | USER_EVALUATOR {
if (bVERBOSE) printf("Inserting user genome evaluator (taken from .ez file).\n"); if (bVERBOSE) printf("Inserting user genome evaluator (taken from .ez file).\n");
...@@ -475,14 +475,14 @@ StandardFunctionAnalysis ...@@ -475,14 +475,14 @@ StandardFunctionAnalysis
fprintf(fpOutputFile," EZ_NB_EVALUATIONS++;\n",sPROJECT_NAME); fprintf(fpOutputFile," EZ_NB_EVALUATIONS++;\n",sPROJECT_NAME);
} } } }
END_OF_FUNCTION { END_OF_FUNCTION {
if (TARGET!=EO) fprintf(fpOutputFile,"}\n"); if ((TARGET!=EO) && (TARGET!=GPU)) fprintf(fpOutputFile,"}\n");
} }
; ;
RunParameters RunParameters
: Parameter { DEBUG_YACC("parameter has been reduce\n");} : Parameter {;}
| RunParameters Parameter { DEBUG_YACC("parameter has been reduce\n");} | RunParameters Parameter {;}
; ;
Parameter Parameter
: NB_GEN NUMBER2 : NB_GEN NUMBER2
...@@ -1257,6 +1257,7 @@ int main(int argc, char *argv[]){ ...@@ -1257,6 +1257,7 @@ int main(int argc, char *argv[]){
if (!mystricmp(psTemp,"eo")) TARGET=EO; if (!mystricmp(psTemp,"eo")) TARGET=EO;
else if (!mystricmp(psTemp,"galib")) TARGET=GALIB; else if (!mystricmp(psTemp,"galib")) TARGET=GALIB;
else if (!mystricmp(psTemp,"dream")) TARGET=DREAM; else if (!mystricmp(psTemp,"dream")) TARGET=DREAM;
else if (!mystricmp(psTemp,"gpu")) TARGET=GPU;
else if (!mystricmp(psTemp,"v")) bVERBOSE=true; else if (!mystricmp(psTemp,"v")) bVERBOSE=true;
else strcpy(sRAW_PROJECT_NAME,argv[nParamNb]); else strcpy(sRAW_PROJECT_NAME,argv[nParamNb]);
} }
......
/*_________________________________________________________
This file was automatically created by GUIDE v0.1c
User: collet
Date: Fri Apr 04 23:41:34 CEST 2003
File name: /home/collet/progs/onemax/onemax.ez
Target library: EO
Operating System: Linux
_________________________________________________________*/
\User declarations:
#define SIZE 16
float pMutPerGene=0.1;
inline void swap(bool& a, bool& b)
{bool c=a; a=b; b=c;}
\end
\User functions:
/* void swap(bool* a, bool* b){ */
/* bool tmp = *a; */
/* *a = *b; */
/* *b = tmp; */
/* } */
\end
\Initialisation function:
\end
\User classes:
GenomeClass {bool x[SIZE]; }
\end
\GenomeClass::display:
for( int i=0 ; i<SIZE;i++) cout << (Genome.x[i]? "1 ":"0 ");
\end
\GenomeClass::initialiser:
for (int i=0;i<SIZE;i++) Genome.x[i]=tossCoin(.5);
\end
\GenomeClass::crossover:
int CrossoverPosition=randomLoc(0,SIZE);
for(int i=0;i<CrossoverPosition+1;i++)
swap(child1->Genome.x[i],child2->Genome.x[i]);
\end
\GenomeClass::mutator:
int NbMut=0;
for (int i=0;i<SIZE;i++)
if (tossCoin(pMutPerGene)){
NbMut++;
Genome.x[i]=Genome.x[i]?0:1;
}
return NbMut;
\end
\GenomeClass::evaluator:
int Score=0;
for (int i=0; i<SIZE;i++)
Score+=(int)Genome.x[i];
return Score;
\end
\At each new generation:
\end
\Default run parameters:
// Variation operators:
Operators are called: Sequentially
Mutation probability: 0.4
Crossover probability: 0.8
// Evolution Engine:
Evaluator goal: Maximise
Number of generations: 5
Evolutionary engine: Generational
Population size: 10
Elite: 1
Fertility: 10
Genitors selector: Tournament 2
Selected genitors: 10
Offspring size: 10
Reduce parents: Tournament 2
Surviving parents: 0
Reduce offspring: Tournament 2
Surviving offspring: 10
Final reduce: Tournament 2
Elitism: Strong
// Island model:
Number of islands: 5
Emigration policy: Move
Migrants selector: Tournament 2
Migrants destination: Neighbours
Migration frequency: 0.2
Number of emigrants: 3
Immigration replacement: Tournament 2
Immigration policy: Add
\end
/*_________________________________________________________
This C:\WINDOWS\a_onemax\onemax.ez file was automatically created by GUIDE v0.1b
_________________________________________________________*/
\User declarations: \User declarations:
#define SIZE 100 #define SIZE 100
float pMutPerGene=0.1; float pMutPerGene=0.1;
...@@ -65,36 +59,23 @@ GenomeClass ...@@ -65,36 +59,23 @@ GenomeClass
\Default run parameters: \Default run parameters:
// Variation operators: // Variation operators
Operators are called: Sequentially
Mutation probability: 0.3 Mutation probability: 0.3
Crossover probability: 0.8 Crossover probability: 0.8
// Evolution Engine: // Evolution Engine:
Evaluator goal: Minimise Evaluator goal: Minimise // or maximise
Number of generations: 2000 Number of generations: 2000
Evolutionary engine: Custom Population: 100
Population size: 100 Elite: 1
Elite: 10 Genitors: 80 // those who can be parents
Fertility: 80 Genitors selector: sequential
Genitors selector: Tournament 2 Parents selector: Tournament 2 // Selection of a parent to create a child
Selected genitors: 100 Offspring: 100
Offspring size: 100
Reduce parents: Tournament 2 Reduce parents: Tournament 2
Surviving parents: 20 Surviving parents: 20
Reduce offspring: Tournament 2 Reduce offspring: Tournament 2
Surviving offspring: 80 Surviving offspring: 80
Final reduce: Tournament 2 Final reduce: Tournament 2
Elitism: Strong Elitism: Strong
// Island model:
Number of islands: 5
Emigration policy: Move
Migrants selector: Tournament 2
Migrants destination: Neighbours
Migration frequency: 0.2
Number of emigrants: 3
Immigration replacement: Tournament 2
Immigration policy: Add
\end \end
EXEC = main.out EXEC = main.out
CPPFLAGS = -DUNIX_OS -Ialexyacc/include/ -DDEBUG CPPFLAGS = -DUNIX_OS -Ialexyacc/include/ -DDEBUG
CPPC = g++ CPPC = g++
LDFLAGS =
$(EXEC):EaseaSym.o EaseaLex.o EaseaParse.o alexyacc/libalex.so $(EXEC):EaseaSym.o EaseaLex.o EaseaParse.o alexyacc/libalex.so
#$(EXEC):EaseaSym.o easealex.o EaseaParse.o alexyacc/libalex.so #$(EXEC):EaseaSym.o easealex.o EaseaParse.o alexyacc/libalex.so
$(CPPC) $(CPPFLAGS) $^ -o $@ $(CPPC) $(CPPFLAGS) $(LDFLAGS) $^ -o $@
%.o:%.cpp %.o:%.cpp
$(CPPC) $(CPPFLAGS) -c -o $@ $< $(CPPC) $(CPPFLAGS) -c -o $@ $<
EaseaParse.cpp:winreceive
EaseaLex.cpp:winreceive
#compile library for alex and ayacc unix version #compile library for alex and ayacc unix version
alexyacc/libalex.so:alexyacc/*.cpp alexyacc/libalex.so:alexyacc/*.cpp
cd alexyacc && make libalex.so cd alexyacc && make libalex.so
...@@ -39,6 +44,8 @@ winreceive: winreceive_l winreceive_y ...@@ -39,6 +44,8 @@ winreceive: winreceive_l winreceive_y
winreceive_l: winreceive_l:
cp $(TMP_DIR)/EaseaLex.cpp $(TMP_DIR)/EaseaLex.h ./ cp $(TMP_DIR)/EaseaLex.cpp $(TMP_DIR)/EaseaLex.h ./
chmod -x EaseaLex.cpp EaseaLex.h
winreceive_y: winreceive_y:
cp $(TMP_DIR)/EaseaParse.cpp $(TMP_DIR)/EaseaParse.h ./ cp $(TMP_DIR)/EaseaParse.cpp $(TMP_DIR)/EaseaParse.h ./
chmod -x EaseaParse.cpp EaseaParse.h
\ No newline at end of file
This diff is collapsed.
#ifndef _EASEALEX_H
#define _EASEALEX_H
#include <clex.h>
#line 17 "C:\\repo\\src\\EaseaLex.l"
// forward references
class CEASEAParser;
class CSymbolTable;
#line 13 "C:\\repo\\src\\EaseaLex.h"
#define GENOME_ANALYSIS 2
#define TEMPLATE_ANALYSIS 4
#define MACRO_IDENTIFIER 6
#define MACRO_DEFINITION 8
#define COPY_USER_DECLARATIONS 10
#define COPY_INITIALISATION_FUNCTION 12
#define ANALYSE_USER_CLASSES 14
#define COPY_EO_INITIALISER 16
#define COPY 18
#define COPY_INITIALISER 20
#define COPY_CROSSOVER 22
#define COPY_MUTATOR 24
#define COPY_EVALUATOR 26
#define COPY_DISPLAY 28
#define COPY_USER_FUNCTION 30
#define COPY_USER_GENERATION 32
#define PARAMETERS_ANALYSIS 34
#define GET_PARAMETERS 36
#define COPY_USER_FUNCTIONS 38
#define COPY_GENERATION_FUNCTION 40
#define GET_METHODS 42
/////////////////////////////////////////////////////////////////////////////
// CEASEALexer
#ifndef YYDECLSPEC
#define YYDECLSPEC
#endif
class YYFAR YYDECLSPEC CEASEALexer : public yyflexer {
public:
CEASEALexer();
protected:
void yytables();
virtual int yyaction(int action);
public:
#line 31 "C:\\repo\\src\\EaseaLex.l"
protected:
CSymbolTable *pSymbolTable; // the symbol table
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 bCatchNextSemiColon,bWaitingToClosePopulation, bMethodsInGenome;
CSymbol *pASymbol;
public:
int create(CEASEAParser* pParser, CSymbolTable* pSymbolTable);
int yywrap();
double myStrtod() const;
#line 67 "C:\\repo\\src\\EaseaLex.h"
};
#ifndef YYLEXNAME
#define YYLEXNAME CEASEALexer
#endif
#ifndef INITIAL
#define INITIAL 0
#endif
#endif
This diff is collapsed.
This diff is collapsed.
#ifndef _EASEAPARSE_H
#define _EASEAPARSE_H
#include <cyacc.h>
#line 58 "C:\\repo\\src\\EaseaParse.y"
// forward references
class CSymbol;
#line 12 "C:\\repo\\src\\EaseaParse.h"
#ifndef YYSTYPE
union tagYYSTYPE {
#line 64 "C:\\repo\\src\\EaseaParse.y"
CSymbol* pSymbol;
double dValue;
int ObjectQualifier;
int nValue;
char *szString;
#line 23 "C:\\repo\\src\\EaseaParse.h"
};
#define YYSTYPE union tagYYSTYPE
#endif
#define UMINUS 257
#define CLASSES 258
#define GENOME 259
#define USER_CTOR 260
#define USER_XOVER 261
#define USER_MUTATOR 262
#define USER_EVALUATOR 263
#define END_OF_FUNCTION 264
#define END_METHODS 265
#define IDENTIFIER 266
#define IDENTIFIER2 267
#define BOOL 268
#define INT 269
#define DOUBLE 270
#define FLOAT 271
#define CHAR 272
#define POINTER 273
#define NUMBER 274
#define NUMBER2 275
#define METHODS 276
#define STATIC 277
#define NB_GEN 278
#define NB_ISLANDS 279
#define PROP_SEQ 280
#define MUT_PROB 281
#define XOVER_PROB 282
#define POP_SIZE 283
#define SELECTOR 284
#define RED_PAR 285
#define RED_OFF 286
#define RED_FINAL 287
#define OFFSPRING 288
#define SURVPAR 289
#define SURVOFF 290
#define REPLACEMENT 291
#define DISCARD 292
#define MINIMAXI 293
#define ELITISM 294
#define ELITE 295
#define MIG_CLONE 296
#define MIG_SEL 297
#define MIGRATOR 298
#define MIG_FREQ 299
#define NB_MIG 300
#define IMMIG_SEL 301
#define IMMIG_REPL 302
#line 136 "C:\\repo\\src\\EaseaParse.y"
#include "EaseaSym.h"
#include "EaseaLex.h"
#line 80 "C:\\repo\\src\\EaseaParse.h"
/////////////////////////////////////////////////////////////////////////////
// CEASEAParser
#ifndef YYDECLSPEC
#define YYDECLSPEC
#endif
class YYFAR YYDECLSPEC CEASEAParser : public yyfparser {
public:
CEASEAParser();
protected:
void yytables();
virtual void yyaction(int action);
#ifdef YYDEBUG
void YYFAR* yyattribute1(int index) const;
void yyinitdebug(void YYFAR** p, int count) const;
#endif
public:
#line 143 "C:\\repo\\src\\EaseaParse.y"
protected:
CEASEALexer EASEALexer; // the lexical analyser
public:
CSymbolTable SymbolTable; // the symbol table
int create();
double assign(CSymbol* pIdentifier, double dValue);
double divide(double dDividend, double dDivisor);
void yysyntaxerror();
CSymbol* insert() const;
#line 115 "C:\\repo\\src\\EaseaParse.h"
};
#ifndef YYPARSENAME
#define YYPARSENAME CEASEAParser
#endif
#endif
This diff is collapsed.
This diff is collapsed.
File mode changed from 100755 to 100644
This diff is collapsed.
\TEMPLATE_START//********************************************
//
// EASEA.cpp
//
// C++ file generated by AESAE-EO Millennium Edition (v0.6)
//
//********************************************
\ANALYSE_PARAMETERS
\INSERT_USER_DECLARATIONS
\INSERT_INITIALISATION_FUNCTION \ANALYSE_USER_CLASSES
\INSERT_USER_CLASSES
\GENOME_CTOR
\GENOME_CTOR
\GENOME_DTOR
\INSERT_GENOME
\GENOME_DTOR
\COPY_CTOR
\READ
\WRITE
\INSERT_USER_FUNCTIONS