Commit d74e0ce0 authored by kruger's avatar kruger

Modele en ilot final ?

parent b7cdcc01
......@@ -20,16 +20,14 @@ Centre de Math
#define CUDA 4
#define STD 5
#define CMAES 6
#define MEMETIC 7
#define STD_FLAVOR_SO 0
#define STD_FLAVOR_MO 1
#define STD_FLAVOR_CMAES 2
#define STD_FLAVOR_MEMETIC 3
#define CUDA_FLAVOR_SO 0
#define CUDA_FLAVOR_MO 1
#define CUDA_FLAVOR_CMAES 2
#define CUDA_FLAVOR_GP 3
#define CUDA_FLAVOR_MEMETIC 4
#define CUDA_FLAVOR_GP 2
#define UNIX 1
......@@ -44,22 +42,23 @@ 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 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 char sIP_FILE[];
extern bool bELITISM, bVERBOSE;
extern bool bBALDWINISM;
extern bool bPRINT_STATS, bPLOT_STATS, bGENERATE_CSV_FILE, bGENERATE_GNUPLOT_SCRIPT, bGENERATE_R_SCRIPT;
extern bool bSAVE_POPULATION, bSTART_FROM_FILE;
extern bool bREMOTE_ISLAND_MODEL;
extern bool bLINE_NUM_EZ_FILE;
extern char* nGENOME_NAME;
extern int nPOP_SIZE, nNB_GEN, nNB_OPT_IT, nOFF_SIZE, nPROBLEM_DIM, nTIME_LIMIT;
extern float fMUT_PROB, fXOVER_PROB, fSURV_PAR_SIZE, fSURV_OFF_SIZE;
extern bool bREMOTE_ISLAND_MODEL;
extern int nWARNINGS, nERRORS;
extern int TARGET, OPERATING_SYSTEM;
extern int TARGET_FLAVOR;
extern bool bLINE_NUM_EZ_FILE;
extern int nMINIMISE,nELITE;
extern float fMUT_PROB, fXOVER_PROB, fSURV_PAR_SIZE, fSURV_OFF_SIZE;
extern float fSELECT_PRM, fRED_PAR_PRM, fRED_FINAL_PRM, fRED_OFF_PRM;
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
......
This diff is collapsed.
......@@ -1115,6 +1115,7 @@ if(OPERATING_SYSTEM=WINDOWS)
<TEMPLATE_ANALYSIS>"\\BALDWINISM" {fprintf(fpOutputFile,"%d",bBALDWINISM);}
<TEMPLATE_ANALYSIS>"\\REMOTE_ISLAND_MODEL" {fprintf(fpOutputFile,"%d",bREMOTE_ISLAND_MODEL);}
<TEMPLATE_ANALYSIS>"\\IP_FILE" {if(strlen(sIP_FILE)>0)fprintf(fpOutputFile,"%s",sIP_FILE); else fprintf(fpOutputFile,"NULL");}
<TEMPLATE_ANALYSIS>"\\PRINT_STATS" {fprintf(fpOutputFile,"%d",bPRINT_STATS);}
<TEMPLATE_ANALYSIS>"\\PLOT_STATS" {fprintf(fpOutputFile,"%d",bPLOT_STATS);}
......@@ -2121,6 +2122,7 @@ if(OPERATING_SYSTEM=WINDOWS)
<GET_PARAMETERS>"Baldwinism"[ \t\n]*":"[ \t\n]* {if (bVERBOSE) printf ("\tBaldwinism...\n");return BALDWINISM;}
<GET_PARAMETERS>"Remote"[ \t\n]+"island"[ \t\n]+"model"[ \t\n]*":"[ \t\n]* {if(bVERBOSE) printf ("\tRemote Island Model...\n"); return REMOTE_ISLAND_MODEL;}
<GET_PARAMETERS>"IP"[ \t\n]+"file"[ \t\n]*":"[ \t\n]* {if(bVERBOSE) printf("\tIP File...\n"); return IP_FILE;}
// number
......@@ -2274,11 +2276,11 @@ int CEASEALexer::create(CEASEAParser* pParser, CSymbolTable* pSymTable)
if (TARGET==CUDA){
if(TARGET_FLAVOR == CUDA_FLAVOR_SO )
strcat(sTemp,"CUDA.tpl");
else if(TARGET_FLAVOR == CUDA_FLAVOR_CMAES )
else if(TARGET_FLAVOR == CMAES )
strcat(sTemp,"CMAES_CUDA.tpl");
else if( TARGET_FLAVOR == CUDA_FLAVOR_GP )
strcat(sTemp,"CUDA_GP.tpl");
else if(TARGET_FLAVOR == CUDA_FLAVOR_MEMETIC )
else if(TARGET_FLAVOR == MEMETIC )
strcat(sTemp,"CUDA_MEM.tpl");
else
strcat(sTemp,"CUDA_MO.tpl");
......@@ -2292,9 +2294,9 @@ int CEASEALexer::create(CEASEAParser* pParser, CSymbolTable* pSymTable)
if (TARGET==STD){
if(TARGET_FLAVOR == STD_FLAVOR_SO)
strcat(sTemp,"STD.tpl");
else if (TARGET_FLAVOR == STD_FLAVOR_CMAES)
else if (TARGET_FLAVOR == CMAES)
strcat(sTemp,"CMAES.tpl");
else if (TARGET_FLAVOR == STD_FLAVOR_MEMETIC )
else if (TARGET_FLAVOR == MEMETIC )
strcat(sTemp,"STD_MEM.tpl");
else
strcat(sTemp,"STD_MO.tpl");
......
This diff is collapsed.
......@@ -3,7 +3,7 @@
#include <cyacc.h>
#line 67 "EaseaParse.y"
#line 68 "EaseaParse.y"
// forward references
class CSymbol;
......@@ -11,7 +11,7 @@ class CSymbol;
#line 12 "EaseaParse.h"
#ifndef YYSTYPE
union tagYYSTYPE {
#line 73 "EaseaParse.y"
#line 74 "EaseaParse.y"
CSymbol* pSymbol;
double dValue;
......@@ -66,28 +66,29 @@ union tagYYSTYPE {
#define ELITISM 295
#define ELITE 296
#define REMOTE_ISLAND_MODEL 297
#define PRINT_STATS 298
#define PLOT_STATS 299
#define GENERATE_CSV_FILE 300
#define GENERATE_GNUPLOT_SCRIPT 301
#define GENERATE_R_SCRIPT 302
#define SAVE_POPULATION 303
#define START_FROM_FILE 304
#define TIME_LIMIT 305
#define MAX_INIT_TREE_D 306
#define MIN_INIT_TREE_D 307
#define MAX_XOVER_DEPTH 308
#define MAX_MUTAT_DEPTH 309
#define MAX_TREE_D 310
#define NB_GPU 311
#define PRG_BUF_SIZE 312
#define NO_FITNESS_CASES 313
#line 155 "EaseaParse.y"
#define IP_FILE 298
#define PRINT_STATS 299
#define PLOT_STATS 300
#define GENERATE_CSV_FILE 301
#define GENERATE_GNUPLOT_SCRIPT 302
#define GENERATE_R_SCRIPT 303
#define SAVE_POPULATION 304
#define START_FROM_FILE 305
#define TIME_LIMIT 306
#define MAX_INIT_TREE_D 307
#define MIN_INIT_TREE_D 308
#define MAX_XOVER_DEPTH 309
#define MAX_MUTAT_DEPTH 310
#define MAX_TREE_D 311
#define NB_GPU 312
#define PRG_BUF_SIZE 313
#define NO_FITNESS_CASES 314
#line 157 "EaseaParse.y"
#include "EaseaSym.h"
#include "EaseaLex.h"
#line 91 "EaseaParse.h"
#line 92 "EaseaParse.h"
/////////////////////////////////////////////////////////////////////////////
// CEASEAParser
......@@ -108,7 +109,7 @@ protected:
#endif
public:
#line 162 "EaseaParse.y"
#line 164 "EaseaParse.y"
protected:
CEASEALexer EASEALexer; // the lexical analyser
......@@ -122,7 +123,7 @@ public:
double divide(double dDividend, double dDivisor);
CSymbol* insert() const;
#line 126 "EaseaParse.h"
#line 127 "EaseaParse.h"
};
#ifndef YYPARSENAME
......
......@@ -47,8 +47,9 @@ bool bPRINT_STATS=1;
bool bPLOT_STATS=0;
bool bGENERATE_CSV_FILE=0, bGENERATE_R_SCRIPT=0, bGENERATE_GNUPLOT_SCRIPT=0;
bool bSAVE_POPULATION=0, bSTART_FROM_FILE=0;
bool bBALDWINISM=0;
bool bREMOTE_ISLAND_MODEL=0;
bool bBALDWINISM=0; //memetic
bool bREMOTE_ISLAND_MODEL=0; //remote island model
char sIP_FILE[128]; //remote island model
int nPOP_SIZE, nOFF_SIZE;
float fSURV_PAR_SIZE=-1.0, fSURV_OFF_SIZE=-1.0;
char *nGENOME_NAME;
......@@ -135,6 +136,7 @@ class CSymbol;
%token ELITISM
%token ELITE
%token REMOTE_ISLAND_MODEL //island model
%token IP_FILE //island model
%token PRINT_STATS
%token PLOT_STATS
%token GENERATE_CSV_FILE
......@@ -146,7 +148,7 @@ class CSymbol;
%token MAX_INIT_TREE_D
%token MIN_INIT_TREE_D
%token MAX_XOVER_DEPTH
%token MAX_MUTAT_DEPTH
%token MAX_MUTAT_DEPTH
%token MAX_TREE_D
%token NB_GPU
%token PRG_BUF_SIZE
......@@ -366,7 +368,7 @@ Object
}
| Symbol '[' Expr ']' {
if((TARGET_FLAVOR==STD_FLAVOR_CMAES || TARGET_FLAVOR==CUDA_FLAVOR_CMAES) && nPROBLEM_DIM==0 && strcmp(pCURRENT_CLASS->sName,"Genome")==0) { nGENOME_NAME=$1->sName; nPROBLEM_DIM=(int)$3;}
if((TARGET_FLAVOR==CMAES) && nPROBLEM_DIM==0 && strcmp(pCURRENT_CLASS->sName,"Genome")==0) { nGENOME_NAME=$1->sName; nPROBLEM_DIM=(int)$3;}
printf("DEBUG : size of $3 %d nSize %d\n",(int)$3,pCURRENT_TYPE->nSize);
......@@ -382,7 +384,7 @@ Object
| '*' Symbol '[' Expr ']' {
// this is for support of pointer array. This should be done in a more generic way in a later version
if((TARGET_FLAVOR==STD_FLAVOR_CMAES || TARGET_FLAVOR==CUDA_FLAVOR_CMAES) && nPROBLEM_DIM==0 && strcmp(pCURRENT_CLASS->sName,"Genome")==0) {
if((TARGET_FLAVOR==CMAES) && nPROBLEM_DIM==0 && strcmp(pCURRENT_CLASS->sName,"Genome")==0) {
nGENOME_NAME=$2->sName; nPROBLEM_DIM=(int)$4;
}
......@@ -623,6 +625,11 @@ Parameter
fprintf(stderr,"\n%s - Warning line %d: remote island model must be \"True\" or \"False\".\nDefault value \"False\" inserted.\n",sEZ_FILE_NAME,EASEALexer.yylineno);nWARNINGS++;
bREMOTE_ISLAND_MODEL=0;
}}
| IP_FILE IDENTIFIER2'.'IDENTIFIER2{
sprintf(sIP_FILE, $2->sName);
strcat(sIP_FILE,".");
strcat(sIP_FILE,$4->sName);
}
| PRINT_STATS NUMBER2{
if((int)$2>=1)
......@@ -713,7 +720,8 @@ int main(int argc, char *argv[]){
char *sTemp;
int i=0;
TARGET=bVERBOSE=0;
TARGET=STD;
bVERBOSE=0;
sRAW_PROJECT_NAME[0]=0; // used to ask for a filename if no filename is found on the command line.
while ((++nParamNb) < argc) {
......@@ -741,20 +749,10 @@ int main(int argc, char *argv[]){
TARGET_FLAVOR = STD_FLAVOR_MO;
}
else if (!mystricmp(sTemp,"cmaes")) {
TARGET=STD;
TARGET_FLAVOR = STD_FLAVOR_CMAES;
}
else if (!mystricmp(sTemp,"cmaes_cuda")) {
TARGET=CUDA;
TARGET_FLAVOR = CUDA_FLAVOR_CMAES;
TARGET_FLAVOR = CMAES;
}
else if (!mystricmp(sTemp,"memetic")) {
TARGET=STD;
TARGET_FLAVOR = STD_FLAVOR_MEMETIC;
}
else if (!mystricmp(sTemp,"memetic_cuda")) {
TARGET=CUDA;
TARGET_FLAVOR = CUDA_FLAVOR_MEMETIC;
TARGET_FLAVOR = MEMETIC;
}
else if (!mystricmp(sTemp,"v")) bVERBOSE=true;
......
......@@ -12,7 +12,7 @@ libboost: to install it on ubuntu:
2. EASEA source code:
The source code can be obtained either from sourceforge or, for
programmers invoved in the EASEA development, from its GIT repository.
programmers involved in the EASEA development, from its GIT repository.
2.1 Downloading it from sourceforge:
......
/*_________________________________________________________
Test functions
log normal adaptive mutation
Selection operator: Tournament
__________________________________________________________*/
\User declarations :
#define SIZE 100
#define X_MIN -1.
#define X_MAX 1.
#define ITER 120
#define Abs(x) ((x) < 0 ? -(x) : (x))
#define MAX(x,y) ((x)>(y)?(x):(y))
#define MIN(x,y) ((x)<(y)?(x):(y))
#define SIGMA 1. /* mutation parameter */
#define PI 3.141592654
float pMutPerGene=0.1;
\end
\User functions:
//fitness function
#include <math.h>
__device__ __host__ inline static float SQR(float d)
{
return (d*d);
}
__host__ __device__ inline float Rastrigin(float x[SIZE], int n) {
float res = 0.;
float Scale = 5.12; //pour matcher avec les limites [-1;1]
for (int i = 0;i<n; i++) res += ((Scale*Scale*x[i]*x[i])-10*cos( 2*PI*Scale*x[i]));
return (10.*SIZE + res);
}
float gauss()
/* Generates a normally distributed random value with variance 1 and 0 mean.
Algorithm based on "gasdev" from Numerical recipes' pg. 203. */
{
int iset = 0;
float gset = 0.0;
float v1 = 0.0, v2 = 0.0, r = 0.0;
float factor = 0.0;
if (iset) {
iset = 0;
return gset;
}
else {
do {
v1 = (float)random(0.,1.) * 2.0 - 1.0;
v2 = (float)random(0.,1.) * 2.0 - 1.0;
r = v1 * v1 + v2 * v2;
}
while (r > 1.0);
factor = sqrt (-2.0 * log (r) / r);
gset = v1 * factor;
iset = 1;
return (v2 * factor);
}
}
\end
\Before everything else function:
//cout<<"Before everything else function called "<<endl;
\end
\After everything else function:
//cout << "After everything else function called" << endl;
\end
\At the beginning of each generation function:
//cout << "At the beginning of each generation function called" << endl;
\end
\At the end of each generation function:
//cout << "At the end of each generation function called" << endl;
\end
\At each generation before reduce function:
//cout << "At each generation before replacement function called" << endl;
\end
\User classes :
GenomeClass {
float x[SIZE];
float sigma[SIZE]; // auto-adaptative mutation parameter
}
\end
\GenomeClass::display:
/* for( size_t i=0 ; i<SIZE ; i++){ */
/* // cout << Genome.x[i] << ":" << Genome.sigma[i] << "|"; */
/* printf("%.02f:%.02f|",Genome.x[i],Genome.sigma[i]); */
/* } */
\end
\GenomeClass::initialiser : // "initializer" is also accepted
for(int i=0; i<SIZE; i++ ) {
Genome.x[i] = (float)random(X_MIN,X_MAX);
Genome.sigma[i]=(float)random(0.,0.5);
}
\end
\GenomeClass::crossover :
for (int i=0; i<SIZE; i++)
{
float alpha = (float)random(0.,1.); // barycentric crossover
child.x[i] = alpha*parent1.x[i] + (1.-alpha)*parent2.x[i];
}
\end
\GenomeClass::mutator : // Must return the number of mutations
int NbMut=0;
float pond = 1./sqrt((float)SIZE);
for (int i=0; i<SIZE; i++)
if (tossCoin(pMutPerGene)){
NbMut++;
Genome.sigma[i] = Genome.sigma[i] * exp(SIGMA*pond*(float)gauss());
Genome.sigma[i] = MIN(0.5,Genome.sigma[0]);
Genome.sigma[i] = MAX(0.,Genome.sigma[0]);
Genome.x[i] += Genome.sigma[i]*(float)gauss();
Genome.x[i] = MIN(X_MAX,Genome.x[i]); // pour eviter les depassements
Genome.x[i] = MAX(X_MIN,Genome.x[i]);
}
return NbMut;
\end
\GenomeClass::evaluator : // Returns the score
float Score= 0.0;
Score= Rastrigin(Genome.x, SIZE);
return Score;
\end
\User Makefile options:
CPPFLAGS+=
\end
\Default run parameters : // Please let the parameters appear in this order
Number of generations : 100 // NB_GEN
Time limit: 0 // In seconds, 0 to deactivate
Population size : 2000 //POP_SIZE
Offspring size : 1600 // 40%
Mutation probability : 1 // MUT_PROB
Crossover probability : 1 // XOVER_PROB
Evaluator goal : minimise // Maximise
Selection operator: Tournament 2.0
Surviving parents: 100%//percentage or absolute
Surviving offspring: 100%
Reduce parents operator: Tournament 2
Reduce offspring operator: Tournament 2
Final reduce operator: Tournament 2
Elitism: Strong //Weak or Strong
Elite: 1
Print stats:1 //Default: 1
Generate csv stats file:0
Generate gnuplot script:0
Generate R script:0
Plot stats:0 //Default: 0
Remote island model: true
IP file: ip.txt //File containing all the remote island's IP
Save population: true
Start from file:false
\end
......@@ -158,8 +158,8 @@ return NbMut;
\GenomeClass::evaluator : // Returns the score
float Score= 0.0;
//Score= Weierstrass(Genome.x, SIZE);
Score= rosenbrock(Genome.x);
Score= Weierstrass(Genome.x, SIZE);
//Score= rosenbrock(Genome.x);
return Score;
\end
......@@ -170,8 +170,8 @@ CPPFLAGS+=
\Default run parameters : // Please let the parameters appear in this order
Number of generations : 100 // NB_GEN
Time limit: 0 // In seconds, 0 to deactivate
Population size : 10 //POP_SIZE
Offspring size : 10 // 40%
Population size : 100 //POP_SIZE
Offspring size : 100 // 40%
Mutation probability : 1 // MUT_PROB
Crossover probability : 1 // XOVER_PROB
Evaluator goal : minimise // Maximise
......@@ -183,11 +183,17 @@ CPPFLAGS+=
Final reduce operator: Tournament 2
Elitism: Strong //Weak or Strong
Elite: 0
Elite: 1
Print stats:1 //Default: 1
Generate csv stats file:0
Generate gnuplot script:0
Generate R script:0
Plot stats:0 //Default: 0
Remote island model: true
IP file: ip.txt //File containing all the remote island's IP
Save population: true
Start from file:false
\end
......@@ -125,7 +125,7 @@ CEvolutionaryAlgorithm::CEvolutionaryAlgorithm(Parameters* params){
server = new CComUDPServer(2909,0); //1 if debug
this->treatedIndividuals = 0;
this->numberOfClients = 0;
this->myClientNumber=0;
this->initializeClients();
}
}
......@@ -371,33 +371,34 @@ void CEvolutionaryAlgorithm::showPopulationStats(struct timeval beginTime){
//REMOTE ISLAND MODEL FUNCTIONS
void CEvolutionaryAlgorithm::initializeClients(){
int clientNumber=0;
char (*clients)[16] = (char(*)[16])calloc(1,sizeof(char)*16);
// string clients[256];
cout << "Reading IP address file" << endl;
ifstream IP_File("ip.txt");
ifstream IP_File(this->params->ipFile);
string line;
while(getline(IP_File, line)){
if(!isLocalMachine(line.c_str())){
memmove(clients[this->numberOfClients],line.c_str(),sizeof(char)*16);
//clients[this->numberOfClients] = line;
this->numberOfClients++;
clients = (char(*)[16])realloc(clients,sizeof(char)*16*(this->numberOfClients*16));
}
memmove(clients[this->numberOfClients],line.c_str(),sizeof(char)*16);
this->numberOfClients++;
clients = (char(*)[16])realloc(clients,sizeof(char)*16*(this->numberOfClients*16));
clientNumber++;
}
else{
this->myClientNumber = clientNumber;
}
}
this->Clients = (CComUDPClient**)malloc(this->numberOfClients*sizeof(CComUDPClient*));
for(int i=0; i<(signed)this->numberOfClients; i++){
//this->Clients[i] = new CComUDPClient(2909,clients[i].c_str(),0);
this->Clients[i] = new CComUDPClient(2909,(const char*)clients[i],0);
// cout << "Client " << i << " IP is " << this->Clients[i]->getIP() << endl;
}
free(clients);
}
void CEvolutionaryAlgorithm::sendIndividual(){
//Sending an individual every n generations
if(this->currentGeneration%10==0){
if(this->currentGeneration%(10+this->myClientNumber)==0){
//cout << "I'm going to send an Individual now" << endl;
this->population->selectionOperator->initialize(this->population->parents, 7, this->population->actualParentPopulationSize);
size_t index = this->population->selectionOperator->selectNext(this->population->actualParentPopulationSize);
......@@ -432,6 +433,8 @@ void CEvolutionaryAlgorithm::receiveIndividuals(){
this->server->read_data_lock();
string line = this->server->parm->data[this->treatedIndividuals].data;
this->population->parents[index]->deserialize(line);
this->population->parents[index]->valid = false;
this->population->parents[index]->evaluate();
this->server->read_data_unlock();
//cout << "new Individual :" << this->population->parents[index]->serialize() << endl;
this->treatedIndividuals++;
......
......@@ -141,6 +141,7 @@ void parseArguments(const char* parametersFileName, int ac, char** av,
("optimiseIterations",po::value<int>(),"Set the number of optimisation iterations (default : 100)")
("baldwinism",po::value<int>(),"Only keep fitness (default : 0)")
("remoteIslandModel",po::value<int>(),"Boolean to activate the individual exachange with remote islands (default : 0)")
("ipFile",po::value<string>(),"File containing all the IPs of the remote islands)")
("outputfile",po::value<string>(),"Set an output file for the final population (default : none)")
("inputfile",po::value<string>(),"Set an input file for the initial population (default : none)")
("printStats",po::value<int>(),"Print the Stats (default : 1)")
......
......@@ -8,9 +8,13 @@ endif #OS
OBJS = CRandomGenerator.o CSelectionOperator.o CEvolutionaryAlgorithm.o\
CStoppingCriterion.o COptionParser.o CPopulation.o CIndividual.o\
CGnuplot.o CCmaes.o CCuda.o CCmaesCuda.o Parameters.o CGPNode.o\
CGnuplot.o CCmaes.o CCmaesCuda.o Parameters.o CGPNode.o\
CComUDPLayer.o
ifeq ($(EZ_CUDA),1)
OBJS += CCuda.o
endif
ifeq ($(UNAME),Darwin)
LIBS =
else ifeq ($(UNAME),Linux)
......@@ -32,7 +36,6 @@ endif #OS
%.o:%.cpp
$(CXX) -c $(CXXFLAGS) $(CPPFLAGS) $^
all: $(TARGET)
clean:
rm -f $(OBJS) $(TARGET)
rm -f $(OBJS) $(TARGET) CCuda.o
......@@ -51,6 +51,7 @@ public:
//methods and variables for remote island model
size_t treatedIndividuals;
size_t numberOfClients;
size_t myClientNumber;
CComUDPServer *server;
CComUDPClient **Clients;
void initializeClients();
......
......@@ -71,6 +71,7 @@ public:
//Parameters for the Island Model
bool remoteIslandModel;
char* ipFile;
char* outputFilename;
char* plotOutputFilename;
......
This diff is collapsed.
This diff is collapsed.
......@@ -38,6 +38,8 @@ int main(int argc, char** argv){
p.setDefaultParameters(argc,argv);
CEvolutionaryAlgorithm* ea = p.newEvolutionaryAlgorithm();
EA = ea;
EASEAInit(argc,argv);
CPopulation* pop = ea->getPopulation();
......@@ -60,13 +62,14 @@ int main(int argc, char** argv){
#define WIN32
#endif
#include <string.h>
#include <fstream>
#ifndef WIN32
#include <sys/time.h>
#else
#include <time.h>
#endif
#include <string>
#include <sstream>
#include "CRandomGenerator.h"
#include "CPopulation.h"
#include "COptionParser.h"
......@@ -83,9 +86,12 @@ using namespace std;
bool INSTEAD_EVAL_STEP = false;
CRandomGenerator* globalRandomGenerator;
extern CEvolutionaryAlgorithm *EA:
#define CUDA_TPL
struct gpuArg* gpuArgs;
void* d_offspringPopulationcuda;
void* d_offspringPopulationTmpcuda;
float* d_fitnessescuda;
......@@ -189,6 +195,18 @@ float IndividualImpl::evaluate(){
}
}
string IndividualImpl::serialize(){
ostringstream AESAE_Line(ios_base::app);
\GENOME_SERIAL
return AESAE_Line.str();
}
void IndividualImpl::deserialize(string Line){
istringstream AESAE_Line(Line);
string line;
\GENOME_DESERIAL
}
void IndividualImpl::optimise(int currentIteration){
\INSERT_OPTIMISER
}
......@@ -475,6 +493,10 @@ void ParametersImpl::setDefaultParameters(int argc, char** argv){
this->minimizing = \MINIMAXI;
this->nbGen = setVariable("nbGen",(int)\NB_GEN);
seed = setVariable("seed",(int)time(0));
globalRandomGenerator = new CRandomGenerator(seed);
this->randomGenerator = globalRandomGenerator;
selectionOperator = getSelectionOperator(setVariable("selectionOperator","\SELECTOR_OPERATOR"), this->minimizing, globalRandomGenerator);
replacementOperator = getSelectionOperator(setVariable("reduceFinalOperator","\RED_FINAL_OPERATOR"),this->minimizing, globalRandomGenerator);
parentReductionOperator = getSelectionOperator(setVariable("reduceParentsOperator","\RED_PAR_OPERATOR"),this->minimizing, globalRandomGenerator);
......@@ -532,10 +554,6 @@ void ParametersImpl::setDefaultParameters(int argc, char** argv){