Commit 4c548e79 authored by Ogier Maitre's avatar Ogier Maitre
Browse files

Merge branch 'master' of atia.u-strasbg.fr:easea

parents 61e9c08b 30abe1cb
......@@ -631,36 +631,41 @@ Parameter
strcat(sIP_FILE,$4->sName);
}
| PRINT_STATS NUMBER2{
if((int)$2>=1)
bPRINT_STATS=1;
else
bPRINT_STATS=0;
}
| PLOT_STATS NUMBER2{
if((int)$2>=1)
bPLOT_STATS=1;
else
bPLOT_STATS=0;
}
| GENERATE_CSV_FILE NUMBER2{
if((int)$2>=1)
bGENERATE_CSV_FILE=1;
else
bGENERATE_CSV_FILE=0;
}
| GENERATE_GNUPLOT_SCRIPT NUMBER2{
if((int)$2>=1)
bGENERATE_GNUPLOT_SCRIPT=1;
else
bGENERATE_GNUPLOT_SCRIPT=0;
}
| GENERATE_R_SCRIPT NUMBER2{
if((int)$2>=1)
bGENERATE_R_SCRIPT=1;
else
bGENERATE_R_SCRIPT=0;
}
| PRINT_STATS IDENTIFIER2{
if (!mystricmp($2->sName,"False")) bPRINT_STATS=0;
else if (!mystricmp($2->sName,"True")) bPRINT_STATS=1;
else {
fprintf(stderr,"\n%s - Warning line %d: Print stats must be \"True\" or \"False\".\nDefault value \"False\" inserted.\n.",sEZ_FILE_NAME,EASEALexer.yylineno);nWARNINGS++;
bPRINT_STATS=0;
}}
| PLOT_STATS IDENTIFIER2{
if (!mystricmp($2->sName,"False")) bPLOT_STATS=0;
else if (!mystricmp($2->sName,"True")) bPLOT_STATS=1;
else {
fprintf(stderr,"\n%s - Warning line %d: Generate stats must be \"True\" or \"False\".\nDefault value \"False\" inserted.\n.",sEZ_FILE_NAME,EASEALexer.yylineno);nWARNINGS++;
bPLOT_STATS=0;
}}
| GENERATE_CSV_FILE IDENTIFIER2{
if (!mystricmp($2->sName,"False")) bGENERATE_CSV_FILE=0;
else if (!mystricmp($2->sName,"True")) bGENERATE_CSV_FILE=1;
else {
fprintf(stderr,"\n%s - Warning line %d: Generate csv file must be \"True\" or \"False\".\nDefault value \"False\" inserted.\n.",sEZ_FILE_NAME,EASEALexer.yylineno);nWARNINGS++;
bGENERATE_CSV_FILE=0;
}}
| GENERATE_GNUPLOT_SCRIPT IDENTIFIER2{
if (!mystricmp($2->sName,"False")) bGENERATE_GNUPLOT_SCRIPT=0;
else if (!mystricmp($2->sName,"True")) bGENERATE_GNUPLOT_SCRIPT=1;
else {
fprintf(stderr,"\n%s - Warning line %d: Generate gnuplot script must be \"True\" or \"False\".\nDefault value \"False\" inserted.\n.",sEZ_FILE_NAME,EASEALexer.yylineno);nWARNINGS++;
bGENERATE_GNUPLOT_SCRIPT=0;
}}
| GENERATE_R_SCRIPT IDENTIFIER2{
if (!mystricmp($2->sName,"False")) bGENERATE_R_SCRIPT=0;
else if (!mystricmp($2->sName,"True")) bGENERATE_R_SCRIPT=1;
else {
fprintf(stderr,"\n%s - Warning line %d: Generate R script must be \"True\" or \"False\".\nDefault value \"False\" inserted.\n.",sEZ_FILE_NAME,EASEALexer.yylineno);nWARNINGS++;
bGENERATE_R_SCRIPT=0;
}}
| SAVE_POPULATION IDENTIFIER2{
if (!mystricmp($2->sName,"False")) bSAVE_POPULATION=0;
else if (!mystricmp($2->sName,"True")) bSAVE_POPULATION=1;
......
......@@ -63,7 +63,7 @@ vars:
ifeq ($(UNAME), Darwin)
@sed '/EZ_PATH/d' $(HOME)/.profile>$(HOME)/.profile_save
@mv $(HOME)/.profile_save $(HOME)/.profile
@echo "\nexport EZ_PATH=/usr/local/easea/">>$(HOME)/.profile
@echo "export EZ_PATH=/usr/local/easea/">>$(HOME)/.profile
@echo "export PATH=\$$PATH:/usr/local/easea/bin" >>$(HOME)/.profile
else
@echo "\nexport EZ_PATH=/usr/local/easea/">>$(HOME)/.bashrc
......@@ -73,7 +73,11 @@ endif
dev_vars:
@echo "\nexport EZ_PATH=$(PWD)/">>$(HOME)/.bashrc ; fi
ifeq ($(UNAME), Darwin)
@echo "export EZ_PATH=$(PWD)/">>$(HOME)/.profile
else
@echo "\nexport EZ_PATH=$(PWD)/">>$(HOME)/.bashrc
endif
EaseaParse.o: EaseaParse.cpp EaseaLex.cpp
......
......@@ -113,10 +113,10 @@ CPPFLAGS+=
Final reduce operator:Deterministic //Deterministic, Tournament, Random, Roulette(only Maximise)
Elitism: Strong //Weak or Strong
Elite: 5
Print stats:1 //Default: 1
Generate csv stats file:0
Generate gnuplot script:0
Generate R script:0
Plot stats:0 //Default: 0
Print stats:true //Default: 1
Generate csv stats file:false
Generate gnuplot script:false
Generate R script:false
Plot stats:false //Default: 0
\end
......@@ -118,10 +118,10 @@ LIBS+=
Final reduce operator:Deterministic //Deterministic, Tournament, Random, Roulette(only Maximise)
Elitism: Strong //Weak or Strong
Elite: 5
Print stats:1 //Default: 1
Generate csv stats file:0
Generate gnuplot script:0
Generate R script:0
Plot stats:0 //Default: 0
Print stats:true //Default: 1
Generate csv stats file:false
Generate gnuplot script:false
Generate R script:false
Plot stats:false //Default: 0
\end
......@@ -175,10 +175,10 @@ CPPFLAGS+=
Number of optimisation iterations : 100 //Number of optimisation iteration
Baldwinism : false //True or False (Lamarckism : keep optimised Genome)
Print stats:1 //Default: 1
Generate csv stats file:0
Generate gnuplot script:0
Generate R script:0
Plot stats:0 //Default: 0
Print stats:true //Default: 1
Generate csv stats file:false
Generate gnuplot script:false
Generate R script:false
Plot stats:false //Default: 0
\end
......@@ -218,10 +218,10 @@ CPPFLAGS+=
Number of optimisation iterations : 1 //Number of optimisation iteration
Baldwinism : false //True or False (Lamarckism : keep optimised Genome)
Print stats:1 //Default: 1
Generate csv stats file:0
Generate gnuplot script:0
Generate R script:0
Plot stats:0 //Default: 0
Print stats:true //Default: 1
Generate csv stats file:false
Generate gnuplot script:false
Generate R script:false
Plot stats:false //Default: 0
\end
......@@ -179,10 +179,10 @@ CPPFLAGS+=
Number of optimisation iterations : 100 //Number of optimisation iteration
Baldwinism : true //True or False (Lamarckism : keep optimised Genome
Print stats:1 //Default: 1
Generate csv stats file:0
Generate gnuplot script:0
Generate R script:0
Plot stats:0 //Default: 0
Print stats:true //Default: 1
Generate csv stats file:false
Generate gnuplot script:false
Generate R script:false
Plot stats:false //Default: 0
\end
......@@ -218,10 +218,10 @@ CPPFLAGS+=
Number of optimisation iterations : 1 //Number of optimisation iteration
Baldwinism : false //True or False (Lamarckism : keep optimised Genome
Print stats:1 //Default: 1
Generate csv stats file:0
Generate gnuplot script:0
Generate R script:0
Plot stats:0 //Default: 0
Print stats:true //Default: 1
Generate csv stats file:false
Generate gnuplot script:false
Generate R script:false
Plot stats:false //Default: 0
\end
......@@ -162,11 +162,11 @@ CPPFLAGS+=
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
Print stats:true //Default: 1
Generate csv stats file:false
Generate gnuplot script:false
Generate R script:false
Plot stats:false //Default: 0
Remote island model: true
IP file: ip.txt //File containing all the remote island's IP
......
......@@ -181,11 +181,11 @@ CPPFLAGS+=
Elitism: Strong //Weak or Strong
Elite: 5
Print stats:1 //Default: 1
Plot stats:0 //Default: 0
Generate csv stats file:0
Generate gnuplot script:0
Generate R script:0
Print stats:true //Default: 1
Plot stats:false //Default: 0
Generate csv stats file:false
Generate gnuplot script:false
Generate R script:false
\end
......@@ -184,11 +184,11 @@ CPPFLAGS+=
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
Print stats: true //Default: 1
Generate csv stats file:false
Generate gnuplot script:false
Generate R script:false
Plot stats:false //Default: 0
Remote island model: true
IP file: ip.txt //File containing all the remote island's IP
......
......@@ -177,6 +177,7 @@ void CEvolutionaryAlgorithm::runEvolutionaryLoop(){
}
showPopulationStats(begin);
bBest = population->Best;
currentGeneration += 1;
//Initialize elitPopulation
......@@ -402,8 +403,8 @@ void CEvolutionaryAlgorithm::sendIndividual(){
//Sending an individual every n generations
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);
//this->population->selectionOperator->initialize(this->population->parents, 7, this->population->actualParentPopulationSize);
//size_t index = this->population->selectionOperator->selectNext(this->population->actualParentPopulationSize);
//cout << "Going to send individual " << index << " with fitness " << this->population->parents[index]->fitness << endl;
//selecting a client randomly
......@@ -412,7 +413,7 @@ void CEvolutionaryAlgorithm::sendIndividual(){
cout << "His IP is " << this->Clients[client]->getIP() << endl;
//cout << "Sending individual " << index << " to client " << client << " nomw" << endl;
//cout << this->population->parents[index]->serialize() << endl;
this->Clients[client]->CComUDP_client_send((char*)this->population->parents[index]->serialize().c_str());
this->Clients[client]->CComUDP_client_send((char*)bBest->serialize().c_str());
}
}
......@@ -435,8 +436,6 @@ 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++;
......
......@@ -187,6 +187,7 @@ float IndividualImpl::evaluate(){
string IndividualImpl::serialize(){
ostringstream AESAE_Line(ios_base::app);
\GENOME_SERIAL
AESAE_Line << this->fitness;
return AESAE_Line.str();
}
......@@ -194,6 +195,8 @@ void IndividualImpl::deserialize(string Line){
istringstream AESAE_Line(Line);
string line;
\GENOME_DESERIAL
AESAE_Line >> this->fitness;
this->valid=true;
}
IndividualImpl::IndividualImpl(const IndividualImpl& genome){
......@@ -450,32 +453,23 @@ public:
UNAME := $(shell uname)
#ifeq ($(UNAME),Darwin)
EASEALIB_PATH=$(EZ_PATH)libeasea/
#else
#EASEALIB_PATH=\EZ_PATHlibeasea/
#endif
ifeq ($(UNAME),Darwin)
CXXFLAGS = -O2 -g -Wall -fmessage-length=0 -I$(EASEALIB_PATH)include -I$(EZ_PATH)boost
else
CXXFLAGS = -O2 -g -Wall -fmessage-length=0 -I$(EASEALIB_PATH)include
endif
#USER MAKEFILE OPTIONS :
\INSERT_MAKEFILE_OPTION#END OF USER MAKEFILE OPTIONS
OBJS = EASEA.o EASEAIndividual.o
ifeq ($(UNAME),Darwin)
LIBS = $(EZ_PATH)boost/program_options.a
else
LIBS = -lboost_program_options -lpthread
endif
LIBS = -lpthread
\INSERT_MAKEFILE_OPTION
TARGET = EASEA
$(TARGET): $(OBJS)
$(CXX) -o $(TARGET) $(OBJS) $(LIBS) -g $(EASEALIB_PATH)libeasea.a
$(CXX) -o $(TARGET) $(OBJS) $(LIBS) -g $(EASEALIB_PATH)libeasea.a $(EZ_PATH)boost/program_options.a
#%.o:%.cpp
......
......@@ -292,6 +292,7 @@ float IndividualImpl::evaluate(){
string IndividualImpl::serialize(){
ostringstream AESAE_Line(ios_base::app);
\GENOME_SERIAL
AESAE_Line << this->fitness;
return AESAE_Line.str();
}
......@@ -299,9 +300,10 @@ void IndividualImpl::deserialize(string Line){
istringstream AESAE_Line(Line);
string line;
\GENOME_DESERIAL
AESAE_Line >> this->fitness;
this->valid=true;
}
IndividualImpl::IndividualImpl(const IndividualImpl& genome){
// ********************
......@@ -464,9 +466,6 @@ void ParametersImpl::setDefaultParameters(int argc, char** argv){
if(parentReductionSize<parentPopulationSize) parentReduction = true;
else parentReduction = false;
cout << "Parent red " << parentReduction << " " << parentReductionSize << "/"<< parentPopulationSize << endl;
cout << "Parent red " << offspringReduction << " " << offspringReductionSize << "/" << offspringPopulationSize << endl;
generationalCriterion = new CGenerationalCriterion(setVariable("nbGen",(int)\NB_GEN));
controlCStopingCriterion = new CControlCStopingCriterion();
timeCriterion = new CTimeCriterion(setVariable("timeLimit",\TIME_LIMIT));
......@@ -657,14 +656,14 @@ public:
\START_CUDA_MAKEFILE_TPL
NVCC= nvcc
CPPC= g++
LIBAESAE=\EZ_PATHlibeasea/
CXXFLAGS+=-g -Wall -O2 -I$(LIBAESAE)include
LDFLAGS=-lboost_program_options $(LIBAESAE)libeasea.a -lpthread
LIBAESAE=$(EZ_PATH)libeasea/
CXXFLAGS+=-g -Wall -O2 -I$(LIBAESAE)include -I$(EZ_PATH)boost
LDFLAGS=$(EZ_PATH)boost/program_options.a $(LIBAESAE)libeasea.a -lpthread
#USER MAKEFILE OPTIONS :
\INSERT_MAKEFILE_OPTION#END OF USER MAKEFILE OPTIONS
CPPFLAGS+= -I$(LIBAESAE)include -I/usr/local/cuda/include/
CPPFLAGS+= -I$(LIBAESAE)include -I$(EZ_PATH)boost
NVCCFLAGS+=
......
......@@ -198,6 +198,7 @@ float IndividualImpl::evaluate(){
string IndividualImpl::serialize(){
ostringstream AESAE_Line(ios_base::app);
\GENOME_SERIAL
AESAE_Line << this->fitness;
return AESAE_Line.str();
}
......@@ -205,6 +206,8 @@ void IndividualImpl::deserialize(string Line){
istringstream AESAE_Line(Line);
string line;
\GENOME_DESERIAL
AESAE_Line >> this->fitness;
this->valid=true;
}
void IndividualImpl::optimise(int currentIteration){
......@@ -543,9 +546,6 @@ void ParametersImpl::setDefaultParameters(int argc, char** argv){
if(parentReductionSize<parentPopulationSize) parentReduction = true;
else parentReduction = false;
cout << "Parent red " << parentReduction << " " << parentReductionSize << "/"<< parentPopulationSize << endl;
cout << "Parent red " << offspringReduction << " " << offspringReductionSize << "/" << offspringPopulationSize << endl;
generationalCriterion = new CGenerationalCriterion(setVariable("nbGen",(int)\NB_GEN));
controlCStopingCriterion = new CControlCStopingCriterion();
timeCriterion = new CTimeCriterion(setVariable("timeLimit",\TIME_LIMIT));
......@@ -749,14 +749,14 @@ public:
\START_CUDA_MAKEFILE_TPL
NVCC= nvcc
CPPC= g++
LIBAESAE=\EZ_PATHlibeasea/
CXXFLAGS+=-g -Wall -O2 -I$(LIBAESAE)include
LDFLAGS=-lboost_program_options $(LIBAESAE)libeasea.a -lpthread
LIBAESAE=$(EZ_PATH)libeasea/
CXXFLAGS+=-g -Wall -O2 -I$(LIBAESAE)include -I$(EZ_PATH)boost
LDFLAGS=$(EZ_PATH)boost/program_options.a $(LIBAESAE)libeasea.a -lpthread
#USER MAKEFILE OPTIONS :
\INSERT_MAKEFILE_OPTION#END OF USER MAKEFILE OPTIONS
CPPFLAGS+= -I$(LIBAESAE)include
CPPFLAGS+= -I$(LIBAESAE)include -I$(EZ_PATH)boost
NVCCFLAGS+=
......
......@@ -153,6 +153,7 @@ float IndividualImpl::evaluate(){
string IndividualImpl::serialize(){
ostringstream AESAE_Line(ios_base::app);
\GENOME_SERIAL
AESAE_Line << this->fitness;
return AESAE_Line.str();
}
......@@ -160,6 +161,8 @@ void IndividualImpl::deserialize(string Line){
istringstream AESAE_Line(Line);
string line;
\GENOME_DESERIAL
AESAE_Line >> this->fitness;
this->valid=true;
}
IndividualImpl::IndividualImpl(const IndividualImpl& genome){
......@@ -288,9 +291,6 @@ void ParametersImpl::setDefaultParameters(int argc, char** argv){
if(parentReductionSize<parentPopulationSize) parentReduction = true;
else parentReduction = false;
cout << "Parent red " << parentReduction << " " << parentReductionSize << "/"<< parentPopulationSize << endl;
cout << "Parent red " << offspringReduction << " " << offspringReductionSize << "/" << offspringPopulationSize << endl;
generationalCriterion = new CGenerationalCriterion(setVariable("nbGen",(int)\NB_GEN));
controlCStopingCriterion = new CControlCStopingCriterion();
timeCriterion = new CTimeCriterion(setVariable("timeLimit",\TIME_LIMIT));
......@@ -444,17 +444,9 @@ public:
UNAME := $(shell uname)
#ifeq ($(UNAME),Darwin)
EASEALIB_PATH=$(EZ_PATH)/libeasea/
#else
#EASEALIB_PATH=$(EZ_PATH)/libeasea/
#endif
#ifeq ($(UNAME),Darwin)
CXXFLAGS = -O2 -g -Wall -fmessage-length=0 -I$(EASEALIB_PATH)include -I$(EZ_PATH)boost
#else
#CXXFLAGS = -O2 -g -Wall -fmessage-length=0 -I$(EASEALIB_PATH)include
#endif
#USER MAKEFILE OPTIONS :
\INSERT_MAKEFILE_OPTION#END OF USER MAKEFILE OPTIONS
......@@ -462,7 +454,7 @@ CXXFLAGS = -O2 -g -Wall -fmessage-length=0 -I$(EASEALIB_PATH)include -I$(EZ_PATH
OBJS = EASEA.o EASEAIndividual.o
LIBS = -lpthread
LIBS = -lpthread
TARGET = EASEA
......
......@@ -149,14 +149,16 @@ float IndividualImpl::evaluate(){
string IndividualImpl::serialize(){
ostringstream AESAE_Line(ios_base::app);
\GENOME_SERIAL
AESAE_Line << this->fitness;
return AESAE_Line.str();
}
void IndividualImpl::deserialize(string Line){
istringstream AESAE_Line(Line);
string line;
\GENOME_DESERIAL
AESAE_Line >> this->fitness;
this->valid=true;
}
IndividualImpl::IndividualImpl(const IndividualImpl& genome){
......@@ -312,9 +314,6 @@ void ParametersImpl::setDefaultParameters(int argc, char** argv){
if(parentReductionSize<parentPopulationSize) parentReduction = true;
else parentReduction = false;
cout << "Parent red " << parentReduction << " " << parentReductionSize << "/"<< parentPopulationSize << endl;
cout << "Parent red " << offspringReduction << " " << offspringReductionSize << "/" << offspringPopulationSize << endl;
generationalCriterion = new CGenerationalCriterion(setVariable("nbGen",(int)\NB_GEN));
controlCStopingCriterion = new CControlCStopingCriterion();
timeCriterion = new CTimeCriterion(setVariable("timeLimit",\TIME_LIMIT));
......@@ -484,30 +483,21 @@ public:
UNAME := $(shell uname)
#ifeq ($(UNAME),Darwin)
EASEALIB_PATH=$(EZ_PATH)libeasea/
#else
#EASEALIB_PATH=\EZ_PATHlibeasea/
#endif
ifeq ($(UNAME),Darwin)
CXXFLAGS = -O2 -g -Wall -fmessage-length=0 -I$(EASEALIB_PATH)include -I$(EZ_PATH)boost
else
CXXFLAGS = -O2 -g -Wall -fmessage-length=0 -I$(EASEALIB_PATH)include
endif
#USER MAKEFILE OPTIONS :
\INSERT_MAKEFILE_OPTION#END OF USER MAKEFILE OPTIONS
OBJS = EASEA.o EASEAIndividual.o
ifeq ($(UNAME),Darwin)
LIBS = $(EZ_PATH)boost/program_options.a
else
LIBS = -lboost_program_options -lpthread
endif
LIBS = -lpthread
TARGET = EASEA
$(TARGET): $(OBJS)
$(CXX) -o $(TARGET) $(OBJS) $(LIBS) -g $(EASEALIB_PATH)libeasea.a
$(CXX) -o $(TARGET) $(OBJS) $(LIBS) -g $(EASEALIB_PATH)libeasea.a $(EZ_PATH)boost/program_options.a
#%.o:%.cpp
......
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