Commit 3d997f8d authored by Anna's avatar Anna

new version of EASEA : 2 tpls MOEA (ASREA, NSGAII), without boost, with logger...

new version of EASEA : 2 tpls MOEA (ASREA, NSGAII), without boost, with logger and 3 quality indicators (GD,IGD,HV)
parent 7d8fbf9c
memetic_weierstrass.mak
\ No newline at end of file
/**
This is program entry for STD template for memetic_weierstrass
*/
#include <stdlib.h>
#include <iostream>
#include <time.h>
#include "COptionParser.h"
#include "CRandomGenerator.h"
#include "CEvolutionaryAlgorithm.h"
#include "global.h"
#include "memetic_weierstrassIndividual.hpp"
using namespace std;
/** Global variables for the whole algorithm */
CIndividual** pPopulation = NULL;
CIndividual* bBest = NULL;
float* pEZ_MUT_PROB = NULL;
float* pEZ_XOVER_PROB = NULL;
unsigned *EZ_NB_GEN;
unsigned *EZ_current_generation;
int EZ_POP_SIZE;
int OFFSPRING_SIZE;
CEvolutionaryAlgorithm* EA;
int main(int argc, char** argv){
parseArguments("memetic_weierstrass.prm",argc,argv);
ParametersImpl p;
p.setDefaultParameters(argc,argv);
CEvolutionaryAlgorithm* ea = p.newEvolutionaryAlgorithm();
EA = ea;
memetic_weierstrassInit(argc,argv);
CPopulation* pop = ea->getPopulation();
ea->runEvolutionaryLoop();
memetic_weierstrassFinal(pop);
delete pop;
return 0;
}
UNAME := $(shell uname)
ifeq ($(shell uname -o 2>/dev/null),Msys)
OS := MINGW
endif
ifneq ("$(OS)","")
EZ_PATH=../../
endif
memetic_weierstrassLIB_PATH=$(EZ_PATH)/libeasea/
CXXFLAGS = -fopenmp -O2 -g -Wall -fmessage-length=0 -I$(memetic_weierstrassLIB_PATH)include -I$(EZ_PATH)boost
OBJS = memetic_weierstrass.o memetic_weierstrassIndividual.o
LIBS = -lpthread -fopenmp
ifneq ("$(OS)","")
LIBS += -lws2_32 -lwinmm -L"C:\MinGW\lib"
endif
#USER MAKEFILE OPTIONS :
CPPFLAGS+=
#END OF USER MAKEFILE OPTIONS
TARGET = memetic_weierstrass
$(TARGET): $(OBJS)
$(CXX) -o $(TARGET) $(OBJS) $(LDFLAGS) -g $(memetic_weierstrassLIB_PATH)/libeasea.a $(EZ_PATH)boost/program_options.a $(LIBS)
#%.o:%.cpp
# $(CXX) -c $(CXXFLAGS) $^
all: $(TARGET)
clean:
ifneq ("$(OS)","")
-del $(OBJS) $(TARGET).exe
else
rm -f $(OBJS) $(TARGET)
endif
easeaclean:
ifneq ("$(OS)","")
-del $(TARGET).exe *.o *.cpp *.hpp memetic_weierstrass.png memetic_weierstrass.dat memetic_weierstrass.prm memetic_weierstrass.mak Makefile memetic_weierstrass.vcproj memetic_weierstrass.csv memetic_weierstrass.r memetic_weierstrass.plot memetic_weierstrass.pop
else
rm -f $(TARGET) *.o *.cpp *.hpp memetic_weierstrass.png memetic_weierstrass.dat memetic_weierstrass.prm memetic_weierstrass.mak Makefile memetic_weierstrass.vcproj memetic_weierstrass.csv memetic_weierstrass.r memetic_weierstrass.plot memetic_weierstrass.pop
endif
set term png
set output "memetic_weierstrass.png"
set xrange[0:1000]
set xlabel "Number of Evaluations"
set ylabel "Fitness"
plot 'memetic_weierstrass.dat' using 3:4 t 'Best Fitness' w lines, 'memetic_weierstrass.dat' using 3:5 t 'Average' w lines, 'memetic_weierstrass.dat' using 3:6 t 'StdDev' w lines
#****************************************
#
# memetic_weierstrass.prm
#
# Parameter file generated by STD.tpl EASEA v1.0
#
#***************************************
# --seed=0 # -S : Random number seed. It is possible to give a specific seed.
###### Evolution Engine ######
--popSize=10 # -P : Population Size
--nbOffspring=10 # -O : Nb of offspring (percentage or absolute)
###### Stopping Criterions #####
--nbGen=100 #Nb of generations
--timeLimit=0 # Time Limit: desactivate with (0) (in Seconds)
###### Evolution Engine / Replacement ######
--elite=1 # Nb of elite parents (absolute)
--eliteType=1 # Strong (1) or weak (0) elitism (set elite to 0 for none)
--survivingParents=1.000000 # Nb of surviving parents (percentage or absolute)
--survivingOffspring=1.000000 # Nb of surviving offspring (percentage or absolute)
--selectionOperator=Tournament # Selector: Deterministic, Tournament, Random, Roulette
--selectionPressure=2.000000
--reduceParentsOperator=Tournament
--reduceParentsPressure=2.000000
--reduceOffspringOperator=Tournament
--reduceOffspringPressure=2.000000
--reduceFinalOperator=Tournament
--reduceFinalPressure=2.000000
##### Stats Ouput #####
--printStats=1 #print Stats to screen
--plotStats=0 #plot Stats
--printInitialPopulation=0 #Print initial population
--printFinalPopulation=0 #Print final population
#--generateCSV=0
--generatePlotScript=0
--generateRScript=0
#### Population save ####
--savePopulation=0 #save population to memetic_weierstrass.pop file
--startFromFile=0 #start optimisation from memetic_weierstrass.pop file
#### Remote Island Model ####
--remoteIslandModel=0 #To initialize communications with remote EASEA's
--ipFile=NULL
--migrationProbability=0.000000 #Probability to send an individual every generation
--serverPort=0
# That's all folks !
This diff is collapsed.
#ifndef PROBLEM_DEP_H
#define PROBLEM_DEP_H
//#include "CRandomGenerator.h"
#include <stdlib.h>
#include <iostream>
#include <CIndividual.h>
#include <Parameters.h>
#include <cstring>
#include <sstream>
using namespace std;
class CRandomGenerator;
class CSelectionOperator;
class CGenerationalCriterion;
class CEvolutionaryAlgorithm;
class CPopulation;
class Parameters;
extern int EZ_POP_SIZE;
extern int OFFSPRING_SIZE;
// User classes
class IndividualImpl : public CIndividual {
public: // in memetic_weierstrass the genome is public (for user functions,...)
// Class members
// Class members
float sigma[100];
float x[100];
public:
IndividualImpl();
IndividualImpl(const IndividualImpl& indiv);
virtual ~IndividualImpl();
float evaluate();
static unsigned getCrossoverArrity(){ return 2; }
float getFitness(){ return this->fitness; }
CIndividual* crossover(CIndividual** p2);
void printOn(std::ostream& O) const;
CIndividual* clone();
unsigned mutate(float pMutationPerGene);
void boundChecking();
string serialize();
void deserialize(string EASEA_Line);
friend std::ostream& operator << (std::ostream& O, const IndividualImpl& B) ;
void initRandomGenerator(CRandomGenerator* rg){ IndividualImpl::rg = rg;}
};
class ParametersImpl : public Parameters {
public:
void setDefaultParameters(int argc, char** argv);
CEvolutionaryAlgorithm* newEvolutionaryAlgorithm();
};
/**
* @TODO ces functions devraient s'appeler weierstrassInit, weierstrassFinal etc... (en gros memetic_weierstrassFinal dans le tpl).
*
*/
void memetic_weierstrassInit(int argc, char** argv);
void memetic_weierstrassFinal(CPopulation* pop);
void memetic_weierstrassBeginningGenerationFunction(CEvolutionaryAlgorithm* evolutionaryAlgorithm);
void memetic_weierstrassEndGenerationFunction(CEvolutionaryAlgorithm* evolutionaryAlgorithm);
void memetic_weierstrassGenerationFunctionBeforeReplacement(CEvolutionaryAlgorithm* evolutionaryAlgorithm);
class EvolutionaryAlgorithmImpl: public CEvolutionaryAlgorithm {
public:
EvolutionaryAlgorithmImpl(Parameters* params);
virtual ~EvolutionaryAlgorithmImpl();
void initializeParentPopulation();
};
#endif /* PROBLEM_DEP_H */
#GEN TIME EVAL BEST AVG STDDEV WORST
0 0.0 100 3.05e+32 4.75e+30 3.20e+31 0.00e+00
1 0.1 200 3.05e+32 5.57e+30 3.28e+31 0.00e+00
2 0.2 300 3.05e+32 6.37e+30 3.35e+31 0.00e+00
3 0.2 400 3.05e+32 1.10e+31 4.57e+31 0.00e+00
4 0.2 500 3.05e+32 1.12e+31 4.56e+31 0.00e+00
5 0.3 600 3.05e+32 1.11e+31 4.56e+31 0.00e+00
6 0.3 700 3.05e+32 1.43e+31 5.42e+31 0.00e+00
7 0.4 800 3.05e+32 1.49e+31 5.45e+31 0.00e+00
8 0.4 900 3.05e+32 1.57e+31 5.48e+31 0.00e+00
9 0.4 1000 3.05e+32 1.57e+31 5.49e+31 0.00e+00
10 0.5 1100 3.05e+32 1.48e+31 5.46e+31 0.00e+00
11 0.5 1200 3.05e+32 1.80e+31 6.17e+31 0.00e+00
12 0.6 1300 3.05e+32 2.11e+31 6.79e+31 0.00e+00
13 0.6 1400 3.05e+32 2.10e+31 6.79e+31 0.00e+00
14 0.6 1500 3.05e+32 1.73e+31 6.14e+31 0.00e+00
15 0.7 1600 3.05e+32 1.58e+31 6.08e+31 0.00e+00
16 0.7 1700 3.05e+32 1.35e+31 5.38e+31 0.00e+00
17 0.8 1800 3.05e+32 1.73e+31 6.14e+31 0.00e+00
18 0.8 1900 3.05e+32 1.74e+31 6.14e+31 0.00e+00
19 0.8 2000 3.05e+32 1.73e+31 6.14e+31 0.00e+00
20 0.9 2100 3.05e+32 1.50e+31 5.45e+31 0.00e+00
21 0.9 2200 3.05e+32 1.19e+31 4.61e+31 0.00e+00
22 0.10 2300 3.05e+32 1.43e+31 5.42e+31 0.00e+00
23 0.10 2400 3.05e+32 1.37e+31 5.38e+31 0.00e+00
24 0.10 2500 3.05e+32 1.66e+31 6.11e+31 0.00e+00
25 0.11 2600 3.05e+32 1.65e+31 6.11e+31 0.00e+00
26 0.11 2700 3.05e+32 2.02e+31 6.77e+31 0.00e+00
27 0.11 2800 3.05e+32 2.25e+31 7.32e+31 0.00e+00
28 0.12 2900 3.05e+32 2.63e+31 7.85e+31 0.00e+00
29 0.12 3000 3.05e+32 2.47e+31 7.37e+31 0.00e+00
30 0.13 3100 3.05e+32 1.94e+31 6.21e+31 0.00e+00
31 0.13 3200 3.05e+32 1.72e+31 6.14e+31 0.00e+00
32 0.13 3300 3.05e+32 1.03e+31 4.52e+31 0.00e+00
33 0.14 3400 3.05e+32 1.12e+31 4.56e+31 0.00e+00
34 0.14 3500 3.05e+32 1.19e+31 4.61e+31 0.00e+00
35 0.14 3600 3.05e+32 1.26e+31 4.65e+31 0.00e+00
36 0.15 3700 3.05e+32 1.19e+31 4.61e+31 0.00e+00
37 0.15 3800 3.05e+32 9.05e+30 3.55e+31 0.00e+00
38 0.15 3900 3.05e+32 1.28e+31 4.65e+31 0.00e+00
39 0.16 4000 3.05e+32 1.65e+31 5.52e+31 0.00e+00
40 0.16 4100 3.05e+32 8.21e+30 3.48e+31 0.00e+00
41 0.17 4200 3.05e+32 1.05e+31 4.52e+31 0.00e+00
42 0.17 4300 3.05e+32 1.36e+31 5.38e+31 0.00e+00
43 0.17 4400 3.05e+32 1.74e+31 6.13e+31 0.00e+00
44 0.18 4500 3.05e+32 1.74e+31 6.13e+31 0.00e+00
45 0.18 4600 3.05e+32 1.21e+31 4.60e+31 0.00e+00
46 0.19 4700 3.05e+32 1.35e+31 4.69e+31 0.00e+00
47 0.19 4800 3.05e+32 1.34e+31 5.39e+31 0.00e+00
48 0.20 4900 3.05e+32 1.27e+31 5.35e+31 0.00e+00
49 0.20 5000 3.05e+32 1.05e+31 4.52e+31 0.00e+00
50 0.20 5100 3.05e+32 1.44e+31 5.42e+31 0.00e+00
51 0.21 5200 3.05e+32 1.13e+31 4.56e+31 0.00e+00
52 0.21 5300 3.05e+32 1.13e+31 4.56e+31 0.00e+00
53 0.22 5400 3.05e+32 1.42e+31 5.42e+31 0.00e+00
54 0.22 5500 3.05e+32 1.79e+31 6.16e+31 0.00e+00
55 0.23 5600 3.05e+32 1.87e+31 6.19e+31 0.00e+00
56 0.23 5700 3.05e+32 2.10e+31 6.79e+31 0.00e+00
57 0.23 5800 3.05e+32 1.80e+31 6.16e+31 0.00e+00
58 0.24 5900 3.05e+32 1.88e+31 6.18e+31 0.00e+00
59 0.24 6000 3.05e+32 1.87e+31 6.19e+31 0.00e+00
60 0.24 6100 3.05e+32 1.27e+31 4.65e+31 0.00e+00
61 0.25 6200 3.05e+32 1.56e+31 5.48e+31 0.00e+00
62 0.25 6300 3.05e+32 1.65e+31 6.11e+31 0.00e+00
63 0.25 6400 3.05e+32 1.51e+31 5.44e+31 0.00e+00
64 0.26 6500 3.05e+32 1.28e+31 4.64e+31 0.00e+00
65 0.26 6600 3.05e+32 1.49e+31 5.45e+31 0.00e+00
66 0.26 6700 3.05e+32 1.73e+31 6.14e+31 0.00e+00
67 0.27 6800 3.05e+32 1.96e+31 6.75e+31 0.00e+00
68 0.27 6900 3.05e+32 2.11e+31 6.79e+31 0.00e+00
69 0.27 7000 3.05e+32 1.50e+31 5.45e+31 0.00e+00
70 0.28 7100 3.05e+32 1.34e+31 4.69e+31 0.00e+00
71 0.28 7200 3.05e+32 1.63e+31 5.51e+31 0.00e+00
72 0.29 7300 3.05e+32 1.64e+31 6.11e+31 0.00e+00
73 0.29 7400 3.05e+32 1.58e+31 6.08e+31 0.00e+00
74 0.29 7500 3.05e+32 1.36e+31 5.38e+31 0.00e+00
75 0.30 7600 3.05e+32 1.27e+31 5.34e+31 0.00e+00
76 0.30 7700 3.05e+32 1.51e+31 6.05e+31 0.00e+00
77 0.30 7800 3.05e+32 1.82e+31 6.70e+31 0.00e+00
78 0.31 7900 3.05e+32 1.29e+31 5.35e+31 0.00e+00
79 0.31 8000 3.05e+32 1.35e+31 5.38e+31 0.00e+00
80 0.31 8100 3.05e+32 1.28e+31 5.35e+31 0.00e+00
81 0.32 8200 3.05e+32 1.12e+31 4.57e+31 0.00e+00
82 0.32 8300 3.05e+32 1.28e+31 5.35e+31 0.00e+00
83 0.33 8400 3.05e+32 1.28e+31 5.35e+31 0.00e+00
84 0.33 8500 3.05e+32 1.12e+31 5.27e+31 0.00e+00
85 0.33 8600 3.05e+32 1.42e+31 6.02e+31 0.00e+00
86 0.34 8700 3.05e+32 1.19e+31 5.31e+31 0.00e+00
87 0.34 8800 3.05e+32 1.65e+31 6.11e+31 0.00e+00
88 0.34 8900 3.05e+32 1.65e+31 6.11e+31 0.00e+00
89 0.35 9000 3.05e+32 1.35e+31 5.38e+31 0.00e+00
90 0.35 9100 3.05e+32 1.50e+31 5.45e+31 0.00e+00
91 0.36 9200 3.05e+32 1.21e+31 4.60e+31 0.00e+00
92 0.36 9300 3.05e+32 1.27e+31 4.65e+31 0.00e+00
93 0.36 9400 3.05e+32 8.31e+30 3.48e+31 0.00e+00
94 0.37 9500 3.05e+32 1.03e+31 4.52e+31 0.00e+00
95 0.37 9600 3.05e+32 1.26e+31 5.35e+31 0.00e+00
96 0.38 9700 3.05e+32 1.19e+31 5.31e+31 0.00e+00
97 0.38 9800 3.05e+32 1.35e+31 5.38e+31 0.00e+00
98 0.38 9900 3.05e+32 1.49e+31 5.45e+31 0.00e+00
99 0.39 10000 3.05e+32 1.80e+31 6.16e+31 0.00e+00
This diff is collapsed.
/*_____________________________________________________________
Template for an EASEA evolutionary algorithm for easea v1.0.3
This file contains template of ZDT1 problem.
ZDT1 : Zitzler-Deb-Thiele's Test Problem n1.
ZDT1 function contains 2 objectives. It has a convex Pareto-optimal
front.
Reference:
Zitzler, E., Deb, K., Thieler, L. Comparison of multiobjective
evolutionary algorithms: Empirical results. IEEE Trans. on Evol.
Computation 8 (2000) 173-195.
_______________________________________________________________*/
\User declarations : // This section is copied on top of the output file
#include <math.h>
#define NB_VARIABLES 5
#define NB_OBJECTIVES 2
#define NB_CONSTRAINTS 0
#define XOVER_PROB 0.9
#define XOVER_DIST_ID 20.0
#define MUT_PROB 1.0/NB_VARIABLES
#define MUT_DIST_ID 20.0
#define QMETRICS
#define PARETO_TRUE_FILE "paretoZDT1.dat"
#define PBLM_NAME "ZDT1"
\end
\User functions:
inline constexpr double getCrossoverProbability() {
return XOVER_PROB;
}
inline constexpr double getMutationProbability() {
return MUT_PROB;
}
inline constexpr double getCrossoverDistributionId() {
return XOVER_DIST_ID;
}
inline constexpr double getMutationDistributionId() {
return MUT_DIST_ID;
}
inline constexpr int getNumberOfObjectives() {
return NB_OBJECTIVES ;
}
inline constexpr int getNumberOfVariables() {
return NB_VARIABLES ;
}
inline constexpr int getNumberOfConstraints(){
return NB_CONSTRAINTS ;
}
double evalG(int nbVar, CVariable **var) {
double g = 0.0 ;
for (int i = 1; i < nbVar; i++)
g += var[i]->getValue();
double c = 9.0/(nbVar - 1) ;
g = c * g ;
g = g + 1.0 ;
return g;
}
double evalH(double f, double g) {
double h = 0.0 ;
h = 1.0 - sqrt(f/g) ;
return h ;
}
\end
\User CUDA:
//Transfert some variables to GPU here (cudaMalloc, MemCpy)
\end
\User classes :
GenomeClass {
// need to declare the genome here
int x;
}
\end
\Before everything else function:
//cout<<"Before everything else function called "<<endl;
\end
\After everything else function:
//cout << "After everything else function called" << endl;
\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
\GenomeClass::display:
\end
\GenomeClass::initialiser : // "initializer" is also accepted
// the genome to initialise is known as "Genome"
setNumberOfVariables(NB_VARIABLES);
setNumberOfObjectives(NB_OBJECTIVES);
setNumberOfConstraints(NB_CONSTRAINTS);
lowerBound_ = new double[nbVar_];
if (lowerBound_ == nullptr)
LOG_ERROR(errorCode::memory, "memory wasn't allocated for lower bounds");
upperBound_ = new double[nbVar_];
if (upperBound_ == nullptr)
LOG_ERROR(errorCode::memory, "memory wasn't allocated for upper bounds");
for (int i = 0; i < nbVar_; i++) {
lowerBound_[i] = 0.0;
upperBound_[i] = 1.0;
}
\end
\GenomeClass::crossover :
// must create "child" out of "parent1" and "parent2"
\end
\GenomeClass::mutator : // Must return the number of mutations
// must mutate "Genome"
return 0;
\end
\GenomeClass::evaluator : // Returns the score as a real value
// uses Genome to evaluate the quality of the individual
if (objective_ == nullptr)
objective_ = new double[getNumberOfObjectives()];
objective_[0] = getIndividualVariables()[0]->getValue();
double g = evalG(getNumberOfVariables(), getIndividualVariables());
double h = evalH(objective_[0], g);
objective_[1] = h * g ;
return 0.0;
\end
\User Makefile options:
\end
\Default run parameters : // Please let the parameters appear in this order
Number of generations : 25000 // NB_GEN
Time limit: 0 // In seconds, 0 to deactivate
Population size : 100 //POP_SIZE
Offspring size : 100 // or a xx%
// Mutation probability : 1.0 // MUT_PROB
// Crossover probability : 0.9 // XOVER_PROB
Evaluator goal : maximize // maximise
Selection operator: Tournament 2.0
/* Surviving parents: 100% // Percentage or absolute
Surviving offspring: 100% // Percentage or absolute */
Reduce parents operator: Tournament 2
Reduce offspring operator: Tournament 2
/* Final reduce operator: Tournament 2 */
Elitism: Strong // Weak or Strong
Elite: 1
Print stats: true // Default: 1
Generate csv stats file:false
Generate gnuplot script:false
Generate R script:false
Plot stats: false // Default: 0
Save population: false
/* Remote island model: false
IP file: ip.txt // List of IP:PORT of islands to send individuals to
Migration probability: 0.33 // Probability of sending an individual per generation
Server port : 2929
Save population: true
Start from file:false
*/
\end
This diff is collapsed.
/*_____________________________________________________________
Template for an EASEA evolutionary algorithm for easea v1.0.3
This file contains template of ZDT1 problem.
ZDT2 : Zitzler-Deb-Thiele's Test Problem n2.
ZDT2 function contains 2 objectives. It has a non-convex Pareto
-optimal front.
Reference:
Zitzler, E., Deb, K., Thieler, L. Comparison of multiobjective
evolutionary algorithms: Empirical results. IEEE Trans. on Evol.
Computation 8 (2000) 173-195. Zitzler, E., Deb, K., Thieler, L.
Comparison of multiobjective evolutionary algorithms: Empirical
results. IEEE Trans. on Evol. Computation 8 (2000) 173-195.
_______________________________________________________________*/
\User declarations : // This section is copied on top of the output file
#include <math.h>
#define NB_VARIABLES 5 // Number of variables
#define NB_OBJECTIVES 2 // Number of objectives
#define NB_CONSTRAINTS 0 // Number of constraints
#define XOVER_PROB 0.9 // Crossover probability
#define XOVER_DIST_ID 20.0 // Crossover distribution index
#define MUT_PROB 1.0/NB_VARIABLES // Mutation probability
#define MUT_DIST_ID 20.0 // Mutation distribution index
#define QMETRICS // Switch on quality indicator
#define PARETO_TRUE_FILE "paretoZDT2.dat" // File name of pareto optimal
#define PBLM_NAME "ZDT2" // Problem name
\end
\User functions:
inline constexpr double getCrossoverProbability() {
return XOVER_PROB;
}
inline constexpr double getMutationProbability() {
return MUT_PROB;
}
inline constexpr double getCrossoverDistributionId() {
return XOVER_DIST_ID;
}
inline constexpr double getMutationDistributionId() {
return MUT_DIST_ID;
}
inline constexpr int getNumberOfObjectives() {
return NB_OBJECTIVES ;
}
inline constexpr int getNumberOfVariables() {
return NB_VARIABLES ;
}
inline constexpr int getNumberOfConstraints(){
return NB_CONSTRAINTS ;
}
double evalG(int nbVar, CVariable **var) {
double g = 0.0 ;
for (int i = 1; i < nbVar; i++)
g += var[i]->getValue();
double c = 9.0/(nbVar - 1) ;
g = c * g ;
g = g + 1.0 ;
return g;
}
double evalH(double f, double g) {
double h = 0.0 ;
h = 1.0 - power<2>(f/g) ;
return h ;
}
\end
\User CUDA:
//Transfert some variables to GPU here (cudaMalloc, MemCpy)
\end
\User classes :
GenomeClass {
// need to declare the genome here
int x;
}
\end
\Before everything else function:
//cout<<"Before everything else function called "<<endl;
\end
\After everything else function:
//cout << "After everything else function called" << endl;
\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
\GenomeClass::display:
\end
\GenomeClass::initialiser : // "initializer" is also accepted
// the genome to initialise is known as "Genome"
setNumberOfVariables(NB_VARIABLES);
setNumberOfObjectives(NB_OBJECTIVES);
setNumberOfConstraints(NB_CONSTRAINTS);
lowerBound_ = new double[nbVar_];
if (lowerBound_ == nullptr)
LOG_ERROR(errorCode::memory, "memory wasn't allocated for lower bounds");
upperBound_ = new double[nbVar_];
if (upperBound_ == nullptr)
LOG_ERROR(errorCode::memory, "memory wasn't allocated for upper bounds");
for (int i = 0; i < nbVar_; i++) {
lowerBound_[i] = 0.0;
upperBound_[i] = 1.0;
}
\end
\GenomeClass::crossover :
// must create "child" out of "parent1" and "parent2"
\end
\GenomeClass::mutator : // Must return the number of mutations
// must mutate "Genome"
return 0;
\end
\GenomeClass::evaluator : // Returns the score as a real value
// uses Genome to evaluate the quality of the individual
if (objective_ == nullptr)
objective_ = new double[getNumberOfObjectives()];
objective_[0] = getIndividualVariables()[0]->getValue();
double g = evalG(getNumberOfVariables(), getIndividualVariables());
double h = evalH(objective_[0], g);
objective_[1] = h * g ;
return 0.0;
\end
\User Makefile options:
\end
\Default run parameters : // Please let the parameters appear in this order
Number of generations : 25000 // NB_GEN
Time limit: 0 // In seconds, 0 to deactivate
Population size : 100 //POP_SIZE
Offspring size : 100 // or a xx%
Mutation probability : 1.0 // MUT_PROB
Crossover probability : 0.9 // XOVER_PROB
Evaluator goal : maximize // maximise
Selection operator: Tournament 2.0
/* Surviving parents: 100% // Percentage or absolute
Surviving offspring: 100% // Percentage or absolute */
Reduce parents operator: Tournament 2
Reduce offspring operator: Tournament 2
/* Final reduce operator: Tournament 2 */
Elitism: Strong // Weak or Strong
Elite: 1
Print stats: true // Default: 1
Generate csv stats file:false
Generate gnuplot script:false
Generate R script:false
Plot stats: false // Default: 0
Save population: false
/*
Remote island model: false
IP file: ip.txt // List of IP:PORT of islands to send individuals to
Migration probability: 0.33 // Probability of sending an individual per generation
Server port : 2929
Save population: true
Start from file:false */
\end
0.0000000000 1.0000000000
0.0020040080 0.9551077674
0.0040080160 0.9361877672
0.0060120240 0.9213339853