Grail (C++)  1.4.0
A multi-platform, modular, universal engine for embedding advanced AI in games.
grail::evolution::EvoParam< T > Class Template Referencefinal

EvoParam A class for defining evolutionary-optimizable parameters. They can be registered in Individuals for the evolutionary optimization functionality. The template type @T defines type of possible values the parameter may store. As T you have to either use a trivially destructible object or a smart pointer that will delete itself when it goes out of scope. More...

#include <EvoParam.hh>

Inheritance diagram for grail::evolution::EvoParam< T >:
Collaboration diagram for grail::evolution::EvoParam< T >:

Public Member Functions

 EvoParam (std::initializer_list< T > argsDomain)
 Constructs a new EvoParam instance with the given possible values. More...
 
 EvoParam (std::vector< T > &argsDomain)
 Constructs a new EvoParam instance with the given possible values. More...
 
const T Value () const
 Value - gets the current value that the parameter is holding. More...
 
 operator T () const
 Explicit cast so you can use constructions such as:
EvoParam<int> speed({10,15,20})
if(speed > 2) ...
 
- Public Member Functions inherited from grail::evolution::BaseEvoParam
 BaseEvoParam (size_t domainLength)
 BaseEvoParam - Constructor. More...
 
void Randomize (std::mt19937_64 &rand_gen)
 Sets to a random possible value from a domain. More...
 
const BaseEvoParamSetNext ()
 Sets to the next possible value in the domain (wrapped, i.e. last.next -> first). More...
 
const BaseEvoParamSetPrev ()
 Sets to the previous possible value in the domain (wrapped, i.e. first.prev -> last). More...
 
const BaseEvoParamSetNextClamped ()
 Sets to the next possible value in the domain (clamped, i.e. last.next -> last). More...
 
const BaseEvoParamSetPrevClamped ()
 Sets to the previous possible value in the domain (clamped, i.e. first.prev -> first). More...
 
float GetNormalizedPositionWeight () const
 The normalized position, between 0.0 and 1.0, is the ratio of the current position index to the domainLength. More...
 
size_t GetPositionIndex () const
 Returns the position of the parameter. BaseEvoParam uses PositionIndex to point to an element from its domain. More...
 
void SetPositionIndex (size_t position)
 Sets the position of the parameter. Setting this index makes the parameter hold the PositionIndex-ith value from the domain. Index starts at zero. More...
 
virtual std::string ToString () const
 ToString - returns a string representation of the current value hold by the parameter.
 
size_t GetDomainLength () const
 Gets the number of distinct values BaseEvoParam may take.
 

Additional Inherited Members

- Protected Attributes inherited from grail::evolution::BaseEvoParam
const size_t domainLength = 1
 domainLength - the number of distinct values BaseEvoParam may take.
 

Detailed Description

template<class T>
class grail::evolution::EvoParam< T >

EvoParam A class for defining evolutionary-optimizable parameters. They can be registered in Individuals for the evolutionary optimization functionality. The template type @T defines type of possible values the parameter may store. As T you have to either use a trivially destructible object or a smart pointer that will delete itself when it goes out of scope.

Constructor & Destructor Documentation

◆ EvoParam() [1/2]

template<class T >
grail::evolution::EvoParam< T >::EvoParam ( std::initializer_list< T >  argsDomain)
inline

Constructs a new EvoParam instance with the given possible values.

Parameters
argsDomain- the possible values, this parameter may hold. This is the optimizable space.

◆ EvoParam() [2/2]

template<class T >
grail::evolution::EvoParam< T >::EvoParam ( std::vector< T > &  argsDomain)
inline

Constructs a new EvoParam instance with the given possible values.

Parameters
argsDomain- the possible values, this parameter may hold. This is the optimizable space.

Member Function Documentation

◆ Value()

template<class T >
const T grail::evolution::EvoParam< T >::Value ( ) const
inline

Value - gets the current value that the parameter is holding.

Returns
current value.

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