#include <D:/Temp/vs/gal/source/MultiValueChromosome.h>
Inherits Chromosome::Representation::GaDomainChromosome< TYPE >, Chromosome::Representation::GaSwapableCode, Chromosome::Representation::GaSizableCode, Chromosome::Representation::GaMutableCode, and Chromosome::Representation::GaMultiValueCode.
Inherited by Chromosome::Representation::GaMVArithmeticChromosome< TYPE >.
Public Member Functions | |
virtual void GACALL | Remove (int start, int size) |
More details are given in specification of GaSizableCode::Remove method. | |
virtual void GACALL | Insert (int start, GaCodeValue *data, int size) |
More details are given in specification of GaSizableCode::Insert method. | |
virtual void GACALL | Swap (int start1, int size1, int start2, int size2) |
If swapping two parts overlap, position of second part is moved after the end of first part. | |
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. | |
virtual GaCodeValuesBuffer *GACALL | MakeBuffer (int size) const |
More details are given in specification of GaMultiValueCode::MakeBuffer method. | |
virtual void GACALL | FillBuffer (int pos, int size, GaCodeValuesBuffer &buffer) const |
More details are given in specification of GaMultiValueCode::FillBuffer method. | |
virtual void GACALL | FromBuffer (const GaCodeValuesBuffer &buffer) |
More details are given in specification of GaMultiValueCode::FromBuffer method. | |
GaMultiValueChromosome (TYPE *values, int size, GaChromosomeDomainBlock< TYPE > *configBlock) | |
This constructor initializes chromosome with CCB and user-defined code. | |
GaMultiValueChromosome (int size, GaChromosomeDomainBlock< TYPE > *configBlock) | |
This constructor initializes chromosome with CCB and random code with defined size. | |
GaMultiValueChromosome (GaChromosomeDomainBlock< TYPE > *configBlock) | |
This constructor initializes chromosome with CCB. | |
GaMultiValueChromosome (const GaMultiValueChromosome< 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 | GetAt (int pos) const |
GetAt method returns value of chromosome's at specified position. | |
void GACALL | SetAt (TYPE value, int pos) |
SetAt method sets value of chromosome's code at given position. | |
const vector< TYPE > &GACALL | GetCode () const |
This method is not thread-safe. | |
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 copies values form chromosome's code to backup vector. | |
virtual void GACALL | AcceptMutation () |
This method only clears backup vector. | |
virtual void GACALL | RejectMutation () |
RejectMutation method restores chromosome's code from backup vector. It also clears backup vector. | |
Protected Attributes | |
vector< TYPE > | _values |
Chromosome's code. | |
vector< TYPE > | _backup |
Backup copy chromosome's code before mutation if improving-only mutation flag is set in chromosome's parameters. |
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.
TYPE | type of value in chromosome's code. |
Chromosome::Representation::GaMultiValueChromosome< TYPE >::GaMultiValueChromosome | ( | TYPE * | values, | |
int | size, | |||
GaChromosomeDomainBlock< TYPE > * | configBlock | |||
) | [inline] |
This constructor initializes chromosome with CCB and user-defined code.
values | values of chromosome's code. | |
size | size of chromosome's code. | |
configBlock | pointer to CCB. |
Chromosome::Representation::GaMultiValueChromosome< TYPE >::GaMultiValueChromosome | ( | int | size, | |
GaChromosomeDomainBlock< TYPE > * | configBlock | |||
) | [inline] |
This constructor initializes chromosome with CCB and random code with defined size.
size | size of chromosome's code. | |
configBlock | pointer to CCB. |
Chromosome::Representation::GaMultiValueChromosome< TYPE >::GaMultiValueChromosome | ( | GaChromosomeDomainBlock< TYPE > * | configBlock | ) | [inline] |
This constructor initializes chromosome with CCB.
configBlock | pointer to CCB. |
Chromosome::Representation::GaMultiValueChromosome< TYPE >::GaMultiValueChromosome | ( | const GaMultiValueChromosome< TYPE > & | c, | |
bool | setupOnly | |||
) | [inline] |
This is copy constructor.
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. |
virtual void GACALL Chromosome::Representation::GaMultiValueChromosome< TYPE >::Remove | ( | int | start, | |
int | size | |||
) | [inline, virtual] |
More details are given in specification of GaSizableCode::Remove method.
This method is not thread-safe.
Implements Chromosome::Representation::GaSizableCode.
virtual void GACALL Chromosome::Representation::GaMultiValueChromosome< TYPE >::Insert | ( | int | start, | |
GaCodeValue * | data, | |||
int | size | |||
) | [inline, virtual] |
More details are given in specification of GaSizableCode::Insert method.
This method is not thread-safe.
Implements Chromosome::Representation::GaSizableCode.
virtual void GACALL Chromosome::Representation::GaMultiValueChromosome< TYPE >::Swap | ( | int | start1, | |
int | size1, | |||
int | start2, | |||
int | size2 | |||
) | [inline, virtual] |
If swapping two parts overlap, position of second part is moved after the end of first part.
More details are given in specification of GaSwapableCode::Swap method.
This method is not thread-safe.
Implements Chromosome::Representation::GaSwapableCode.
virtual void GACALL Chromosome::Representation::GaMultiValueChromosome< TYPE >::Flip | ( | int | start, | |
int | size | |||
) | [inline, virtual] |
More details are given in specification of GaMutableCode::Flip method.
This method is not thread-safe.
Implements Chromosome::Representation::GaMutableCode.
virtual void GACALL Chromosome::Representation::GaMultiValueChromosome< TYPE >::Invert | ( | int | start, | |
int | size | |||
) | [inline, virtual] |
More details are given in specification of GaMutableCode::Invert method.
This method is not thread-safe.
Implements Chromosome::Representation::GaMutableCode.
virtual GaCodeValuesBuffer* GACALL Chromosome::Representation::GaMultiValueChromosome< TYPE >::MakeBuffer | ( | int | size | ) | const [inline, virtual] |
More details are given in specification of GaMultiValueCode::MakeBuffer method.
This method is not thread-safe.
Implements Chromosome::Representation::GaMultiValueCode.
virtual void GACALL Chromosome::Representation::GaMultiValueChromosome< TYPE >::FillBuffer | ( | int | pos, | |
int | size, | |||
GaCodeValuesBuffer & | buffer | |||
) | const [inline, virtual] |
More details are given in specification of GaMultiValueCode::FillBuffer method.
This method is not thread-safe.
Implements Chromosome::Representation::GaMultiValueCode.
virtual void GACALL Chromosome::Representation::GaMultiValueChromosome< TYPE >::FromBuffer | ( | const GaCodeValuesBuffer & | buffer | ) | [inline, virtual] |
More details are given in specification of GaMultiValueCode::FromBuffer method.
This method is not thread-safe.
Implements Chromosome::Representation::GaMultiValueCode.
virtual GaChromosomePtr GACALL Chromosome::Representation::GaMultiValueChromosome< 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::GaMVArithmeticChromosome< TYPE >.
virtual GaChromosomePtr GACALL Chromosome::Representation::GaMultiValueChromosome< 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.
virtual int GACALL Chromosome::Representation::GaMultiValueChromosome< TYPE >::GetCodeSize | ( | ) | const [inline, virtual] |
This method is not thread-safe.
Implements Chromosome::GaChromosome.
TYPE GACALL Chromosome::Representation::GaMultiValueChromosome< TYPE >::GetAt | ( | int | pos | ) | const [inline] |
GetAt
method returns value of chromosome's at specified position.
This method is not thread-safe.
pos | position of the value. |
void GACALL Chromosome::Representation::GaMultiValueChromosome< TYPE >::SetAt | ( | TYPE | value, | |
int | pos | |||
) | [inline] |
SetAt
method sets value of chromosome's code at given position.
This method is not thread-safe.
value | new value. | |
pos | position of value. |
const vector<TYPE>& GACALL Chromosome::Representation::GaMultiValueChromosome< TYPE >::GetCode | ( | ) | const [inline] |
This method is not thread-safe.
virtual GaChromosome& GACALL Chromosome::Representation::GaMultiValueChromosome< 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.
virtual float GACALL Chromosome::Representation::GaMultiValueChromosome< 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.
virtual void GACALL Chromosome::Representation::GaMultiValueChromosome< TYPE >::PreapareForMutation | ( | ) | [inline, protected, virtual] |
PreapareForMutation
method copies values form chromosome's code to backup vector.
Implements Chromosome::GaDefaultChromosome.
virtual void GACALL Chromosome::Representation::GaMultiValueChromosome< TYPE >::AcceptMutation | ( | ) | [inline, protected, virtual] |
virtual void GACALL Chromosome::Representation::GaMultiValueChromosome< TYPE >::RejectMutation | ( | ) | [inline, protected, virtual] |
RejectMutation
method restores chromosome's code from backup vector. It also clears backup vector.
Implements Chromosome::GaDefaultChromosome.
vector<TYPE> Chromosome::Representation::GaMultiValueChromosome< TYPE >::_values [protected] |
Chromosome's code.
vector<TYPE> Chromosome::Representation::GaMultiValueChromosome< TYPE >::_backup [protected] |
Backup copy chromosome's code before mutation if improving-only mutation flag is set in chromosome's parameters.