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)
fprintf(fpOutputFile,"globalRandomGenerator->tossCoin");}
<COPY_USER_FUNCTION>"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");
}
......
......@@ -75,22 +75,22 @@ CEvolutionaryAlgorithm::CEvolutionaryAlgorithm(Parameters* params){
this->reduceOffsprings = 0;
this->gnuplot = NULL;
if(params->plotStats || params->generateGnuplotScript){
string fichier = params->outputFilename;
string fichier (params->outputFilename);
fichier.append(".dat");
remove(fichier.c_str());
}
if(params->generateGnuplotScript){
string fichier = params->outputFilename;
string fichier (params->outputFilename);
fichier.append(".plot");
remove(fichier.c_str());
}
if(params->generateRScript || params->generateCVSFile){
string fichier = params->outputFilename;
fichier.append(".cvs");
string fichier (params->outputFilename);
fichier.append(".csv");
remove(fichier.c_str());
}
if(params->generateRScript){
string fichier = params->outputFilename;
string fichier (params->outputFilename);
fichier.append(".r");
remove(fichier.c_str());
}
......@@ -228,6 +228,7 @@ void CEvolutionaryAlgorithm::showPopulationStats(struct timeval beginTime){
if((this->params->plotStats && this->gnuplot->valid) || this->params->generateGnuplotScript){
FILE *f;
string fichier (params->outputFilename);
f = fopen(params->outputFilename,"a"); //ajouter .dat
if(f!=NULL){
if(currentGeneration==0)
......@@ -238,9 +239,9 @@ void CEvolutionaryAlgorithm::showPopulationStats(struct timeval beginTime){
}
if(params->generateCVSFile || params->generateRScript){ //Generation du fichier CVS;
FILE *f;
string fichier = params->outputFilename;
fichier.append(".cvs");
f = fopen(fichier.c_str(),"a"); //ajouter .cvs
string fichier (params->outputFilename);
fichier.append(".csv");
f = fopen(fichier.c_str(),"a"); //ajouter .csv
if(f!=NULL){
if(currentGeneration==0)
fprintf(f,"GEN,TIME,EVAL,BEST,AVG,STDEV\n");
......@@ -275,7 +276,7 @@ void CEvolutionaryAlgorithm::outputGraph(){
void CEvolutionaryAlgorithm::generateGnuplotScript(){
FILE* f;
string fichier = this->params->outputFilename;
string fichier (this->params->outputFilename);
fichier.append(".plot");
f = fopen(fichier.c_str(),"a");
fprintf(f,"set term png\n");
......@@ -289,12 +290,12 @@ void CEvolutionaryAlgorithm::generateGnuplotScript(){
void CEvolutionaryAlgorithm::generateRScript(){
FILE* f;
string fichier = this->params->outputFilename;
string fichier (this->params->outputFilename);
fichier.append(".r");
f=fopen(fichier.c_str(),"a");
fprintf(f,"#Plotting for R\n"),
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,"grid() # add grid\n");
fprintf(f,"lines(data[,3], data[,4], lty = 1) #draw first dataset\n");
......
......@@ -196,7 +196,7 @@ CIndividual* IndividualImpl::crossover(CIndividual** ps){
IndividualImpl** tmp = (IndividualImpl**)ps;
IndividualImpl parent1(*this);
IndividualImpl parent2(*tmp[0]);
IndividualImpl child1(*this);
IndividualImpl child(*this);
//DEBUG_PRT("Xover");
/* cout << "p1 : " << parent1 << endl; */
......@@ -207,9 +207,9 @@ CIndividual* IndividualImpl::crossover(CIndividual** ps){
for (int i = 0; i < \PROBLEM_DIM; ++i)
cma->rgdTmp[i] = cma->rgD[i] * cma->alea.alea_Gauss();
child1.valid = false;
/* cout << "child1 : " << child1 << endl; */
return new IndividualImpl(child1);
child.valid = false;
/* cout << "child : " << child << endl; */
return new IndividualImpl(child);
}
......@@ -424,7 +424,7 @@ all: $(TARGET)
clean:
rm -f $(OBJS) $(TARGET)
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){
IndividualImpl** tmp = (IndividualImpl**)ps;
IndividualImpl parent1(*this);
IndividualImpl parent2(*tmp[0]);
IndividualImpl child1(*this);
IndividualImpl child(*this);
//DEBUG_PRT("Xover");
/* cout << "p1 : " << parent1 << endl; */
......@@ -206,9 +206,9 @@ CIndividual* IndividualImpl::crossover(CIndividual** ps){
\INSERT_CROSSOVER
child1.valid = false;
/* cout << "child1 : " << child1 << endl; */
return new IndividualImpl(child1);
child.valid = false;
/* cout << "child : " << child << endl; */
return new IndividualImpl(child);
}
......@@ -607,7 +607,7 @@ $(BIN):$(OBJ)
$(NVCC) $(NVCCFLAGS) -o $@ $< -c -DTIMING $(CPPFLAGS) -g -Xcompiler -Wall
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:
rm -f $(OBJ) $(BIN)
......
......@@ -167,7 +167,7 @@ Individual* Individual::crossover(Individual** ps){
// Generic part
Individual parent1(*this);
Individual parent2(*ps[0]);
Individual child1(*this);
Individual child(*this);
//DEBUG_PRT("Xover");
/* cout << "p1 : " << parent1 << endl; */
......@@ -177,9 +177,9 @@ Individual* Individual::crossover(Individual** ps){
// Problem specific part
\INSERT_CROSSOVER
child1.valid = false;
/* cout << "child1 : " << child1 << endl; */
return new Individual(child1);
child.valid = false;
/* cout << "child : " << child << endl; */
return new Individual(child);
}
......
......@@ -164,7 +164,7 @@ CIndividual* IndividualImpl::crossover(CIndividual** ps){
IndividualImpl** tmp = (IndividualImpl**)ps;
IndividualImpl parent1(*this);
IndividualImpl parent2(*tmp[0]);
IndividualImpl child1(*this);
IndividualImpl child(*this);
//DEBUG_PRT("Xover");
/* cout << "p1 : " << parent1 << endl; */
......@@ -175,9 +175,9 @@ CIndividual* IndividualImpl::crossover(CIndividual** ps){
\INSERT_CROSSOVER
child1.valid = false;
/* cout << "child1 : " << child1 << endl; */
return new IndividualImpl(child1);
child.valid = false;
/* cout << "child : " << child << endl; */
return new IndividualImpl(child);
}
......@@ -421,7 +421,7 @@ all: $(TARGET)
clean:
rm -f $(OBJS) $(TARGET)
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"?>
<VisualStudioProject
......
......@@ -135,7 +135,7 @@ Individual* Individual::crossover(Individual** ps){
// Generic part
Individual parent1(*this);
Individual parent2(*ps[0]);
Individual child1(*this);
Individual child(*this);
//DEBUG_PRT("Xover");
/* cout << "p1 : " << parent1 << endl; */
......@@ -145,9 +145,9 @@ Individual* Individual::crossover(Individual** ps){
// Problem specific part
\INSERT_CROSSOVER
child1.valid = false;
/* cout << "child1 : " << child1 << endl; */
return new Individual(child1);
child.valid = false;
/* cout << "child : " << child << endl; */
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