ParallelGA. More...

Inheritance diagram for ParallelGA:

List of all members.

Classes

class  evaluationThread

Public Member Functions

 ParallelGA ()
 Constructor.
virtual ~ParallelGA ()
 Destructor.
virtual void configure (ConfigurationParameters &params, QString prefix)
 Configure the object using the ConfigurationParameters specified.
virtual QVector< Evaluation * > evaluationPool ()
 Return the Evaluation Pool containing the Evaluations used.
virtual EvaluationevaluationPrototype ()
 Returns the Evaluation object used as prototype to eventually generate other evaluators.
virtual void finalize ()
 Finalize the Genetic Algorithm Process.
virtual void gaStep ()
 Execute a single minor step and return.
virtual void initialize ()
 Initializes the Genetic Algorithm Process and sets current generation to zero.
int numThreads ()
 Return the number of thread currently used.
Reproductionreproduction ()
 Return the Reproduction operator.
virtual void save (ConfigurationParameters &params, QString prefix)
 Save the actual status of parameters into the ConfigurationParameters object passed.
void setEvaluation (Evaluation *fitfunc)
 Set the fitness function to use.
void setNumThreads (int numThreads)
 Set the number of thread to use; or in other words the number of parallel evaluation of Genotypes.
void setReproduction (Reproduction *reproduct)
 Set the Reproduction operator to use.
virtual void skipEvaluation ()
 Skip the evaluation phase and put the algorithm in the state just after the evaluation.

Static Public Member Functions

static void describe (QString type)
 Add to Factory::typeDescriptions() the descriptions of all parameters and subgroups.

Protected Types

enum  GAPhases {
  initEvaluation, evaluating, nextGeneration_pass1, nextGeneration_pass2,
  endEvolution
}
 

used for manage GA cycle

More...

Protected Attributes

GAPhases currPhase
 current Phase
Evaluationfitfunc
 fitness function
bool isFinalized
 True if SimpleGA is finalized.
bool isInitialized
 True if SimpleGA is initialized.
Reproductionreprod
 reproduction operator

Detailed Description

ParallelGA.

Description
ParallelGA implements a Simple Genetic Algorithm, some features are:
  • you can customize Reproduction process using setReproduction
  • you can customize, of course, the Fitness function using setEvaluation
  • it use a multi-thread approach for parallel evaluation of Genotypes (see numThreads)
Warnings

Definition at line 44 of file parallelga.h.


Member Enumeration Documentation

enum GAPhases [protected]

used for manage GA cycle

Definition at line 107 of file parallelga.h.


Constructor & Destructor Documentation

~ParallelGA ( ) [virtual]

Destructor.

Definition at line 43 of file parallelga.cpp.

References ParallelGA::fitfunc.


Member Function Documentation

void configure ( ConfigurationParameters params,
QString  prefix 
) [virtual]

Configure the object using the ConfigurationParameters specified.

Parameters:
paramsthe object with configuration parameters
prefixthe group in which parameters are expected to be (this is terminated by a separator character). We expect to receive as prefix the groupwhich contains all GA parameters

Implements ParameterSettableWithConfigureFunction.

Definition at line 50 of file parallelga.cpp.

References ParallelGA::fitfunc, GeneticAlgo::genome(), ConfigurationParameters::getObjectFromGroup(), ConfigurationParameters::getValue(), GeneticAlgo::numGenerations(), ParallelGA::setEvaluation(), Evaluation::setGenome(), GeneticAlgo::setGenome(), GeneticAlgo::setNumGenerations(), ParallelGA::setNumThreads(), and ParallelGA::setReproduction().

QVector< Evaluation * > evaluationPool ( ) [virtual]

Return the Evaluation Pool containing the Evaluations used.

Implements GeneticAlgo.

Definition at line 111 of file parallelga.cpp.

Evaluation * evaluationPrototype ( ) [virtual]

Returns the Evaluation object used as prototype to eventually generate other evaluators.

This object could be or could be not used to compute the fitness of genotypes (depending on the specific genetic algorithm)

Implements GeneticAlgo.

Definition at line 106 of file parallelga.cpp.

References ParallelGA::fitfunc.

void finalize ( ) [virtual]

Finalize the Genetic Algorithm Process.

Implements GeneticAlgo.

Definition at line 222 of file parallelga.cpp.

References GeneticAlgo::evolutionEnd, ParallelGA::isFinalized, and ParallelGA::isInitialized.

Referenced by ParallelGA::gaStep().

void initialize ( ) [virtual]

Initializes the Genetic Algorithm Process and sets current generation to zero.

Implements GeneticAlgo.

Definition at line 128 of file parallelga.cpp.

References ParallelGA::currPhase, GeneticAlgo::evaluationDone, GeneticAlgo::evolutionEnd, ParallelGA::fitfunc, ParallelGA::isFinalized, ParallelGA::isInitialized, ParallelGA::reprod, and GeneticAlgo::setGeneration().

int numThreads ( )

Return the number of thread currently used.

Definition at line 97 of file parallelga.cpp.

Referenced by ParallelGA::save(), and ParallelGA::setNumThreads().

Reproduction * reproduction ( )

Return the Reproduction operator.

Definition at line 124 of file parallelga.cpp.

References ParallelGA::reprod.

Referenced by ParallelGA::save().

void save ( ConfigurationParameters params,
QString  prefix 
) [virtual]

Save the actual status of parameters into the ConfigurationParameters object passed.

Parameters:
paramsthe configuration parameters object on which save actual parameters
prefixthe prefix to use to access the object configuration parameters.

Implements ParameterSettable.

Definition at line 62 of file parallelga.cpp.

References ConfigurationParameters::createParameter(), ConfigurationParameters::createSubGroup(), ParallelGA::fitfunc, GeneticAlgo::genome(), GeneticAlgo::numGenerations(), ParallelGA::numThreads(), ParallelGA::reproduction(), Genome::save(), and ParameterSettable::save().

void setEvaluation ( Evaluation fitfunc)

Set the fitness function to use.

Definition at line 101 of file parallelga.cpp.

References ParallelGA::fitfunc, and Evaluation::setGA().

Referenced by ParallelGA::configure().

void setNumThreads ( int  numThreads)

Set the number of thread to use; or in other words the number of parallel evaluation of Genotypes.

Definition at line 83 of file parallelga.cpp.

References ParallelGA::fitfunc, ParallelGA::isFinalized, ParallelGA::isInitialized, and ParallelGA::numThreads().

Referenced by ParallelGA::configure().

void setReproduction ( Reproduction reproduct)

Set the Reproduction operator to use.

Definition at line 119 of file parallelga.cpp.

References ParallelGA::reprod, and Reproduction::setGA().

Referenced by ParallelGA::configure().

void skipEvaluation ( ) [virtual]

Skip the evaluation phase and put the algorithm in the state just after the evaluation.

This can be used after restarting an interrupted evolution to prevent re-evaluation of the genome that was loaded from file.

Implements GeneticAlgo.

Definition at line 212 of file parallelga.cpp.

References ParallelGA::currPhase, GeneticAlgo::evaluationDone, GeneticAlgo::generation(), and GeneticAlgo::numGens.


Member Data Documentation

bool isFinalized [protected]

True if SimpleGA is finalized.

Definition at line 113 of file parallelga.h.

Referenced by ParallelGA::finalize(), ParallelGA::initialize(), ParallelGA::ParallelGA(), and ParallelGA::setNumThreads().

bool isInitialized [protected]

True if SimpleGA is initialized.

Definition at line 111 of file parallelga.h.

Referenced by ParallelGA::finalize(), ParallelGA::initialize(), ParallelGA::ParallelGA(), and ParallelGA::setNumThreads().


The documentation for this class was generated from the following files: