Commit cdb0b93f authored by Julien Gamba's avatar Julien Gamba

Add back the globals variables OFFSPRING_SIZE, POP_SIZE to non CUDA templates

parent 2b373016
......@@ -24,6 +24,9 @@ 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;
CCmaes *cma;
......@@ -316,6 +319,8 @@ CEvolutionaryAlgorithm* ParametersImpl::newEvolutionaryAlgorithm(){
pEZ_XOVER_PROB = &pCrossover;
EZ_NB_GEN = (unsigned*)setVariable("nbGen",\NB_GEN);
EZ_current_generation=0;
EZ_POP_SIZE = parentPopulationSize;
OFFSPRING_SIZE = offspringPopulationSize;
CEvolutionaryAlgorithm* ea = new EvolutionaryAlgorithmImpl(this);
generationalCriterion->setCounterEa(ea->getCurrentGenerationPtr());
......@@ -380,6 +385,9 @@ class CPopulation;
class CCmaes;
class Parameters;
extern int EZ_POP_SIZE;
extern int OFFSPRING_SIZE;
extern CCmaes *cma;
\INSERT_USER_CLASSES_DEFINITIONS
......
......@@ -23,6 +23,9 @@ 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){
......@@ -480,6 +483,8 @@ CEvolutionaryAlgorithm* ParametersImpl::newEvolutionaryAlgorithm(){
pEZ_XOVER_PROB = &pCrossover;
EZ_NB_GEN = (unsigned*)setVariable("nbGen",\NB_GEN);
EZ_current_generation=0;
EZ_POP_SIZE = parentPopulationSize;
OFFSPRING_SIZE = offspringPopulationSize;
CEvolutionaryAlgorithm* ea = new EvolutionaryAlgorithmImpl(this);
generationalCriterion->setCounterEa(ea->getCurrentGenerationPtr());
......@@ -545,6 +550,9 @@ class CEvolutionaryAlgorithm;
class CPopulation;
class Parameters;
extern int EZ_POP_SIZE;
extern int OFFSPRING_SIZE;
\INSERT_USER_CLASSES_DEFINITIONS
class IndividualImpl : public CIndividual {
......
......@@ -23,6 +23,9 @@ 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){
......@@ -336,6 +339,8 @@ CEvolutionaryAlgorithm* ParametersImpl::newEvolutionaryAlgorithm(){
pEZ_XOVER_PROB = &pCrossover;
EZ_NB_GEN = (unsigned*)setVariable("nbGen",\NB_GEN);
EZ_current_generation=0;
EZ_POP_SIZE = parentPopulationSize;
OFFSPRING_SIZE = offspringPopulationSize;
CEvolutionaryAlgorithm* ea = new EvolutionaryAlgorithmImpl(this);
generationalCriterion->setCounterEa(ea->getCurrentGenerationPtr());
......@@ -406,6 +411,9 @@ class CEvolutionaryAlgorithm;
class CPopulation;
class Parameters;
extern int EZ_POP_SIZE;
extern int OFFSPRING_SIZE;
\INSERT_USER_CLASSES_DEFINITIONS
class IndividualImpl : public CIndividual {
......
......@@ -9,6 +9,9 @@ using namespace std;
#include "EASEAIndividual.hpp"
#include <time.h>
int EZ_POP_SIZE;
int OFFSPRING_SIZE;
RandomGenerator* globalRandomGenerator;
......@@ -217,6 +220,8 @@ EvolutionaryAlgorithm::EvolutionaryAlgorithm( size_t parentPopulationSize,
SelectionOperator* selectionOperator, SelectionOperator* replacementOperator,
float pCrossover, float pMutation,
float pMutationPerGene, string& outputfile, string& inputfile){
EZ_POP_SIZE = parentPopulationSize;
OFFSPRING_SIZE = offspringPopulationSize;
RandomGenerator* rg = globalRandomGenerator;
......@@ -352,6 +357,10 @@ bool EvolutionaryAlgorithm::allCriteria(){
#include <ostream>
#include <sstream>
using namespace std;
extern int EZ_POP_SIZE;
extern int OFFSPRING_SIZE;
\INSERT_USER_CLASSES
\START_CUDA_GENOME_H_TPL
......
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