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
7fe05bf9
Commit
7fe05bf9
authored
Sep 14, 2011
by
Frédéric Krüger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mise a jour des exemples
parent
4a2ad6ec
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
29 additions
and
222 deletions
+29
-222
examples/ant/ant.ez
examples/ant/ant.ez
+1
-1
examples/michalewicz/michalewicz.ez
examples/michalewicz/michalewicz.ez
+1
-0
examples/rastrigin/rastrigin.ez
examples/rastrigin/rastrigin.ez
+1
-3
examples/regression/regression.ez
examples/regression/regression.ez
+13
-13
examples/sphere/sphere.ez
examples/sphere/sphere.ez
+1
-4
examples/weierstrass/ip.txt
examples/weierstrass/ip.txt
+2
-0
examples/weierstrass/weierstrass.ez
examples/weierstrass/weierstrass.ez
+10
-10
examples/weierstrass_gpu/weierstrass.ez
examples/weierstrass_gpu/weierstrass.ez
+0
-191
examples/weierstrass_std/.RData
examples/weierstrass_std/.RData
+0
-0
No files found.
examples/ant/ant.ez
View file @
7fe05bf9
...
...
@@ -640,7 +640,7 @@
Reduce parents operator: Tournament 4
Surviving parents: 50%
Reduce offspring operator: Tournament 2
Surviving offspring:
96
%
Surviving offspring:
50
%
Final reduce operator: Tournament 2
Elitism: Weak
...
...
examples/michalewicz/michalewicz.ez
View file @
7fe05bf9
...
...
@@ -176,6 +176,7 @@ CPPFLAGS+=
Remote island model: false
IP file: ip.txt //File containing all the remote island's IP
Server port:2929
Migration probability : 1.0
Save population: false
...
...
examples/rastrigin/rastrigin.ez
View file @
7fe05bf9
...
...
@@ -73,9 +73,6 @@ float gauss()
\end
\After everything else function:
ofstream SaveFile("save.csv", ios::app);
SaveFile << bBest->fitness << ";" << endl;
SaveFile.close();
\end
\At the beginning of each generation function:
...
...
@@ -172,6 +169,7 @@ CPPFLAGS+=
Remote island model: false
IP file: ip.txt //File containing all the remote island's IP
Server port: 2929
Migration probability : 0.8
Save population: false
...
...
examples/regression/regression.ez
View file @
7fe05bf9
/*_________________________________________________________
/*_________________________________________________________
This is a standard GP implementation on EASEA,
aimed for regression.
...
...
@@ -10,7 +12,7 @@
__________________________________________________________*/
\User declarations :
#define PI (3.141592653589793)
\end
\User functions:
...
...
@@ -27,17 +29,17 @@ __________________________________________________________*/
int generateData(float*** inputs, float** outputs){
int i=0;
(*inputs) = new float*[
g
NO_FITNESS_CASES];
(*outputs) = new float[
g
NO_FITNESS_CASES];
(*inputs) = new float*[NO_FITNESS_CASES];
(*outputs) = new float[NO_FITNESS_CASES];
for( i=0 ; i<
g
NO_FITNESS_CASES ; i++ ){
for( i=0 ; i<NO_FITNESS_CASES ; i++ ){
(*inputs)[i]=new float[VAR_LEN];
float x = random(-10.,+10.);
(*inputs)[i][0] = x;
(*outputs)[i] = POLY(x);
}
return
g
NO_FITNESS_CASES;
return NO_FITNESS_CASES;
}
...
...
@@ -60,7 +62,6 @@ void free_data(){
\After everything else function:
{
toDotFile( ((IndividualImpl*)EA->population->Best)->root, "best", 0);
toString(((IndividualImpl*)EA->population->Best)->root);
free_data();
}
\end
...
...
@@ -89,9 +90,7 @@ GenomeClass {
}
\end
\GenomeClass::display:{
cout << *this << endl;
}
\GenomeClass::display:
\end
\GenomeClass::initialiser :
...
...
@@ -137,11 +136,12 @@ ERROR = powf(expected_value-EVOLVED_VALUE,2);
\end
\GenomeClass::evaluator accumulator :
return sqrtf(ERROR/
g
NO_FITNESS_CASES);
return sqrtf(ERROR/NO_FITNESS_CASES);
\end
\User Makefile options:
CXXFLAGS+=#-I/usr/local/cuda/common/inc/ -I/usr/local/cuda/include/
CXXFLAGS+=-I/usr/local/cuda/common/inc/ -I/usr/local/cuda/include/
LDFLAGS+=
\end
...
...
@@ -177,5 +177,5 @@ LDFLAGS+=
nb of GPUs : 1
size of prog buffer : 20000000
nb of fitness cases :
4096
nb of fitness cases :
128
\end
examples/sphere/sphere.ez
View file @
7fe05bf9
...
...
@@ -69,10 +69,6 @@ float gauss()
\After everything else function:
//cout << "After everything else function called" << endl;
cout << "Best individual " << bBest->fitness << endl;
ofstream SaveFile("save.csv", ios::app);
SaveFile << bBest->fitness << ";" << endl;
SaveFile.close();
\end
\At the beginning of each generation function:
...
...
@@ -169,6 +165,7 @@ CPPFLAGS+=
Remote island model: false
IP file: ip.txt //File containing all the remote island's IP
Server port:2929
Migration probability : 1.0
Save population: false
...
...
examples/weierstrass/ip.txt
0 → 100755
View file @
7fe05bf9
127.0.0.1:2929
127.0.0.1:2930
examples/weierstrass
_std
/weierstrass.ez
→
examples/weierstrass/weierstrass.ez
View file @
7fe05bf9
...
...
@@ -48,7 +48,7 @@ __device__ __host__ inline float Weierstrass(float x[SIZE], int n) // Weierstra
float res = 0.;
float val[SIZE];
float b=2.;
float h = 0.
2
5;
float h = 0.
3
5;
for (int i = 0;i<n; i++) {
val[i] = 0.;
...
...
@@ -164,14 +164,13 @@ return NbMut;
\end
\User Makefile options:
CPPFLAGS+=
\end
\Default run parameters : // Please let the parameters appear in this order
Number of generations : 100
// NB_GEN
Number of generations : 100 // NB_GEN
Time limit: 0 // In seconds, 0 to deactivate
Population size :
100
//POP_SIZE
Offspring size :
100
// 40%
Population size :
2048
//POP_SIZE
Offspring size :
2048
// 40%
Mutation probability : 1 // MUT_PROB
Crossover probability : 1 // XOVER_PROB
Evaluator goal : minimise // Maximise
...
...
@@ -186,15 +185,16 @@ CPPFLAGS+=
Elite: 1
Print stats: true //Default: 1
Generate csv stats file:false
Generate gnuplot script:
tru
e
Generate R script:
tru
e
Plot stats:
fals
e //Default: 0
Generate gnuplot script:
fals
e
Generate R script:
fals
e
Plot stats:
tru
e //Default: 0
Remote island model: true
IP file: ip.txt //File containing all the remote island's IP
Migration probability: 0.1
Server port : 2929
Migration probability: 0.33
Save population:
tru
e
Save population:
fals
e
Start from file:false
\end
examples/weierstrass_gpu/weierstrass.ez
deleted
100755 → 0
View file @
4a2ad6ec
/*_________________________________________________________
Test functions
log normal adaptive mutation
Selection operator: Tournament
__________________________________________________________*/
\User declarations :
#define SIZE 100
#define X_MIN -1.
#define X_MAX 1.
#define ITER 120
#define Abs(x) ((x) < 0 ? -(x) : (x))
#define MAX(x,y) ((x)>(y)?(x):(y))
#define MIN(x,y) ((x)<(y)?(x):(y))
#define SIGMA 1. /* mutation parameter */
#define PI 3.141592654
float pMutPerGene=0.1;
struct gpuOptions;
\end
\User functions:
//fitness function
#include <math.h>
__device__ __host__ inline static float SQR(float d)
{
return (d*d);
}
__device__ __host__ inline float rosenbrock( float const *x)
{
float qualitaet;
int i;
int DIM = SIZE;
qualitaet = 0.0;
for( i = DIM-2; i >= 0; --i)
qualitaet += 100.*SQR(SQR(x[i])-x[i+1]) + SQR(1.-x[i]);
return ( qualitaet);
} /* f_rosenbrock() */
__device__ __host__ inline float Weierstrass(float *x, int n) // Weierstrass multimidmensionnel h = 0.25
{
float res = 0.;
float val[SIZE];
float b=2.;
float h = 0.25;
for (int i = 0;i<n; i++) {
val[i] = 0.;
for (int k=0;k<ITER;k++)
val[i] += pow(b,-(float)k*h) * sin(pow(b,(float)k)*x[i]);
res += Abs(val[i]);
}
return (res);
}
float gauss()
/* Generates a normally distributed random value with variance 1 and 0 mean.
Algorithm based on "gasdev" from Numerical recipes' pg. 203. */
{
int iset = 0;
float gset = 0.0;
float v1 = 0.0, v2 = 0.0, r = 0.0;
float factor = 0.0;
if (iset) {
iset = 0;
return gset;
}
else {
do {
v1 = (float)random(0.,1.) * 2.0 - 1.0;
v2 = (float)random(0.,1.) * 2.0 - 1.0;
r = v1 * v1 + v2 * v2;
}
while (r > 1.0);
factor = sqrt (-2.0 * log (r) / r);
gset = v1 * factor;
iset = 1;
return (v2 * factor);
}
}
\end
\GenomeClass::display:
/*for(int i=0; i<SIZE; i++){
cout << Genome.x[i] << ":" << Genome.sigma[i] << "|";
}*/
\end
\Before everything else function:
\end
\After everything else function:
\end
\At the beginning of each generation function:
//cout << "At the beginning of each generation function called" << endl;
\end
\At the end of each generation function:
//cout << "At the end of each generation function called" << endl;
\end
\At each generation before reduce function:
//cout << "At each generation before replacement function called" << endl;
\end
\User classes :
GenomeClass {
float x[SIZE];
float sigma[SIZE]; // auto-adaptative mutation parameter
}
\end
\GenomeClass::initialiser : // "initializer" is also accepted
for(int i=0; i<SIZE; i++ ) {
Genome.x[i] = (float)random(X_MIN,X_MAX);
Genome.sigma[i]=(float)random(0.,0.5);
}
\end
\GenomeClass::crossover :
for (int i=0; i<SIZE; i++)
{
float alpha = (float)random(0.,1.); // barycentric crossover
child.x[i] = alpha*parent1.x[i] + (1.-alpha)*parent2.x[i];
}
\end
\GenomeClass::mutator : // Must return the number of mutations
int NbMut=0;
float pond = 1./sqrt((float)SIZE);
for (int i=0; i<SIZE; i++)
if (tossCoin(pMutPerGene)){
NbMut++;
Genome.sigma[i] = Genome.sigma[i] * exp(SIGMA*pond*(float)gauss());
Genome.sigma[i] = MIN(0.5,Genome.sigma[0]);
Genome.sigma[i] = MAX(0.,Genome.sigma[0]);
Genome.x[i] += Genome.sigma[i]*(float)gauss();
Genome.x[i] = MIN(X_MAX,Genome.x[i]); // pour eviter les depassements
Genome.x[i] = MAX(X_MIN,Genome.x[i]);
}
return NbMut;
\end
\GenomeClass::evaluator : // Returns the score
float Score= 0.0;
Score= Weierstrass(Genome.x, SIZE);
//Score= rosenbrock(Genome.x);
return Score;
\end
\User Makefile options:
CPPFLAGS+=
\end
\Default run parameters : // Please let the parameters appear in this order
Number of generations : 100 // NB_GEN
Time limit: 0 // In seconds, 0 to deactivate
Population size : 3840 //POP_SIZE
Offspring size : 3840 // 40%
Mutation probability : 1 // MUT_PROB
Crossover probability : 1 // XOVER_PROB
Evaluator goal : minimise // Maximise
Selection operator: Tournament 2.0
Surviving parents: 3840//percentage or absolute
Surviving offspring: 3840
Reduce parents operator: Tournament 2.0
Reduce offspring operator: Tournament 2
Final reduce operator: Tournament 2
Elitism: Strong //Weak or Strong
Elite: 5
Print stats:true //Default: 1
Plot stats:false //Default: 0
Generate csv stats file:false
Generate gnuplot script:false
Generate R script:false
\end
examples/weierstrass_std/.RData
deleted
100755 → 0
View file @
4a2ad6ec
File deleted
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