Grail (C++)
1.4.0
A multi-platform, modular, universal engine for embedding advanced AI in games.
|
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>
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 BaseEvoParam * | SetNext () |
Sets to the next possible value in the domain (wrapped, i.e. last.next -> first). More... | |
const BaseEvoParam * | SetPrev () |
Sets to the previous possible value in the domain (wrapped, i.e. first.prev -> last). More... | |
const BaseEvoParam * | SetNextClamped () |
Sets to the next possible value in the domain (clamped, i.e. last.next -> last). More... | |
const BaseEvoParam * | SetPrevClamped () |
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. | |
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.
|
inline |
Constructs a new EvoParam instance with the given possible values.
argsDomain | - the possible values, this parameter may hold. This is the optimizable space. |
|
inline |
Constructs a new EvoParam instance with the given possible values.
argsDomain | - the possible values, this parameter may hold. This is the optimizable space. |
|
inline |
Value - gets the current value that the parameter is holding.