The Fib multimedia system
Fib is a system for storing multimedia data (like images or films).
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
enviroment::cOperatorFitnessAlgorithmBasic Class Reference

#include <cOperatorFitnessAlgorithmBasic.h>

Inheritance diagram for enviroment::cOperatorFitnessAlgorithmBasic:
Collaboration diagram for enviroment::cOperatorFitnessAlgorithmBasic:

List of all members.

Public Member Functions

 cOperatorFitnessAlgorithmBasic (double dInFaktorAllFitnessPart=0.5, double dInFaktorPositivFitnessPart=0.5, const string szOldOperationDataPath="")
 cOperatorFitnessAlgorithmBasic (const cOperatorFitnessAlgorithmBasic &opFitnessAlgorithmBasic)
virtual ~cOperatorFitnessAlgorithmBasic ()
virtual double evalueFitness (const cOperation &operation, const list< cIndividualInfo > &liCreatedIndividualInfos)
virtual double updateFitness (const cOperation &operation, const cIndividualInfo &createdIndividualInfo)
virtual double updateFitness (const cOperation &operation, const list< cIndividualInfo > &liCreatedIndividualInfos)
virtual double getFitness (const cOperation &operation)
virtual list< pair< const
cOperation *, double > > 
getFitness ()
virtual string getClassName () const
virtual double getMinFitness () const
virtual double getFitnessSum () const
double getFaktorAllFitnessPart () const
double getFaktorPositivFitnessPart () const
- Public Member Functions inherited from enviroment::cOperatorFitnessAlgorithm
virtual ~cOperatorFitnessAlgorithm ()=0
virtual list< const cOperation * > getPossibleOperators () const

Protected Member Functions

double normalizeIndividualFitness (double dFitness, double dMinFitness=0.0) const
cOperatorFitness updateFitness (const cOperatorFitness &opFitness, const list< cIndividualInfo > &liCreatedIndividualInfos) const
bool storeXmlOperationsData (ostream &oStream, const map< string, cOperatorFitness > &mapOperationFitness) const
map< string, cOperatorFitness > restoreXmlOperatorData (istream &iStream, int &outStatus) const
map< string, cOperatorFitness > restoreXmlOperatorData (const TiXmlNode *pXmlNode, int &outStatus) const
virtual
cOperatorFitnessAlgorithmBasic
clone () const

Protected Attributes

double dFaktorAllFitnessPart
double dFaktorPositivFitnessPart
map< string, cOperatorFitness > mapLoadedOperatorFitness
string szOperationDataPath
map< string, cOperatorFitness > mapPastOperatorFitness
double dFitnessSum
list< pair< const cOperation
*, double > > 
liOperatorFitness

Detailed Description

Definition at line 99 of file cOperatorFitnessAlgorithmBasic.h.


Constructor & Destructor Documentation

enviroment::cOperatorFitnessAlgorithmBasic::cOperatorFitnessAlgorithmBasic ( double  dInFaktorAllFitnessPart = 0.5,
double  dInFaktorPositivFitnessPart = 0.5,
const string  szOldOperationDataPath = "" 
)

Constructor of the class cOperatorFitnessAlgorithmBasic.

Parameters:
dInFaktorAllFitnessPartthe factor A for the whool fitness
dInFaktorPositivFitnessPartthe factor B for the increased fitnesssum
szOldOperationDataPaththe path wher the operator fitness data is stored; if "" (standardvalue) the path is "./cOperatorFitnessAlgorithmBasic.xml"; if the path ends with an '/', it is a folder in which the the operator fitness data should be stored into an file with the name "cOperatorFitnessAlgorithmBasic.xml"
enviroment::cOperatorFitnessAlgorithmBasic::cOperatorFitnessAlgorithmBasic ( const cOperatorFitnessAlgorithmBasic opFitnessAlgorithmBasic)

copyconstructor of the class cOperatorFitnessAlgorithmBasic.

Parameters:
opFitnessAlgorithmBasicthe cOperatorFitnessAlgorithmBasic to copy
virtual enviroment::cOperatorFitnessAlgorithmBasic::~cOperatorFitnessAlgorithmBasic ( )
virtual

Destructor of the class cOperatorFitnessAlgorithmBasic.


Member Function Documentation

virtual cOperatorFitnessAlgorithmBasic* enviroment::cOperatorFitnessAlgorithmBasic::clone ( ) const
protectedvirtual

This method clones this object.

Returns:
a clone of this object

Implements enviroment::cOperatorFitnessAlgorithm.

virtual double enviroment::cOperatorFitnessAlgorithmBasic::evalueFitness ( const cOperation operation,
const list< cIndividualInfo > &  liCreatedIndividualInfos 
)
virtual

This method evalues the fitness of the given operator operation new.

Parameters:
operationthe operator for which the fitness is to be evalued new
liCreatedIndividualInfosa list with all informations about all individuals the operator has created
Returns:
the new evalued fitness of the operation

Implements enviroment::cOperatorFitnessAlgorithm.

virtual string enviroment::cOperatorFitnessAlgorithmBasic::getClassName ( ) const
virtual
Returns:
the class name of this object

Reimplemented from enviroment::cOperatorFitnessAlgorithm.

double enviroment::cOperatorFitnessAlgorithmBasic::getFaktorAllFitnessPart ( ) const
See also:
dFaktorAllFitnessPart
Returns:
the factor A for the whool fitness
double enviroment::cOperatorFitnessAlgorithmBasic::getFaktorPositivFitnessPart ( ) const
See also:
dFaktorPositivFitnessPart
Returns:
the factor B for the improvment fitnesssum
virtual double enviroment::cOperatorFitnessAlgorithmBasic::getFitness ( const cOperation operation)
virtual

This method returns the fitness of the given operator operation.

Parameters:
operationthe operator for which the fitness is to be returned
Returns:
the fitness of the operation

Implements enviroment::cOperatorFitnessAlgorithm.

virtual list< pair< const cOperation*, double > > enviroment::cOperatorFitnessAlgorithmBasic::getFitness ( )
virtual

This method returns the fitness of all operators.

Returns:
a list with all possible operators with ther fitness

Implements enviroment::cOperatorFitnessAlgorithm.

virtual double enviroment::cOperatorFitnessAlgorithmBasic::getFitnessSum ( ) const
virtual
Returns:
the sum of all fitnessvalues of all operators

Implements enviroment::cOperatorFitnessAlgorithm.

virtual double enviroment::cOperatorFitnessAlgorithmBasic::getMinFitness ( ) const
virtual
Returns:
the minimal fitness which this object can evalue

Implements enviroment::cOperatorFitnessAlgorithm.

double enviroment::cOperatorFitnessAlgorithmBasic::normalizeIndividualFitness ( double  dFitness,
double  dMinFitness = 0.0 
) const
protected

it's greater 1: N( dFitness ) = max( 1 , ( dFitness - dMinFitness ) )

Parameters:
dFitnessthe fitnessvalue of an individual to normalize
dMinFitnessthe minimal fitness; evalue with cObjectFitnessAlgorithm->getWorstCaseFitness()->getFitness()
Returns:
the normalized individual fitness
map< string, cOperatorFitness > enviroment::cOperatorFitnessAlgorithmBasic::restoreXmlOperatorData ( istream &  iStream,
int &  outStatus 
) const
protected

This function restores the operator fitness data from the given stream. In the stream the operator fitness data should be writen in the xml -format, like storeXmlOperationsData() stores it.

See also:
storeXmlOperationsData()
Parameters:
iStreamthe stream where the operator fitness data is stored in
outStatusAn reverence to an integervalue where the errorvalue can be stored to. possible errorvalues are:
  • 0 loading successful
  • -1 loading error, invalid stream
  • -2 loading error, invalid data in stream
  • 1 loading warning, invalid data in stream, error could be corrected
  • 2 loading warning, invalid data in stream, maybe the loaded data is wrong
Returns:
the restored operator fitness data
map< string, cOperatorFitness > enviroment::cOperatorFitnessAlgorithmBasic::restoreXmlOperatorData ( const TiXmlNode *  pXmlNode,
int &  outStatus 
) const
protected

This function restores the operator fitness data from the given TinyXml node. In the TinyXml node the operator fitness data should be stored in the xml -format, like storeXmlOperationsData() stores it.

See also:
storeXmlOperationsData()
Parameters:
pXmlNodea pointer to the TinyXml node the operator fitness data is stored in
outStatusAn reverence to an integervalue where the errorvalue can be stored to. possible errorvalues are:
  • 0 loading successful
  • -1 loading error, invalid stream
  • -2 loading error, invalid data in stream
  • 1 loading warning, invalid data in stream, error could be corrected
  • 2 loading warning, invalid data in stream, maybe the loaded data is wrong
Returns:
the restored operator fitness data
bool enviroment::cOperatorFitnessAlgorithmBasic::storeXmlOperationsData ( ostream &  oStream,
const map< string, cOperatorFitness > &  mapOperationFitness 
) const
protected

This function stores the operator fitness data in xml -format into the given stream.

Example Xml -structur: <operatorFitness algorithm="cOperatorFitnessAlgorithmBasic"> <operator name="operator1" b_ins="1" a_ins="100" f_ins="0.01" a_p="10" f_p="0.1"> <operator name="operator2" b_ins="2" a_ins="100" f_ins="0.02" a_p="5" f_p="0.4"> <operatorFitness>

See also:
restoreXmlOperationsData()
Parameters:
oStreamthe stream wher the operator data is to store to
mapOperationFitnessthe operator fitness data to store
Returns:
true if this operation fitness data is stored, else false
virtual double enviroment::cOperatorFitnessAlgorithmBasic::updateFitness ( const cOperation operation,
const cIndividualInfo createdIndividualInfo 
)
virtual

This method updates the fitness of the given operator operation. For this update the information this cOperatorFitnessAlgorithmBasic object knows about the operator and the given createdIndividualInfo is considered to evalue the new fitness.

Parameters:
operationthe operator, for which the fitness is to be updated
createdIndividualInfothe information about an individual the operator has created and which is not jet known by this cOperatorFitnessAlgorithmBasic object
Returns:
the new evalued fitness of the operation

Implements enviroment::cOperatorFitnessAlgorithm.

virtual double enviroment::cOperatorFitnessAlgorithmBasic::updateFitness ( const cOperation operation,
const list< cIndividualInfo > &  liCreatedIndividualInfos 
)
virtual

This method updates the fitness of the given operator operation. For this update the information this cOperatorFitnessAlgorithmBasic object knows about the operator and the given information in liCreatedIndividualInfos is considered to evalue the new fitness.

Parameters:
operationthe operator, for which the fitness is to be updated
liCreatedIndividualInfosa list with the information about the individuals the operator has created and which are not jet known by this cOperatorFitnessAlgorithmBasic object
Returns:
the new evalued fitness of the operation

Implements enviroment::cOperatorFitnessAlgorithm.

cOperatorFitness enviroment::cOperatorFitnessAlgorithmBasic::updateFitness ( const cOperatorFitness &  opFitness,
const list< cIndividualInfo > &  liCreatedIndividualInfos 
) const
protected

This function reevalues operation fitness opFitness with the values of liCreatedIndividualInfos.

Important values evalued internal:

  • V_i: The improvement which the operation has created with an individual from the list liCreatedIndividualInfos. This is the ratio of the normalized fitness F_N of the created individual diveded by the best fitness F_B of a individual at the creation time. V_i = NF( F_N ) / NF( F_B )

Values of opFitness reevalued:

  • dB_ins: The sum of all fitnessimprovments the operator has created. For every V_i value which is greater 1, the values (V_i - 1) are added to the old opFitness.dB_ins value.
  • dA_ins: The cost sum the operator has needed. This is the sum of all cost (evalued with the benchmark value) from the list liCreatedIndividualInfos added to the opFitness.dA_ins value.
  • dF_ins: The whool fitness. This is the ratio of the sum of all fitnessimprovments B_ins diveded by cost sum the operation has needed A_ins. dF_ins = dB_ins / dA_ins
  • dA_p: The cost sum the operator has needed for improvments. This is the sum of all cost (evalued with the benchmark value) operations have needed for generating a improved individual (an individual which is better as the best individual in the algorithm, tihs means which V_i is greater 1) from the list liCreatedIndividualInfos added to the opFitness.dA_p value.
  • dF_p: The improvment fitness. This is the ratio of the sum of all fitnessimprovments B_ins diveded by cost sum the operator has needed for inprovments A_P. dF_p = dB_ins / dA_p
  • dF: The fitness of the operator. This is the sum combination of the whool fitness F_ins multiplyed by the weight factor A and the improvment fitness F_P multiplyed by the weight factor B. F = A * dF_ins + B * dF_p
See also:
cOperatorFitness
normalizeIndividualFitness()
Parameters:
opFitnessthe operator fitness values for an operator
liCreatedIndividualInfosthe information about individual the operator to opFitness had created, but which are not jet included in opFitness
Returns:
the reevalued operator fitness

Member Data Documentation

double enviroment::cOperatorFitnessAlgorithmBasic::dFaktorAllFitnessPart
protected

The factor A for the whool fitness.

Definition at line 105 of file cOperatorFitnessAlgorithmBasic.h.

double enviroment::cOperatorFitnessAlgorithmBasic::dFaktorPositivFitnessPart
protected

The factor B for the improvment fitnesssum.

Definition at line 110 of file cOperatorFitnessAlgorithmBasic.h.

double enviroment::cOperatorFitnessAlgorithmBasic::dFitnessSum
protected

The summ of all fitnessvalues

Definition at line 162 of file cOperatorFitnessAlgorithmBasic.h.

list< pair< const cOperation*, double > > enviroment::cOperatorFitnessAlgorithmBasic::liOperatorFitness
protected

This list contains all operators with ther fitness values in an list. It is used for a faster evaluation of the getFitness() method.

See also:
getFitness()

Definition at line 171 of file cOperatorFitnessAlgorithmBasic.h.

map< string, cOperatorFitness > enviroment::cOperatorFitnessAlgorithmBasic::mapLoadedOperatorFitness
protected

The operator fitnessvalues which have been loaded from a file.

The key is the operatorname.

Definition at line 137 of file cOperatorFitnessAlgorithmBasic.h.

map< string, cOperatorFitness > enviroment::cOperatorFitnessAlgorithmBasic::mapPastOperatorFitness
protected

The operator fitnessvalues which this object has evalued and loaded.

The key is the operatorname.

Definition at line 157 of file cOperatorFitnessAlgorithmBasic.h.

string enviroment::cOperatorFitnessAlgorithmBasic::szOperationDataPath
protected

The path to the file in which the operation data is and/or should be stored.

Definition at line 150 of file cOperatorFitnessAlgorithmBasic.h.


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