Coupure prévue mardi 3 Août au matin pour maintenance du serveur. Nous faisons au mieux pour que celle-ci soit la plus brève possible.

Commit 2434f345 authored by maitre's avatar maitre
Browse files

EaseaLex.l

parents 4fa0f124 54727019
......@@ -1607,9 +1607,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");
}
......
......@@ -78,22 +78,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());
}
......@@ -237,6 +237,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)
......@@ -247,9 +248,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");
......@@ -284,7 +285,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");
......@@ -298,12 +299,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");
......
......@@ -2,7 +2,7 @@ CXXFLAGS = -g -Wall -fmessage-length=0
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 CManyCmaes.o
CGnuplot.o CCmaes.o CCuda.o CCmaesCuda.o Parameters.o
LIBS = -lboost_program_options
......
......@@ -7,7 +7,7 @@ LDFLAGS =
$(EXEC):EaseaSym.o EaseaParse.o EaseaLex.o alexyacc/libalex.a EaseaYTools.o libeasea/libeasea.a
$(CPPC) $(CPPFLAGS) $(LDFLAGS) $^ -o $@
@if [ $(EZ_PATH) != "$(PWD)/" ] ; then echo "export EZ_PATH=$(PWD)/">>$(HOME)/.bashrc ; fi
@if [ $(EZ_PATH) != "$(PWD)/" ] ; then echo -e "\nexport EZ_PATH=$(PWD)/">>$(HOME)/.bashrc ; fi
#
# Congratulations ! It looks like you compiled EASEA successfully.
#
......
......@@ -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);
}
......@@ -280,7 +280,9 @@ void ParametersImpl::setDefaultParameters(int argc, char** argv){
this->randomGenerator = globalRandomGenerator;
this->printStats = setVariable("printStats",\PRINT_STATS);
this->printStatsFile = setVariable("printStatsFile",\PRINT_STATS_FILE);
this->generateCVSFile = setVariable("generateCVSFile",\GENERATE_CVS_FILE);
this->generateGnuplotScript = setVariable("generateGnuplotScript",\GENERATE_GNUPLOT_SCRIPT);
this->generateRScript = setVariable("generateRScript",\GENERATE_R_SCRIPT);
this->plotStats = setVariable("plotStats",\PLOT_STATS);
this->printInitialPopulation = setVariable("printInitialPopulation",0);
this->printFinalPopulation = setVariable("printFinalPopulation",0);
......@@ -424,7 +426,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
......@@ -589,6 +591,8 @@ easeaclean:
--plotStats=\PLOT_STATS #plot Stats with gnuplot (requires Gnuplot)
--printInitialPopulation=0 #Print initial population
--printFinalPopulation=0 #Print final population
--printStatsFile=\PRINT_STATS_FILE #Print stats to File (filename: ProjetName.dat)
--generateCVSFile=\GENERATE_CVS_FILE
--generateGnuplotScript=\GENERATE_GNUPLOT_SCRIPT
--generateRScript=\GENERATE_R_SCRIPT
\TEMPLATE_END
......@@ -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);
}
......
......@@ -169,7 +169,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; */
......@@ -180,9 +180,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);
}
......@@ -426,7 +426,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