Commit d291c7a8 authored by kruger's avatar kruger

Correction de la lib pour quelque petits problemes

Rajout de fichiers a effacer dans les TPL (au moments du make easeaclean)
Ajout du dossier examples
Ajout du tpl CMAES_CUDA.tpl
parent cf6bfd40
...@@ -1565,9 +1565,11 @@ if(OPERATING_SYSTEM=WINDOWS) ...@@ -1565,9 +1565,11 @@ if(OPERATING_SYSTEM=WINDOWS)
fprintf(fpOutputFile,"globalRandomGenerator->tossCoin");} fprintf(fpOutputFile,"globalRandomGenerator->tossCoin");}
<COPY_USER_FUNCTION>"random" { <COPY_USER_FUNCTION>"random" {
fprintf(fpOutputFile,"globalRandomGenerator->random");} fprintf(fpOutputFile,"globalRandomGenerator->random");}
<COPY_USER_FUNCTION>"child1" {fprintf(fpOutputFile,"child1"); <COPY_USER_FUNCTION>"child1" {fprintf(fpOutputFile,"child");
} }
<COPY_USER_FUNCTION>"child2" {fprintf(fpOutputFile,"child2"); <COPY_USER_FUNCTION>"child2" {fprintf(fpOutputFile,"child");
}
<COPY_USER_FUNCTION>"child" {fprintf(fpOutputFile,"child");
} }
<COPY_USER_FUNCTION>"parent1" {fprintf(fpOutputFile,"parent1"); <COPY_USER_FUNCTION>"parent1" {fprintf(fpOutputFile,"parent1");
} }
......
...@@ -75,22 +75,22 @@ CEvolutionaryAlgorithm::CEvolutionaryAlgorithm(Parameters* params){ ...@@ -75,22 +75,22 @@ CEvolutionaryAlgorithm::CEvolutionaryAlgorithm(Parameters* params){
this->reduceOffsprings = 0; this->reduceOffsprings = 0;
this->gnuplot = NULL; this->gnuplot = NULL;
if(params->plotStats || params->generateGnuplotScript){ if(params->plotStats || params->generateGnuplotScript){
string fichier = params->outputFilename; string fichier (params->outputFilename);
fichier.append(".dat"); fichier.append(".dat");
remove(fichier.c_str()); remove(fichier.c_str());
} }
if(params->generateGnuplotScript){ if(params->generateGnuplotScript){
string fichier = params->outputFilename; string fichier (params->outputFilename);
fichier.append(".plot"); fichier.append(".plot");
remove(fichier.c_str()); remove(fichier.c_str());
} }
if(params->generateRScript || params->generateCVSFile){ if(params->generateRScript || params->generateCVSFile){
string fichier = params->outputFilename; string fichier (params->outputFilename);
fichier.append(".cvs"); fichier.append(".csv");
remove(fichier.c_str()); remove(fichier.c_str());
} }
if(params->generateRScript){ if(params->generateRScript){
string fichier = params->outputFilename; string fichier (params->outputFilename);
fichier.append(".r"); fichier.append(".r");
remove(fichier.c_str()); remove(fichier.c_str());
} }
...@@ -228,6 +228,7 @@ void CEvolutionaryAlgorithm::showPopulationStats(struct timeval beginTime){ ...@@ -228,6 +228,7 @@ void CEvolutionaryAlgorithm::showPopulationStats(struct timeval beginTime){
if((this->params->plotStats && this->gnuplot->valid) || this->params->generateGnuplotScript){ if((this->params->plotStats && this->gnuplot->valid) || this->params->generateGnuplotScript){
FILE *f; FILE *f;
string fichier (params->outputFilename);
f = fopen(params->outputFilename,"a"); //ajouter .dat f = fopen(params->outputFilename,"a"); //ajouter .dat
if(f!=NULL){ if(f!=NULL){
if(currentGeneration==0) if(currentGeneration==0)
...@@ -238,9 +239,9 @@ void CEvolutionaryAlgorithm::showPopulationStats(struct timeval beginTime){ ...@@ -238,9 +239,9 @@ void CEvolutionaryAlgorithm::showPopulationStats(struct timeval beginTime){
} }
if(params->generateCVSFile || params->generateRScript){ //Generation du fichier CVS; if(params->generateCVSFile || params->generateRScript){ //Generation du fichier CVS;
FILE *f; FILE *f;
string fichier = params->outputFilename; string fichier (params->outputFilename);
fichier.append(".cvs"); fichier.append(".csv");
f = fopen(fichier.c_str(),"a"); //ajouter .cvs f = fopen(fichier.c_str(),"a"); //ajouter .csv
if(f!=NULL){ if(f!=NULL){
if(currentGeneration==0) if(currentGeneration==0)
fprintf(f,"GEN,TIME,EVAL,BEST,AVG,STDEV\n"); fprintf(f,"GEN,TIME,EVAL,BEST,AVG,STDEV\n");
...@@ -275,7 +276,7 @@ void CEvolutionaryAlgorithm::outputGraph(){ ...@@ -275,7 +276,7 @@ void CEvolutionaryAlgorithm::outputGraph(){
void CEvolutionaryAlgorithm::generateGnuplotScript(){ void CEvolutionaryAlgorithm::generateGnuplotScript(){
FILE* f; FILE* f;
string fichier = this->params->outputFilename; string fichier (this->params->outputFilename);
fichier.append(".plot"); fichier.append(".plot");
f = fopen(fichier.c_str(),"a"); f = fopen(fichier.c_str(),"a");
fprintf(f,"set term png\n"); fprintf(f,"set term png\n");
...@@ -289,12 +290,12 @@ void CEvolutionaryAlgorithm::generateGnuplotScript(){ ...@@ -289,12 +290,12 @@ void CEvolutionaryAlgorithm::generateGnuplotScript(){
void CEvolutionaryAlgorithm::generateRScript(){ void CEvolutionaryAlgorithm::generateRScript(){
FILE* f; FILE* f;
string fichier = this->params->outputFilename; string fichier (this->params->outputFilename);
fichier.append(".r"); fichier.append(".r");
f=fopen(fichier.c_str(),"a"); f=fopen(fichier.c_str(),"a");
fprintf(f,"#Plotting for R\n"), fprintf(f,"#Plotting for R\n"),
fprintf(f,"png(\"%s\")\n",params->plotOutputFilename); fprintf(f,"png(\"%s\")\n",params->plotOutputFilename);
fprintf(f,"data <- read.table(\"./%s.cvs\",sep=\",\")\n",params->outputFilename); fprintf(f,"data <- read.table(\"./%s.csv\",sep=\",\")\n",params->outputFilename);
fprintf(f,"plot(0, type = \"n\", main = \"Plot Title\", xlab = \"Number of Evaluations\", ylab = \"Fitness\", xlim = c(0,%d) )\n",population->currentEvaluationNb); fprintf(f,"plot(0, type = \"n\", main = \"Plot Title\", xlab = \"Number of Evaluations\", ylab = \"Fitness\", xlim = c(0,%d) )\n",population->currentEvaluationNb);
fprintf(f,"grid() # add grid\n"); fprintf(f,"grid() # add grid\n");
fprintf(f,"lines(data[,3], data[,4], lty = 1) #draw first dataset\n"); fprintf(f,"lines(data[,3], data[,4], lty = 1) #draw first dataset\n");
......
...@@ -196,7 +196,7 @@ CIndividual* IndividualImpl::crossover(CIndividual** ps){ ...@@ -196,7 +196,7 @@ CIndividual* IndividualImpl::crossover(CIndividual** ps){
IndividualImpl** tmp = (IndividualImpl**)ps; IndividualImpl** tmp = (IndividualImpl**)ps;
IndividualImpl parent1(*this); IndividualImpl parent1(*this);
IndividualImpl parent2(*tmp[0]); IndividualImpl parent2(*tmp[0]);
IndividualImpl child1(*this); IndividualImpl child(*this);
//DEBUG_PRT("Xover"); //DEBUG_PRT("Xover");
/* cout << "p1 : " << parent1 << endl; */ /* cout << "p1 : " << parent1 << endl; */
...@@ -207,9 +207,9 @@ CIndividual* IndividualImpl::crossover(CIndividual** ps){ ...@@ -207,9 +207,9 @@ CIndividual* IndividualImpl::crossover(CIndividual** ps){
for (int i = 0; i < \PROBLEM_DIM; ++i) for (int i = 0; i < \PROBLEM_DIM; ++i)
cma->rgdTmp[i] = cma->rgD[i] * cma->alea.alea_Gauss(); cma->rgdTmp[i] = cma->rgD[i] * cma->alea.alea_Gauss();
child1.valid = false; child.valid = false;
/* cout << "child1 : " << child1 << endl; */ /* cout << "child : " << child << endl; */
return new IndividualImpl(child1); return new IndividualImpl(child);
} }
...@@ -424,7 +424,7 @@ all: $(TARGET) ...@@ -424,7 +424,7 @@ all: $(TARGET)
clean: clean:
rm -f $(OBJS) $(TARGET) rm -f $(OBJS) $(TARGET)
easeaclean: easeaclean:
rm -f $(TARGET) *.o *.cpp *.hpp EASEA.png EASEA.dat EASEA.prm EASEA.mak Makefile EASEA.vcproj rm -f $(TARGET) *.o *.cpp *.hpp EASEA.png EASEA.dat EASEA.prm EASEA.mak Makefile EASEA.vcproj EASEA.r EASEA.plot EASEA.csv
......
...@@ -195,7 +195,7 @@ CIndividual* IndividualImpl::crossover(CIndividual** ps){ ...@@ -195,7 +195,7 @@ CIndividual* IndividualImpl::crossover(CIndividual** ps){
IndividualImpl** tmp = (IndividualImpl**)ps; IndividualImpl** tmp = (IndividualImpl**)ps;
IndividualImpl parent1(*this); IndividualImpl parent1(*this);
IndividualImpl parent2(*tmp[0]); IndividualImpl parent2(*tmp[0]);
IndividualImpl child1(*this); IndividualImpl child(*this);
//DEBUG_PRT("Xover"); //DEBUG_PRT("Xover");
/* cout << "p1 : " << parent1 << endl; */ /* cout << "p1 : " << parent1 << endl; */
...@@ -206,9 +206,9 @@ CIndividual* IndividualImpl::crossover(CIndividual** ps){ ...@@ -206,9 +206,9 @@ CIndividual* IndividualImpl::crossover(CIndividual** ps){
\INSERT_CROSSOVER \INSERT_CROSSOVER
child1.valid = false; child.valid = false;
/* cout << "child1 : " << child1 << endl; */ /* cout << "child : " << child << endl; */
return new IndividualImpl(child1); return new IndividualImpl(child);
} }
...@@ -607,7 +607,7 @@ $(BIN):$(OBJ) ...@@ -607,7 +607,7 @@ $(BIN):$(OBJ)
$(NVCC) $(NVCCFLAGS) -o $@ $< -c -DTIMING $(CPPFLAGS) -g -Xcompiler -Wall $(NVCC) $(NVCCFLAGS) -o $@ $< -c -DTIMING $(CPPFLAGS) -g -Xcompiler -Wall
easeaclean: clean easeaclean: clean
rm -f Makefile EASEA.prm $(SRC) $(HDR) EASEA.mak $(CUDA_SRC) *.linkinfo EASEA.png EASEA.dat EASEA.vcproj rm -f Makefile EASEA.prm $(SRC) $(HDR) EASEA.mak $(CUDA_SRC) *.linkinfo EASEA.png EASEA.dat EASEA.vcproj EASEA.plot EASEA.r EASEA.csv
clean: clean:
rm -f $(OBJ) $(BIN) rm -f $(OBJ) $(BIN)
......
...@@ -167,7 +167,7 @@ Individual* Individual::crossover(Individual** ps){ ...@@ -167,7 +167,7 @@ Individual* Individual::crossover(Individual** ps){
// Generic part // Generic part
Individual parent1(*this); Individual parent1(*this);
Individual parent2(*ps[0]); Individual parent2(*ps[0]);
Individual child1(*this); Individual child(*this);
//DEBUG_PRT("Xover"); //DEBUG_PRT("Xover");
/* cout << "p1 : " << parent1 << endl; */ /* cout << "p1 : " << parent1 << endl; */
...@@ -177,9 +177,9 @@ Individual* Individual::crossover(Individual** ps){ ...@@ -177,9 +177,9 @@ Individual* Individual::crossover(Individual** ps){
// Problem specific part // Problem specific part
\INSERT_CROSSOVER \INSERT_CROSSOVER
child1.valid = false; child.valid = false;
/* cout << "child1 : " << child1 << endl; */ /* cout << "child : " << child << endl; */
return new Individual(child1); return new Individual(child);
} }
......
...@@ -164,7 +164,7 @@ CIndividual* IndividualImpl::crossover(CIndividual** ps){ ...@@ -164,7 +164,7 @@ CIndividual* IndividualImpl::crossover(CIndividual** ps){
IndividualImpl** tmp = (IndividualImpl**)ps; IndividualImpl** tmp = (IndividualImpl**)ps;
IndividualImpl parent1(*this); IndividualImpl parent1(*this);
IndividualImpl parent2(*tmp[0]); IndividualImpl parent2(*tmp[0]);
IndividualImpl child1(*this); IndividualImpl child(*this);
//DEBUG_PRT("Xover"); //DEBUG_PRT("Xover");
/* cout << "p1 : " << parent1 << endl; */ /* cout << "p1 : " << parent1 << endl; */
...@@ -175,9 +175,9 @@ CIndividual* IndividualImpl::crossover(CIndividual** ps){ ...@@ -175,9 +175,9 @@ CIndividual* IndividualImpl::crossover(CIndividual** ps){
\INSERT_CROSSOVER \INSERT_CROSSOVER
child1.valid = false; child.valid = false;
/* cout << "child1 : " << child1 << endl; */ /* cout << "child : " << child << endl; */
return new IndividualImpl(child1); return new IndividualImpl(child);
} }
...@@ -421,7 +421,7 @@ all: $(TARGET) ...@@ -421,7 +421,7 @@ all: $(TARGET)
clean: clean:
rm -f $(OBJS) $(TARGET) rm -f $(OBJS) $(TARGET)
easeaclean: easeaclean:
rm -f $(TARGET) *.o *.cpp *.hpp EASEA.png EASEA.dat EASEA.prm EASEA.mak Makefile EASEA.vcproj rm -f $(TARGET) *.o *.cpp *.hpp EASEA.png EASEA.dat EASEA.prm EASEA.mak Makefile EASEA.vcproj EASEA.csv EASEA.r EASEA.plot
\START_VISUAL_TPL<?xml version="1.0" encoding="Windows-1252"?> \START_VISUAL_TPL<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject <VisualStudioProject
......
...@@ -135,7 +135,7 @@ Individual* Individual::crossover(Individual** ps){ ...@@ -135,7 +135,7 @@ Individual* Individual::crossover(Individual** ps){
// Generic part // Generic part
Individual parent1(*this); Individual parent1(*this);
Individual parent2(*ps[0]); Individual parent2(*ps[0]);
Individual child1(*this); Individual child(*this);
//DEBUG_PRT("Xover"); //DEBUG_PRT("Xover");
/* cout << "p1 : " << parent1 << endl; */ /* cout << "p1 : " << parent1 << endl; */
...@@ -145,9 +145,9 @@ Individual* Individual::crossover(Individual** ps){ ...@@ -145,9 +145,9 @@ Individual* Individual::crossover(Individual** ps){
// Problem specific part // Problem specific part
\INSERT_CROSSOVER \INSERT_CROSSOVER
child1.valid = false; child.valid = false;
/* cout << "child1 : " << child1 << endl; */ /* cout << "child : " << child << endl; */
return new Individual(child1); return new Individual(child);
} }
......
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