Back to Top page.

EGTControl< TP > Class Template Reference

Class template for an EGG system flow. More...

#include <EGTControl.h>

Collaboration diagram for EGTControl< TP >:

Collaboration graph
[legend]
List of all members.

Public Types

typedef TP Pop
typedef Pop::Graph Graph
typedef EGTVector< const Graph * > Graphs
typedef Graph::SubGraph SubGraph
typedef Graph::Node Node
typedef Graph::Fitness Fitness

Public Methods

 EGTControl ()
 Constructor.

virtual ~EGTControl ()
 Destructor.

virtual void InitControl ()
 Initialization.

virtual void LoadControl ()
 Initializes a Population by loading the data.

virtual void SaveControl () const
 Records the data for resumption.

virtual void LoadTarget (const char *filename)=0
virtual void SetEvaluation (EGTEvaluation< TP > *=0)=0
 Sets the evaluation algorithm.

virtual void SetSelection (EGTSelection< TP > *=0)
 Sets the selection algorithm.

virtual void SetSelection2 (EGTSelection< TP > *=0)
 Sets the selection algorithm.

virtual void SetMutation (EGTMutation< TP > *=0)
 Sets the mutation algorithm.

virtual void SetCrossover (EGTCrossover< TP > *=0)
 Sets the crossover algorithm.

virtual void Execute (std::ostream &)
 Performs the overall procedure of EGG.


Protected Types

enum  MeasureOp { START, STOP, LAP }
 Operation ID number for time measurement. More...


Protected Methods

virtual void NextGeneration ()
 Evolves the Population by one generation.

void SaveLogFiles (UInt, MeasureOp)
 Saves log files.

void SaveTimeLog (UInt, MeasureOp)
 Records the execution time of each generation.

void SaveFitnessLog (UInt) const
 Records the fitness values of each generation.

void SavePopLog (UInt) const
 Records the Population data in ????th generation.

virtual void SaveBestLog (UInt) const
 Records the best Graph data in ????th generation.

virtual void SaveBestDot (UInt) const
 Records the best Graph data in ????th generation (in DOT file format).

virtual void SaveGeneration (UInt) const
 Records all the Graph data of current population.


Protected Attributes

Popm_tPop
 Population.

EGTEvaluation< TP > * m_tEvaluation
 Evaluation.

EGTSelection< TP > * m_tSelection
 Selection.

EGTSelection< TP > * m_tSelection2
 Selection.

EGTMutation< TP > * m_tMutation
 Mutation.

EGTCrossover< TP > * m_tCrossover
 Crossover.

EGMeasure m_tMeasure
 Measure.

Node m_Creator
 Node for creating new Nodes.

bool m_bEvolved
 Flag indicating whether the best Graph is updated.


Detailed Description

template<class TP>
class EGTControl< TP >

Class template for an EGG system flow.

It is assumed that <TP> is a subclass of EGTPopulation.


Member Typedef Documentation

template<class TP>
typedef Graph::Fitness EGTControl< TP >::Fitness
 

template<class TP>
typedef Pop::Graph EGTControl< TP >::Graph
 

template<class TP>
typedef EGTVector<const Graph*> EGTControl< TP >::Graphs
 

template<class TP>
typedef Graph::Node EGTControl< TP >::Node
 

template<class TP>
typedef TP EGTControl< TP >::Pop
 

template<class TP>
typedef Graph::SubGraph EGTControl< TP >::SubGraph
 


Member Enumeration Documentation

template<class TP>
enum EGTControl::MeasureOp [protected]
 

Operation ID number for time measurement.

Enumeration values:
START 
STOP 
LAP 


Constructor & Destructor Documentation

template<class TP>
EGTControl< TP >::EGTControl  
 

Constructor.

template<class TP>
EGTControl< TP >::~EGTControl   [virtual]
 

Destructor.


Member Function Documentation

template<class TP>
void EGTControl< TP >::Execute std::ostream &    out [virtual]
 

Performs the overall procedure of EGG.

Parameters:
out  [out] Output stream (egg.log)

template<class TP>
void EGTControl< TP >::InitControl   [virtual]
 

Initialization.

template<class TP>
void EGTControl< TP >::LoadControl   [virtual]
 

Initializes a Population by loading the data.

template<class TP>
virtual void EGTControl< TP >::LoadTarget const char *    filename [pure virtual]
 

template<class TP>
void EGTControl< TP >::NextGeneration   [protected, virtual]
 

Evolves the Population by one generation.

This function executes some evolutionary operations in the following order.

  1. Selects Graphs from the Population by using the selection operations, and puts them in a array of Graphs.
  2. Performs crossover operations to the array of Graphs, and puts offsprings to the next Population.
  3. Performs mutation operations to the array of Graphs, and puts offsprings to the next Population.
  4. Selects Graphs from the Population by using the selection operations, and puts them to the next Population.
  5. Evaluates all the Graphs of the next Population.

template<class TP>
void EGTControl< TP >::SaveBestDot UInt    i const [protected, virtual]
 

Records the best Graph data in ????th generation (in DOT file format).

File name: best????.dot (???? is the number of generations.)
The data files is used as the source files of "GraphViz".
GraphViz is a product of AT&T Research.
It provides a collection of tools for manipulating Graph structures and generating Graph layouts.
For more information, see http://www.research.att.com/sw/tools/graphviz/ .

template<class TP>
void EGTControl< TP >::SaveBestLog UInt    i const [protected, virtual]
 

Records the best Graph data in ????th generation.

File name: best????.log (???? is the number of generations.)

template<class TP>
void EGTControl< TP >::SaveControl   const [virtual]
 

Records the data for resumption.

template<class TP>
void EGTControl< TP >::SaveFitnessLog UInt    i const [protected]
 

Records the fitness values of each generation.

File name: fitness.log

template<class TP>
void EGTControl< TP >::SaveGeneration UInt    n const [protected, virtual]
 

Records all the Graph data of current population.

File name: ??/??-xx.dot, ??/??-xx.log (??: The number of generations, xx: Graph ID)

Parameters:
n  [in] Current number of generation.

template<class TP>
void EGTControl< TP >::SaveLogFiles UInt    i,
MeasureOp    op
[protected]
 

Saves log files.

time.log: the execution time of each generation
fitness.log: the fitness values of each generation
pop????.log: the Population data in ????th generation
best????.log: the best Graph data in ????th generation
best????.dot: the best Graph data in ????th generation (in DOT file format)

template<class TP>
void EGTControl< TP >::SavePopLog UInt    i const [protected]
 

Records the Population data in ????th generation.

File name: pop????.log (???? is the number of generations.)

template<class TP>
void EGTControl< TP >::SaveTimeLog UInt    i,
MeasureOp    ope
[protected]
 

Records the execution time of each generation.

File name: time.log

template<class TP>
void EGTControl< TP >::SetCrossover EGTCrossover< TP > *    pc = 0 [virtual]
 

Sets the crossover algorithm.

Parameters:
pc  [in] Crossover algorithm

template<class TP>
virtual void EGTControl< TP >::SetEvaluation EGTEvaluation< TP > *    = 0 [pure virtual]
 

Sets the evaluation algorithm.

template<class TP>
void EGTControl< TP >::SetMutation EGTMutation< TP > *    pm = 0 [virtual]
 

Sets the mutation algorithm.

Parameters:
pm  [in] Mutation algorithm

template<class TP>
void EGTControl< TP >::SetSelection EGTSelection< TP > *    ps = 0 [virtual]
 

Sets the selection algorithm.

Sets the selection algorithm for selecting Graphs to be manipulated by evolutionary operations.

Parameters:
ps  [in] Selection algorithm

template<class TP>
void EGTControl< TP >::SetSelection2 EGTSelection< TP > *    ps = 0 [virtual]
 

Sets the selection algorithm.

Sets the selection algorithm for selecting Graphs to be in the next generation.

Parameters:
ps  [in] Selection algorithm


Member Data Documentation

template<class TP>
bool EGTControl< TP >::m_bEvolved [protected]
 

Flag indicating whether the best Graph is updated.

template<class TP>
Node EGTControl< TP >::m_Creator [protected]
 

Node for creating new Nodes.

template<class TP>
EGTCrossover<TP>* EGTControl< TP >::m_tCrossover [protected]
 

Crossover.

template<class TP>
EGTEvaluation<TP>* EGTControl< TP >::m_tEvaluation [protected]
 

Evaluation.

template<class TP>
EGMeasure EGTControl< TP >::m_tMeasure [protected]
 

Measure.

template<class TP>
EGTMutation<TP>* EGTControl< TP >::m_tMutation [protected]
 

Mutation.

template<class TP>
Pop* EGTControl< TP >::m_tPop [protected]
 

Population.

template<class TP>
EGTSelection<TP>* EGTControl< TP >::m_tSelection [protected]
 

Selection.

template<class TP>
EGTSelection<TP>* EGTControl< TP >::m_tSelection2 [protected]
 

Selection.


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