Commit eafb29a3 authored by maitre's avatar maitre

A beta version for tree Genetic Programming

parent 198fdb63
......@@ -58,6 +58,7 @@ extern int nWARNINGS, nERRORS;
extern int TARGET, OPERATING_SYSTEM;
extern int TARGET_FLAVOR;
extern bool bLINE_NUM_EZ_FILE;
extern unsigned iMAX_INIT_TREE_D,iMIN_INIT_TREE_D,iMAX_TREE_D,iNB_GPU,iPRG_BUF_SIZE,iMAX_TREE_DEPTH,iNO_FITNESS_CASES;
// Prototypes
extern int mystricmp(char *, char *);
This diff is collapsed.
......@@ -8,8 +8,9 @@
// forward references
class CEASEAParser;
class CSymbolTable;
class OPCodeDesc;
#line 13 "EaseaLex.h"
#line 14 "EaseaLex.h"
#define GENOME_ANALYSIS 2
#define TEMPLATE_ANALYSIS 4
#define MACRO_IDENTIFIER 6
......@@ -18,26 +19,30 @@
#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_OPTIMISER 28
#define COPY_FINALIZATION_FUNCTION 30
#define COPY_DISPLAY 32
#define COPY_USER_FUNCTION 34
#define COPY_USER_GENERATION 36
#define PARAMETERS_ANALYSIS 38
#define GET_PARAMETERS 40
#define COPY_USER_FUNCTIONS 42
#define COPY_GENERATION_FUNCTION_BEFORE_REPLACEMENT 44
#define GET_METHODS 46
#define COPY_MAKEFILE_OPTION 48
#define COPY_BOUND_CHECKING_FUNCTION 50
#define COPY_BEG_GENERATION_FUNCTION 52
#define COPY_END_GENERATION_FUNCTION 54
#define COPY_INSTEAD_EVAL 56
#define COPY_GP_OPCODE 18
#define COPY 20
#define COPY_INITIALISER 22
#define COPY_CROSSOVER 24
#define COPY_MUTATOR 26
#define COPY_EVALUATOR 28
#define COPY_OPTIMISER 30
#define COPY_FINALIZATION_FUNCTION 32
#define COPY_DISPLAY 34
#define COPY_USER_FUNCTION 36
#define COPY_USER_GENERATION 38
#define PARAMETERS_ANALYSIS 40
#define GET_PARAMETERS 42
#define COPY_USER_FUNCTIONS 44
#define COPY_GENERATION_FUNCTION_BEFORE_REPLACEMENT 46
#define GET_METHODS 48
#define COPY_MAKEFILE_OPTION 50
#define COPY_BOUND_CHECKING_FUNCTION 52
#define COPY_BEG_GENERATION_FUNCTION 54
#define COPY_END_GENERATION_FUNCTION 56
#define COPY_INSTEAD_EVAL 58
#define GP_RULE_ANALYSIS 60
#define GP_COPY_OPCODE_CODE 62
#define COPY_GP_EVAL 64
/////////////////////////////////////////////////////////////////////////////
// CEASEALexer
......@@ -54,7 +59,7 @@ protected:
virtual int yyaction(int action);
public:
#line 81 "EaseaLex.l"
#line 82 "EaseaLex.l"
protected:
CSymbolTable *pSymbolTable; // the symbol table
......@@ -65,14 +70,23 @@ public:
bool bCatchNextSemiColon,bWaitingToClosePopulation, bMethodsInGenome, bFinalizationFunction;
bool bWithinCUDA_Initializer, bWithinMAKEFILEOPTION, bWithinCUDA_Evaluator, bBoundCheckingFunction;
bool bIsParentReduce, bIsOffspringReduce, bEndGeneration, bBeginGeneration, bEndGenerationFunction, bBeginGenerationFunction, bGenerationFunctionBeforeReplacement;
bool bGPOPCODE_ANALYSIS,bCOPY_GP_EVAL_GPU;
CSymbol *pASymbol;
unsigned iGP_OPCODE_FIELD, accolade_counter;
OPCodeDesc* opDesc[128];
unsigned iNoOp;
enum COPY_GP_EVAL_STATUS {EVAL_HDR,EVAL_BDY,EVAL_FTR};
unsigned iCOPY_GP_EVAL_STATUS;
bool bIsCopyingGPEval;
public:
int create(CEASEAParser* pParser, CSymbolTable* pSymbolTable);
int yywrap();
double myStrtod() const;
#line 76 "EaseaLex.h"
#line 90 "EaseaLex.h"
};
#ifndef YYLEXNAME
......
This diff is collapsed.
This diff is collapsed.
......@@ -3,7 +3,7 @@
#include <cyacc.h>
#line 63 "EaseaParse.y"
#line 65 "EaseaParse.y"
// forward references
class CSymbol;
......@@ -11,7 +11,7 @@ class CSymbol;
#line 12 "EaseaParse.h"
#ifndef YYSTYPE
union tagYYSTYPE {
#line 69 "EaseaParse.y"
#line 71 "EaseaParse.y"
CSymbol* pSymbol;
double dValue;
......@@ -42,40 +42,49 @@ union tagYYSTYPE {
#define INT 271
#define DOUBLE 272
#define FLOAT 273
#define CHAR 274
#define POINTER 275
#define NUMBER 276
#define NUMBER2 277
#define METHODS 278
#define STATIC 279
#define NB_GEN 280
#define NB_OPT_IT 281
#define BALDWINISM 282
#define MUT_PROB 283
#define XOVER_PROB 284
#define POP_SIZE 285
#define SELECTOR 286
#define RED_PAR 287
#define RED_OFF 288
#define RED_FINAL 289
#define OFFSPRING 290
#define SURVPAR 291
#define SURVOFF 292
#define MINIMAXI 293
#define ELITISM 294
#define ELITE 295
#define PRINT_STATS 296
#define PLOT_STATS 297
#define GENERATE_CSV_FILE 298
#define GENERATE_GNUPLOT_SCRIPT 299
#define GENERATE_R_SCRIPT 300
#define TIME_LIMIT 301
#line 139 "EaseaParse.y"
#define GPNODE 274
#define CHAR 275
#define POINTER 276
#define NUMBER 277
#define NUMBER2 278
#define METHODS 279
#define STATIC 280
#define NB_GEN 281
#define NB_OPT_IT 282
#define BALDWINISM 283
#define MUT_PROB 284
#define XOVER_PROB 285
#define POP_SIZE 286
#define SELECTOR 287
#define RED_PAR 288
#define RED_OFF 289
#define RED_FINAL 290
#define OFFSPRING 291
#define SURVPAR 292
#define SURVOFF 293
#define MINIMAXI 294
#define ELITISM 295
#define ELITE 296
#define PRINT_STATS 297
#define PLOT_STATS 298
#define GENERATE_CSV_FILE 299
#define GENERATE_GNUPLOT_SCRIPT 300
#define GENERATE_R_SCRIPT 301
#define TIME_LIMIT 302
#define MAX_INIT_TREE_D 303
#define MIN_INIT_TREE_D 304
#define MAX_XOVER_DEPTH 305
#define MAX_MUTAT_DEPTH 306
#define MAX_TREE_D 307
#define NB_GPU 308
#define PRG_BUF_SIZE 309
#define NO_FITNESS_CASES 310
#line 150 "EaseaParse.y"
#include "EaseaSym.h"
#include "EaseaLex.h"
#line 79 "EaseaParse.h"
#line 88 "EaseaParse.h"
/////////////////////////////////////////////////////////////////////////////
// CEASEAParser
......@@ -96,7 +105,7 @@ protected:
#endif
public:
#line 146 "EaseaParse.y"
#line 157 "EaseaParse.y"
protected:
CEASEALexer EASEALexer; // the lexical analyser
......@@ -110,7 +119,7 @@ public:
double divide(double dDividend, double dDivisor);
CSymbol* insert() const;
#line 114 "EaseaParse.h"
#line 123 "EaseaParse.h"
};
#ifndef YYPARSENAME
......
......@@ -57,6 +57,8 @@ int nTIME_LIMIT=0;
float fMUT_PROB;
float fXOVER_PROB;
FILE *fpOutputFile, *fpTemplateFile, *fpGenomeFile;//, *fpExplodedGenomeFile;
unsigned iMAX_INIT_TREE_D,iMIN_INIT_TREE_D,iMAX_TREE_D,iNB_GPU,iPRG_BUF_SIZE,iMAX_TREE_DEPTH,iMAX_XOVER_DEPTH,iNO_FITNESS_CASES;
%}
// include file
......@@ -107,6 +109,7 @@ class CSymbol;
%token <pSymbol> INT
%token <pSymbol> DOUBLE
%token <pSymbol> FLOAT
%token <pSymbol> GPNODE
%token <pSymbol> CHAR
%token <pSymbol> POINTER
%token <dValue> NUMBER
......@@ -135,6 +138,14 @@ class CSymbol;
%token GENERATE_GNUPLOT_SCRIPT
%token GENERATE_R_SCRIPT
%token TIME_LIMIT
%token MAX_INIT_TREE_D
%token MIN_INIT_TREE_D
%token MAX_XOVER_DEPTH
%token MAX_MUTAT_DEPTH
%token MAX_TREE_D
%token NB_GPU
%token PRG_BUF_SIZE
%token NO_FITNESS_CASES
// include file
%include {
#include "EaseaSym.h"
......@@ -279,6 +290,7 @@ BaseType
| FLOAT
| CHAR
| POINTER
| GPNODE
;
UserType
......@@ -325,6 +337,16 @@ Object
pCURRENT_CLASS->pSymbolList->addFirst((CSymbol *)($2));
if (bVERBOSE) printf(" %s pointer declared (%d bytes)\n",$2->sName,$2->nSize);
}
| '0' Symbol {
$2->nSize=sizeof (char *);
$2->pClass=pCURRENT_CLASS;
$2->pType=pCURRENT_TYPE;
$2->ObjectType=oPointer;
$2->ObjectQualifier=pCURRENT_TYPE->ObjectQualifier;
pCURRENT_CLASS->nSize+=$2->nSize;
pCURRENT_CLASS->pSymbolList->addFirst((CSymbol *)($2));
if (bVERBOSE) printf(" %s NULL pointer declared (%d bytes)\n",$2->sName,$2->nSize);
}
| '*''*' Symbol {
$3->nSize=sizeof (char *);
$3->pClass=pCURRENT_CLASS;
......@@ -619,6 +641,14 @@ Parameter
else
bGENERATE_R_SCRIPT=0;
}
| MAX_INIT_TREE_D NUMBER2 {iMAX_INIT_TREE_D = (unsigned)$2;}
| MIN_INIT_TREE_D NUMBER2 {iMIN_INIT_TREE_D = (unsigned)$2;}
| MAX_TREE_D NUMBER2 {iMAX_TREE_D = (unsigned)$2;}
| NB_GPU NUMBER2 {iNB_GPU = (unsigned)$2;}
| PRG_BUF_SIZE NUMBER2 {iPRG_BUF_SIZE = (unsigned)$2;}
//| MAX_XOVER_DEPTH NUMBER2 {iMAX_TREE_DEPTH = (unsigned)$2;}
//| MAX_MUTAT_DEPTH NUMBER2 {iMAX_MUTAT_DEPTH = (unsigned)$2;}
| NO_FITNESS_CASES NUMBER2 {iNO_FITNESS_CASES = (unsigned)$2;}
;
Expr
......@@ -671,7 +701,8 @@ int main(int argc, char *argv[]){
TARGET_FLAVOR = CUDA_FLAVOR_MO;
}
else if( !mystricmp(sTemp,"cuda_gp") ){
TARGET=STD;
printf("tpl argu : is gp\n");
TARGET=CUDA;
TARGET_FLAVOR = CUDA_FLAVOR_GP;
}
else if (!mystricmp(sTemp,"std")) {
......
This diff is collapsed.
......@@ -14,6 +14,10 @@ Rocquencourt BP 105
#define SYMBOL_H
#include "Easea.h"
#include <iostream>
#include <sstream>
extern void debug (char *);
enum EObjectType {oUserClass, oBaseClass, oObject, oPointer, oArray, oMacro, oUndefined, oArrayPointer};
......@@ -112,4 +116,21 @@ public:
CSymbol* find(const char* s);
};
using namespace std;
class OPCodeDesc {
public:
unsigned arity;
string* opcode;
string* realName;
ostringstream cpuCodeStream;
ostringstream gpuCodeStream;
bool isERC;
void show(void);
static void sort(OPCodeDesc** opDescs, unsigned len);
OPCodeDesc();
};
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -2,6 +2,7 @@
#include <stdlib.h>
#include "include/CCuda.h"
#include <stdio.h>
CCuda::CCuda(size_t parentSize, size_t offSize, size_t individualImplSize){
this->sizeOfIndividualImpl = individualImplSize;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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