Grail (C++)  1.3.0
A multi-platform, modular, universal engine for embedding advanced AI in games.
grail::evolution::EvoParam Class Reference

EvoParam - class that represents a parameter that is modifiable (optimizable) by evolutionary algorithms. More...

#include <EvoParam.hh>

Inheritance diagram for grail::evolution::EvoParam:

Public Member Functions

void Randomize (std::mt19937_64 &rand_gen)
 Sets to a random possible value from a domain. More...
 
const EvoParamSetNext ()
 Sets to the next possible value in the domain (wrapped, i.e. last.next -> first) and returns itself.
 
const EvoParamSetPrev ()
 Sets to the previous possible value in the domain (wrapped, i.e. first.prev -> last) and returns itself.
 
const EvoParamSetNextClamped ()
 Sets to the next possible value in the domain (clamped, i.e. last.next -> last) and returns itself.
 
const EvoParamSetPrevClamped ()
 Sets to the previous possible value in the domain (clamped, i.e. first.prev -> first) and returns itself.
 
float GetNormalizedPositionWeight () const
 Returns the normalized position as [0.0, 1.0] floating point number.
 
size_t GetPositionIndex () const
 Returns the position of the parameter i.e. the index of the currently assigned element from the domain.
 
void SetPositionIndex (size_t position)
 Sets the position of the parameter i.e. the index of the currently assigned element from the domain. More...
 
virtual std::string ToString () const
 ToString - returns the string representation of the current value hold by the parameter. More...
 

Protected Member Functions

 EvoParam (size_t domainLength)
 EvoParam - Constructor. More...
 

Protected Attributes

const size_t domainLength = {1}
 domainLength - the number of distinct values EvoParam may take.
 
size_t positionIndex
 positionIndex - EvoParam uses positionIndex to point to an element from its domain. More...
 

Detailed Description

EvoParam - class that represents a parameter that is modifiable (optimizable) by evolutionary algorithms.

Constructor & Destructor Documentation

◆ EvoParam()

grail::evolution::EvoParam::EvoParam ( size_t  domainLength)
protected

EvoParam - Constructor.

Parameters
domainLength- the number of distinct values EvoParam may take.

Member Function Documentation

◆ Randomize()

void grail::evolution::EvoParam::Randomize ( std::mt19937_64 &  rand_gen)

Sets to a random possible value from a domain.

Parameters
rand_gen- random number generator.

◆ SetPositionIndex()

void grail::evolution::EvoParam::SetPositionIndex ( size_t  position)

Sets the position of the parameter i.e. the index of the currently assigned element from the domain.

Parameters
position- the number >= 0 and < domainLength.

◆ ToString()

std::string grail::evolution::EvoParam::ToString ( ) const
virtual

ToString - returns the string representation of the current value hold by the parameter.

Reimplemented in grail::evolution::TypedEvoParam< T >.

Member Data Documentation

◆ positionIndex

size_t grail::evolution::EvoParam::positionIndex
protected

positionIndex - EvoParam uses positionIndex to point to an element from its domain.


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