Chromosome::Representation::GaSingleValueChromosome< TYPE > Class Template Reference

This class can be used for chromosomes which code has only one value. Value can be of any type as long as that type obeys requirements introduced by value set. More...

#include <D:/Temp/vs/gal/source/SingleValueChromosome.h>

Inherits Chromosome::Representation::GaDomainChromosome< TYPE >, and Chromosome::Representation::GaMutableCode.

Inherited by Chromosome::Representation::GaSVArithmeticChromosome< TYPE >.

List of all members.

Public Member Functions

virtual void GACALL Flip (int start, int size)
 More details are given in specification of GaMutableCode::Flip method.
virtual void GACALL Invert (int start, int size)
 More details are given in specification of GaMutableCode::Invert method.
 GaSingleValueChromosome (TYPE value, GaChromosomeDomainBlock< TYPE > *configBlock)
 This constructor initializes chromosome with CCB and its code.
 GaSingleValueChromosome (GaChromosomeDomainBlock< TYPE > *configBlock)
 This constructor initializes chromosome with CCB and randomly generated code.
 GaSingleValueChromosome (const GaSingleValueChromosome< TYPE > &c, bool setupOnly)
 This is copy constructor.
virtual GaChromosomePtr GACALL MakeCopy (bool setupOnly) const
 More details are given in specification of GaChromosome::MakeCopy method.
virtual GaChromosomePtr GACALL MakeNewFromPrototype () const
 This method uses MakeCopy method to create chromosome's object, so if additional steps are not needed for creating chromosome from prototype, classes which inherits this class don't have to override this method.
virtual int GACALL GetCodeSize () const
 This method is not thread-safe.
TYPE GACALL GetValue () const
 This method is not thread-safe.
void GACALL SetValue (TYPE value)
 SetValue method sets value which represents chromosome's code.
virtual GaChromosome &GACALL operator= (const GaChromosome &rhs)
 More details are given in specification of GaChromosome::operator =.
virtual float GACALL operator== (const GaChromosome &c) const
 More details are given in specification of GaChromosome::operator ==.

Protected Member Functions

virtual void GACALL PreapareForMutation ()
 PreapareForMutation method saves backup of chromosome's code. It overwrite previous backup.
virtual void GACALL AcceptMutation ()
 This method overrides abstract method of GaChromosome class, and has no functionality.
virtual void GACALL RejectMutation ()
 RejectMutation method restores chromosome's code from backup.

Protected Attributes

TYPE _value
 Chromosome's code.
TYPE _backup
 Backup copy chromosome's code before mutation if improving-only mutation flag is set in chromosome's parameters.


Detailed Description

template<typename TYPE>
class Chromosome::Representation::GaSingleValueChromosome< TYPE >

This class can be used for chromosomes which code has only one value. Value can be of any type as long as that type obeys requirements introduced by value set.

This class has no built-in synchronizator, so LOCK_OBJECT and LOCK_THIS_OBJECT macros cannot be used with instances of this class. No public or private methods are thread-safe.

Parameters:
TYPE type of value in chromosome's code.

Constructor & Destructor Documentation

template<typename TYPE>
Chromosome::Representation::GaSingleValueChromosome< TYPE >::GaSingleValueChromosome ( TYPE  value,
GaChromosomeDomainBlock< TYPE > *  configBlock 
) [inline]

This constructor initializes chromosome with CCB and its code.

Parameters:
value chromosome's code.
configBlock pointer to CCB.

template<typename TYPE>
Chromosome::Representation::GaSingleValueChromosome< TYPE >::GaSingleValueChromosome ( GaChromosomeDomainBlock< TYPE > *  configBlock  )  [inline]

This constructor initializes chromosome with CCB and randomly generated code.

Parameters:
configBlock pointer to CCB.

template<typename TYPE>
Chromosome::Representation::GaSingleValueChromosome< TYPE >::GaSingleValueChromosome ( const GaSingleValueChromosome< TYPE > &  c,
bool  setupOnly 
) [inline]

This is copy constructor.

Parameters:
c reference to chromosome which is copied.
setupOnly if this parameter is true, only pointer to CCB is copied. If this parameter is false, chromosome's data and CCB is copied.


Member Function Documentation

template<typename TYPE>
virtual void GACALL Chromosome::Representation::GaSingleValueChromosome< TYPE >::Flip ( int  start,
int  size 
) [inline, virtual]

More details are given in specification of GaMutableCode::Flip method.

This method is not thread-safe.

Parameters:
start parameter is ignored.
size parameter is ignored.

Implements Chromosome::Representation::GaMutableCode.

template<typename TYPE>
virtual void GACALL Chromosome::Representation::GaSingleValueChromosome< TYPE >::Invert ( int  start,
int  size 
) [inline, virtual]

More details are given in specification of GaMutableCode::Invert method.

This method is not thread-safe.

Parameters:
start parameter is ignored.
size parameter is ignored.

Implements Chromosome::Representation::GaMutableCode.

template<typename TYPE>
virtual GaChromosomePtr GACALL Chromosome::Representation::GaSingleValueChromosome< TYPE >::MakeCopy ( bool  setupOnly  )  const [inline, virtual]

More details are given in specification of GaChromosome::MakeCopy method.

This method is not thread-safe.

Implements Chromosome::GaChromosome.

Reimplemented in Chromosome::Representation::GaSVArithmeticChromosome< TYPE >.

template<typename TYPE>
virtual GaChromosomePtr GACALL Chromosome::Representation::GaSingleValueChromosome< TYPE >::MakeNewFromPrototype (  )  const [inline, virtual]

This method uses MakeCopy method to create chromosome's object, so if additional steps are not needed for creating chromosome from prototype, classes which inherits this class don't have to override this method.

More details are given in specification of GaChromosome::MakeNewFromPrototype method.

Implements Chromosome::GaChromosome.

template<typename TYPE>
virtual int GACALL Chromosome::Representation::GaSingleValueChromosome< TYPE >::GetCodeSize (  )  const [inline, virtual]

This method is not thread-safe.

Returns:
Method always returns 1.

Implements Chromosome::GaChromosome.

template<typename TYPE>
TYPE GACALL Chromosome::Representation::GaSingleValueChromosome< TYPE >::GetValue (  )  const [inline]

This method is not thread-safe.

Returns:
Method returns value which represents chromosome's code.

template<typename TYPE>
void GACALL Chromosome::Representation::GaSingleValueChromosome< TYPE >::SetValue ( TYPE  value  )  [inline]

SetValue method sets value which represents chromosome's code.

This method is not thread-safe.

Parameters:
value new value of chromosome's code.

template<typename TYPE>
virtual GaChromosome& GACALL Chromosome::Representation::GaSingleValueChromosome< TYPE >::operator= ( const GaChromosome rhs  )  [inline, virtual]

More details are given in specification of GaChromosome::operator =.

This method is not thread-safe.

Reimplemented from Chromosome::GaDefaultChromosome.

template<typename TYPE>
virtual float GACALL Chromosome::Representation::GaSingleValueChromosome< TYPE >::operator== ( const GaChromosome c  )  const [inline, virtual]

More details are given in specification of GaChromosome::operator ==.

This method is not thread-safe.

Implements Chromosome::GaChromosome.

template<typename TYPE>
virtual void GACALL Chromosome::Representation::GaSingleValueChromosome< TYPE >::PreapareForMutation (  )  [inline, protected, virtual]

PreapareForMutation method saves backup of chromosome's code. It overwrite previous backup.

Implements Chromosome::GaDefaultChromosome.

template<typename TYPE>
virtual void GACALL Chromosome::Representation::GaSingleValueChromosome< TYPE >::AcceptMutation (  )  [inline, protected, virtual]

This method overrides abstract method of GaChromosome class, and has no functionality.

Implements Chromosome::GaDefaultChromosome.

template<typename TYPE>
virtual void GACALL Chromosome::Representation::GaSingleValueChromosome< TYPE >::RejectMutation (  )  [inline, protected, virtual]

RejectMutation method restores chromosome's code from backup.

Implements Chromosome::GaDefaultChromosome.


Member Data Documentation

template<typename TYPE>
TYPE Chromosome::Representation::GaSingleValueChromosome< TYPE >::_value [protected]

Chromosome's code.

template<typename TYPE>
TYPE Chromosome::Representation::GaSingleValueChromosome< TYPE >::_backup [protected]

Backup copy chromosome's code before mutation if improving-only mutation flag is set in chromosome's parameters.


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

Genetic Algorithm Library
Coolsoft Software Development