Chromosome::Representation::GaMultiValueSet< T > Class Template Reference

This template represents value set with multiple values and their counterpart (inverted values). More...

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

Inherits Chromosome::Representation::GaValueSet< T >< T >.

List of all members.

Public Member Functions

 GaMultiValueSet (bool viceVersa)
 This constructor initializes empty value set with user-defined treatment of inverted values.
 GaMultiValueSet ()
 This constructor initializes empty value set with inverted values as members of the set.
virtual T GACALL GenerateRandom () const
 More details are given in specification of GaValueSet::GenerateRandom method.
virtual bool GACALL Inverse (const T &value, T &inverted) const
 More details are given in specification of GaValueSet::Inverse method.
virtual bool GACALL Belongs (const T &value) const
 More details are given in specification of GaValueSet::Belongs method.
virtual const T &GACALL ClosestValue (const T &value) const
 More details are given in specification of GaValueSet::ClosestValue method.
bool GACALL Add (const T &original, const T &inverted)
 Add method inserts new value and its counterpart into value set. If original value is already in set call fails and method returns false.
int Add (const T *values, const T *invertedValues, int size)
 Add method inserts new values and their counterpart into value set. New values which has duplicates in the set are ignored. Both arrays of values must be the same size.
bool GACALL Remove (const T &value)
 Remove method removes value and its counterpart from the set. It removes value from the set if it's equal to specified value or if specified value is equal to inverted value.
bool GACALL Remove (int pos)
 Remove method removes value and its counterpart from the set. It removes value by its position in the set.
const T &GACALL GetValue (int pos) const
 GetValue method returns original value at given position.
void GACALL GetValue (int pos, T &original, T &inverted)
 GetValue method returns value and its counterpart at given position.
const T &GACALL GetInvertedValue (int pos) const
 GetInvertedValue method returns inverted value at given position.
void GACALL SetValue (int pos, const T &value)
 SetValue method sets original value at given position.
void GACALL SetValue (int pos, const T &original, const T &inverted)
 SetValue method sets value and its counterpart at given position.
void GACALL SetInvertedValue (int pos, const T &value)
 SetInvertedValue method sets inverted value at given position.

Private Attributes

vector< T > _values
 Array of original values.
vector< T > _invertedValues
 array of counterparts of values in _values (inverted values).


Detailed Description

template<typename T>
class Chromosome::Representation::GaMultiValueSet< T >

This template represents value set with multiple values and their counterpart (inverted values).

This class has built-in synchronizator so it is allowed to use LOCK_OBJECT and LOCK_THIS_OBJECT macros with instances of this class, but no public or private methods are thread-safe.

Parameters:
T type of data in value set.

Constructor & Destructor Documentation

template<typename T>
Chromosome::Representation::GaMultiValueSet< T >::GaMultiValueSet ( bool  viceVersa  )  [inline]

This constructor initializes empty value set with user-defined treatment of inverted values.

Parameters:
viceVersa if this parameter is set to true, inverted values are treated as members of the set, if it is set to false, inverted values are not treated as members of the set.

template<typename T>
Chromosome::Representation::GaMultiValueSet< T >::GaMultiValueSet (  )  [inline]

This constructor initializes empty value set with inverted values as members of the set.


Member Function Documentation

template<typename T>
virtual T GACALL Chromosome::Representation::GaMultiValueSet< T >::GenerateRandom (  )  const [inline, virtual]

More details are given in specification of GaValueSet::GenerateRandom method.

This method is not thread-safe.

Implements Chromosome::Representation::GaValueSet< T >.

template<typename T>
virtual bool GACALL Chromosome::Representation::GaMultiValueSet< T >::Inverse ( const T &  value,
T &  inverted 
) const [inline, virtual]

More details are given in specification of GaValueSet::Inverse method.

This method is not thread-safe.

Implements Chromosome::Representation::GaValueSet< T >.

template<typename T>
virtual bool GACALL Chromosome::Representation::GaMultiValueSet< T >::Belongs ( const T &  value  )  const [inline, virtual]

More details are given in specification of GaValueSet::Belongs method.

This method is not thread-safe.

Implements Chromosome::Representation::GaValueSet< T >.

template<typename T>
virtual const T& GACALL Chromosome::Representation::GaMultiValueSet< T >::ClosestValue ( const T &  value  )  const [inline, virtual]

More details are given in specification of GaValueSet::ClosestValue method.

This method is not thread-safe.

Implements Chromosome::Representation::GaValueSet< T >.

template<typename T>
bool GACALL Chromosome::Representation::GaMultiValueSet< T >::Add ( const T &  original,
const T &  inverted 
) [inline]

Add method inserts new value and its counterpart into value set. If original value is already in set call fails and method returns false.

This method is not thread-safe.

Parameters:
original original value which is going to be added.
inverted inverted value, counterpart of original value.
Returns:
Method returns true if new value is added successfully. If original value already exists in set, method returns false.

template<typename T>
int Chromosome::Representation::GaMultiValueSet< T >::Add ( const T *  values,
const T *  invertedValues,
int  size 
) [inline]

Add method inserts new values and their counterpart into value set. New values which has duplicates in the set are ignored. Both arrays of values must be the same size.

This method is not thread-safe.

Parameters:
values array of original values which are going to be added.
invertedValues array of inverted values, counterparts of original values.
size number of values which are going to be added.
Returns:
Method returns number of successfully inserted values into set.

template<typename T>
bool GACALL Chromosome::Representation::GaMultiValueSet< T >::Remove ( const T &  value  )  [inline]

Remove method removes value and its counterpart from the set. It removes value from the set if it's equal to specified value or if specified value is equal to inverted value.

This method is not thread-safe.

Parameters:
value value which is should be removed.
Returns:
Method returns true if it removed value successfully. It value doesn't belong to the set, method returns false.

template<typename T>
bool GACALL Chromosome::Representation::GaMultiValueSet< T >::Remove ( int  pos  )  [inline]

Remove method removes value and its counterpart from the set. It removes value by its position in the set.

This method is not thread-safe.

Parameters:
pos position of value which is should be removed.
Returns:
Method returns true if it removed value successfully. It position is out of range it returns false.

template<typename T>
const T& GACALL Chromosome::Representation::GaMultiValueSet< T >::GetValue ( int  pos  )  const [inline]

GetValue method returns original value at given position.

This method is not thread-safe.

Parameters:
pos position of the value.
Returns:
Method returns original value at given position.

template<typename T>
void GACALL Chromosome::Representation::GaMultiValueSet< T >::GetValue ( int  pos,
T &  original,
T &  inverted 
) [inline]

GetValue method returns value and its counterpart at given position.

This method is not thread-safe.

Parameters:
pos position of the value.
original reference to variable to which original value is saved.
inverted reference to variable to which inverted value is saved.

template<typename T>
const T& GACALL Chromosome::Representation::GaMultiValueSet< T >::GetInvertedValue ( int  pos  )  const [inline]

GetInvertedValue method returns inverted value at given position.

This method is not thread-safe.

Parameters:
pos position of the value.
Returns:
Method returns inverted value at given position.

template<typename T>
void GACALL Chromosome::Representation::GaMultiValueSet< T >::SetValue ( int  pos,
const T &  value 
) [inline]

SetValue method sets original value at given position.

This method is not thread-safe.

Parameters:
pos position of the value.
value new original value.

template<typename T>
void GACALL Chromosome::Representation::GaMultiValueSet< T >::SetValue ( int  pos,
const T &  original,
const T &  inverted 
) [inline]

SetValue method sets value and its counterpart at given position.

This method is not thread-safe.

Parameters:
pos position of the value.
original new original value.
inverted new inverted value.

template<typename T>
void GACALL Chromosome::Representation::GaMultiValueSet< T >::SetInvertedValue ( int  pos,
const T &  value 
) [inline]

SetInvertedValue method sets inverted value at given position.

This method is not thread-safe.

Parameters:
pos position of the value.
value new inverted value.


Member Data Documentation

template<typename T>
vector<T> Chromosome::Representation::GaMultiValueSet< T >::_values [private]

Array of original values.

template<typename T>
vector<T> Chromosome::Representation::GaMultiValueSet< T >::_invertedValues [private]

array of counterparts of values in _values (inverted values).


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

Genetic Algorithm Library
Coolsoft Software Development