27 #ifndef SINGLETONGENALGAPI_H_
28 #define SINGLETONGENALGAPI_H_
33 #include <selforg/randomgenerator.h>
68 void select(
bool createNextGeneration=
true);
78 void update(
double factor = 1.5);
86 void prepare(
int startSize,
int numChildren,
RandGen* random,
bool withUpdate =
true);
103 void runGenAlg(
int startSize,
int numChildren,
int numGeneration,
RandGen* random);
357 bool m_cleanStrategies;
ISelectStrategy * createTournamentSelectStrategy(RandGen *random) const
creates a tournament SelctStrategy.
Definition: SingletonGenAlgAPI.cpp:137
void select(bool createNextGeneration=true)
starts the selection
Definition: SingletonGenAlgAPI.cpp:153
Individual * getBestIndividual(void)
returns the best individual (where the fitness is next to zero) which the alg.
Definition: SingletonGenEngine.cpp:311
IFitnessStrategy * createEuclidicDistanceFitnessStrategy() const
creates a EuclidicFitnessStrategy.
Definition: SingletonGenAlgAPI.cpp:93
this interface is for a select strategy of the generation class.
Definition: ISelectStrategy.h:36
IFitnessStrategy * createExtreamTestFitnessStrategy(IFitnessStrategy *fitness) const
creates a TestFitnessStrategy which is the hardest test for a gen.
Definition: SingletonGenAlgAPI.cpp:97
void enableGenContextMeasure(std::list< PlotOption > &plotOptions)
enable data measure inside the GenContexts with more than one plotOption
Definition: SingletonGenAlgAPI.cpp:227
void setSelectStrategy(ISelectStrategy *strategy)
decid the select strategy
Definition: SingletonGenEngine.h:217
Individual * getBestIndividual(void) const
returns the best individual which the alg.
Definition: SingletonGenAlgAPI.h:316
IFitnessStrategy * createSumFitnessStrategy() const
creates a SumFitnessStrategy.
Definition: SingletonGenAlgAPI.cpp:89
IMutationFactorStrategy * createFixMutationFactorStrategy(IValue *value) const
creates a mutation factor strategy with a fix value
Definition: SingletonGenAlgAPI.cpp:117
IMutationFactorStrategy * createStandartMutationFactorStrategy(void) const
creates a mutation factor strategy with a optimized value (varianz about all existing gens) ...
Definition: SingletonGenAlgAPI.cpp:121
This interface gives the structur for the mutation of a gen.
Definition: IMutationStrategy.h:39
void setFitnessStrategy(IFitnessStrategy *strategy)
decide the fitness strategy.
Definition: SingletonGenEngine.h:229
IFitnessStrategy * createTestFitnessStrategy() const
creates the test function fitness strategy from the papper tp this alg.
Definition: SingletonGenAlgAPI.cpp:101
IGenerationSizeStrategy * createStandartGenerationSizeStrategy(int startSize, int numGeneration) const
creates a generation size strategy with a optimized size for the generation (changing by speed of dev...
Definition: SingletonGenAlgAPI.cpp:129
void runGenAlg(int startSize, int numChildren, int numGeneration, RandGen *random)
start the sequenz of select, crossover, update in a automatically loop
Definition: SingletonGenAlgAPI.cpp:192
The Gen class.
Definition: Gen.h:51
The GenContext class.
Definition: GenContext.h:51
Definition: plotoptionengine.h:38
random generator with 48bit integer arithmentic
Definition: randomgenerator.h:34
ISelectStrategy * createRandomSelectStrategy(RandGen *random) const
creates a random select strategy.
Definition: SingletonGenAlgAPI.cpp:141
void setGenerationSizeStrategy(IGenerationSizeStrategy *strategy)
set the generation size strategy
Definition: SingletonGenAlgAPI.h:142
This is a interface for a strategy, which is used by ValueMutationStrategy.
Definition: IMutationFactorStrategy.h:40
PlotOptionEngine * getPlotOptionEngine(void) const
returns the active plotOptionEngine for data measure.
Definition: SingletonGenAlgAPI.h:120
The interface for the fitness strategy of an individual.
Definition: IFitnessStrategy.h:36
static SingletonGenAlgAPI * m_api
the api
Definition: SingletonGenAlgAPI.h:322
GenPrototype * createPrototype(std::string name, IRandomStrategy *randomStrategy, IMutationStrategy *mutationStrategy) const
create a prototype.
Definition: SingletonGenAlgAPI.cpp:196
This class contains options for the use of an external plot utility like guilogger or neuronviz or ju...
Definition: plotoption.h:66
void prepare()
prepares the next generation and optional the enabled measure
Definition: SingletonGenAlgAPI.cpp:170
ISelectStrategy * createEliteSelectStrategy(void) const
creates a elite select strategy
Definition: SingletonGenAlgAPI.cpp:133
This is the engine of the gen.
Definition: SingletonGenEngine.h:64
IValue * createDoubleValue(double value) const
creates a IValue (TemplateValue<double) from type double.
Definition: SingletonGenAlgAPI.cpp:145
this interface is to create a random IValue.
Definition: IRandomStrategy.h:36
IMutationStrategy * createValueMutationStrategy(IMutationFactorStrategy *strategy, int mutationProbability) const
creates mutation strategy which change the old values by add a other value
Definition: SingletonGenAlgAPI.cpp:113
This interface is to specify how big the next generation should be.
Definition: IGenerationSizeStrategy.h:36
The GenPrototype class.
Definition: GenPrototype.h:55
void enableMeasure(std::list< PlotOption > &plotOptions)
enables data measure with more than one plotOption.
Definition: SingletonGenAlgAPI.cpp:211
PlotOptionEngine * m_plotEngineGenContext
plot option engine for gen contexts
Definition: SingletonGenAlgAPI.h:332
PlotOptionEngine * m_plotEngine
plot option engine for data measure
Definition: SingletonGenAlgAPI.h:327
The Generation class.
Definition: Generation.h:53
This class is a interface for a value which is part of a gen.
Definition: IValue.h:38
IRandomStrategy * createDoubleRandomStrategy(RandGen *random, double base=0.0, double factor=1.0, double epsilon=0.0) const
creates a random strategy for double values.
Definition: SingletonGenAlgAPI.cpp:109
static void destroyAPI(bool cleanStrategies=false)
destroy the api
Definition: SingletonGenAlgAPI.h:309
bool restoreGA(FILE *f) const
loads the object from the given file stream (binary).
Definition: SingletonGenAlgAPI.cpp:240
This is a facade for the gen.
Definition: SingletonGenAlgAPI.h:61
void measureStep(double time)
makes a step in the measure
Definition: SingletonGenAlgAPI.cpp:188
void setFitnessStrategy(IFitnessStrategy *strategy)
set the fitness strategy
Definition: SingletonGenAlgAPI.h:147
SingletonGenEngine * getEngine(void) const
returns the GenAlgEngine
Definition: SingletonGenAlgAPI.cpp:149
void insertGenPrototype(GenPrototype *prototype)
add a GenPrototype to the alg.
Definition: SingletonGenAlgAPI.cpp:200
bool storeGA(FILE *f) const
stores the object to the given file stream (binary).
Definition: SingletonGenAlgAPI.cpp:236
static SingletonGenAlgAPI * getInstance(void)
returns the one and only API to the alg.
Definition: SingletonGenAlgAPI.h:304
void setGenerationSizeStrategy(IGenerationSizeStrategy *strategy)
decide the generation size strategy.
Definition: SingletonGenEngine.h:223
This class represent one individual of the complete gen.
Definition: Individual.h:45
void update(double factor=1.5)
update the internal statistical data
Definition: SingletonGenAlgAPI.cpp:162
IFitnessStrategy * createInvertedFitnessStrategy(IFitnessStrategy *strategy) const
returns a fitness strategy which calculate the inverse value from a other strategy.
Definition: SingletonGenAlgAPI.cpp:105
void setSelectStrategy(ISelectStrategy *strategy)
set the select strategy
Definition: SingletonGenAlgAPI.h:152
IGenerationSizeStrategy * createFixGenerationSizeStrategy(int value) const
creates a generation size strategy with a fix value
Definition: SingletonGenAlgAPI.cpp:125
static SingletonGenEngine * getInstance(void)
returns the only existing engine.
Definition: SingletonGenEngine.h:269
void crossover(RandGen *random)
create the children from to fill up the next generation
Definition: SingletonGenAlgAPI.cpp:157
PlotOptionEngine * getPlotOptionEngineForGenContext(void) const
returns the active plotOptionEngine for data measure inside the GenContexts.
Definition: SingletonGenAlgAPI.h:135