Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
easea
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Arnaud Kress
easea
Commits
2434f345
Commit
2434f345
authored
Dec 10, 2009
by
maitre
Browse files
Options
Browse Files
Download
Plain Diff
EaseaLex.l
parents
4fa0f124
54727019
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
47 additions
and
40 deletions
+47
-40
EaseaLex.l
EaseaLex.l
+4
-2
libeasea/CEvolutionaryAlgorithm.cpp
libeasea/CEvolutionaryAlgorithm.cpp
+12
-11
libeasea/Makefile
libeasea/Makefile
+1
-1
makefile
makefile
+1
-1
tpl/CMAES.tpl
tpl/CMAES.tpl
+11
-7
tpl/CUDA.tpl
tpl/CUDA.tpl
+5
-5
tpl/CUDA_MO.tpl
tpl/CUDA_MO.tpl
+4
-4
tpl/STD.tpl
tpl/STD.tpl
+5
-5
tpl/STD_MO.tpl
tpl/STD_MO.tpl
+4
-4
No files found.
EaseaLex.l
View file @
2434f345
...
...
@@ -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,"child
1
");
<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");
}
...
...
libeasea/CEvolutionaryAlgorithm.cpp
View file @
2434f345
...
...
@@ -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
(
".c
vs
"
);
string
fichier
(
params
->
outputFilename
)
;
fichier
.
append
(
".c
sv
"
);
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
(
".c
vs
"
);
f
=
fopen
(
fichier
.
c_str
(),
"a"
);
//ajouter .c
vs
string
fichier
(
params
->
outputFilename
)
;
fichier
.
append
(
".c
sv
"
);
f
=
fopen
(
fichier
.
c_str
(),
"a"
);
//ajouter .c
sv
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.c
vs
\"
,sep=
\"
,
\"
)
\n
"
,
params
->
outputFilename
);
fprintf
(
f
,
"data <- read.table(
\"
./%s.c
sv
\"
,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
"
);
...
...
libeasea/Makefile
View file @
2434f345
...
...
@@ -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
...
...
makefile
View file @
2434f345
...
...
@@ -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
"
\n
export EZ_PATH=
$(PWD)
/"
>>
$(HOME)
/.bashrc
;
fi
#
# Congratulations ! It looks like you compiled EASEA successfully.
#
...
...
tpl/CMAES.tpl
View file @
2434f345
...
...
@@ -196,7 +196,7 @@ CIndividual* IndividualImpl::crossover(CIndividual** ps){
IndividualImpl** tmp = (IndividualImpl**)ps;
IndividualImpl parent1(*this);
IndividualImpl parent2(*tmp[0]);
IndividualImpl child
1
(*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();
child
1
.valid = false;
/* cout
<
<
"
child
1
:
"
<<
child1
<<
endl
;
*
/
return
new
IndividualImpl
(
child
1
);
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
tpl/CUDA.tpl
View file @
2434f345
...
...
@@ -195,7 +195,7 @@ CIndividual* IndividualImpl::crossover(CIndividual** ps){
IndividualImpl** tmp = (IndividualImpl**)ps;
IndividualImpl parent1(*this);
IndividualImpl parent2(*tmp[0]);
IndividualImpl child
1
(*this);
IndividualImpl child(*this);
//DEBUG_PRT("Xover");
/* cout
<
<
"
p1
:
"
<<
parent1
<<
endl
;
*
/
...
...
@@ -206,9 +206,9 @@ CIndividual* IndividualImpl::crossover(CIndividual** ps){
\
INSERT_CROSSOVER
child
1
.valid =
false;
/
*
cout
<<
"
child
1
:
"
<<
child1
<<
endl
;
*
/
return
new
IndividualImpl
(
child
1
);
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
)
...
...
tpl/CUDA_MO.tpl
View file @
2434f345
...
...
@@ -167,7 +167,7 @@ Individual* Individual::crossover(Individual** ps){
// Generic part
Individual parent1(*this);
Individual parent2(*ps[0]);
Individual child
1
(*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
child
1
.valid =
false;
/
*
cout
<<
"
child
1
:
"
<<
child1
<<
endl
;
*
/
return
new
Individual
(
child
1
);
child.valid =
false;
/
*
cout
<<
"
child
:
"
<<
child
<<
endl
;
*
/
return
new
Individual
(
child
);
}
...
...
tpl/STD.tpl
View file @
2434f345
...
...
@@ -169,7 +169,7 @@ CIndividual* IndividualImpl::crossover(CIndividual** ps){
IndividualImpl** tmp = (IndividualImpl**)ps;
IndividualImpl parent1(*this);
IndividualImpl parent2(*tmp[0]);
IndividualImpl child
1
(*this);
IndividualImpl child(*this);
//DEBUG_PRT("Xover");
/* cout
<
<
"
p1
:
"
<<
parent1
<<
endl
;
*
/
...
...
@@ -180,9 +180,9 @@ CIndividual* IndividualImpl::crossover(CIndividual** ps){
\
INSERT_CROSSOVER
child
1
.valid =
false;
/
*
cout
<<
"
child
1
:
"
<<
child1
<<
endl
;
*
/
return
new
IndividualImpl
(
child
1
);
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
...
...
tpl/STD_MO.tpl
View file @
2434f345
...
...
@@ -135,7 +135,7 @@ Individual* Individual::crossover(Individual** ps){
// Generic part
Individual parent1(*this);
Individual parent2(*ps[0]);
Individual child
1
(*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
child
1
.valid =
false;
/
*
cout
<<
"
child
1
:
"
<<
child1
<<
endl
;
*
/
return
new
Individual
(
child
1
);
child.valid =
false;
/
*
cout
<<
"
child
:
"
<<
child
<<
endl
;
*
/
return
new
Individual
(
child
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment