37TerminalT<T>::~TerminalT(
void)
88 std::string baseName_;
109 name_.erase(name_.end() - 1);
110 std::stringstream ss;
127 T& res = *(T*)result;
154 return (PrimitiveP)
new ERC<T>(*
this);
166 uint iData = state_->getRandomizer()->getRandomInteger((
int)
values_->size());
167 erc->value_ =
values_->at(iData);
168 std::ostringstream ss;
170 erc->
setName(name_ + ss.str());
171 return (PrimitiveP) erc;
195 values_ =
new std::vector<double>;
197 if(name_[name_.size() - 1] ==
'}')
198 useInterval_ =
false;
199 name_.erase(name_.end() - 1);
200 std::stringstream ss;
221 double r = state_->getRandomizer()->getRandomDouble();
222 erc->value_ = (*values_)[0] + r * ((*values_)[1] - (*values_)[0]);
226 uint iData = state_->getRandomizer()->getRandomInteger((
int)
values_->size());
227 erc->value_ =
values_->at(iData);
229 std::ostringstream ss;
231 erc->
setName(name_ + ss.str());
232 return (PrimitiveP) erc;
Ephemereal random constant (ERC) node of type double (Tree genotype).
bool initialize(StateP state)
Initialize the primitive (default just sets the StateP pointer).
PrimitiveP assignToNode(PrimitiveP primitive)
Assign primitive to node (when building a tree). The default behaviour just returns the same pointer ...
Ephemereal random constant (ERC) node class (Tree genotype).
void getValue(void *value)
Get terminal's value.
std::vector< T > * values_
PrimitiveP assignToNode(PrimitiveP primitive)
Create (or choose) new unique ERC value and assign to tree node.
bool initialize(StateP state)
Initialize ERC value(s).
void setValue(void *value)
Set terminal's value.
PrimitiveP copyWithNode(PrimitiveP primitive)
Copy primitive (when copying a node, e.g. in crossover). The default behaviour just returns the same ...
void execute(void *result, Tree &tree)
Execute the primitive.
Base primitive class (Tree genotype).
void setName(std::string name)
Set primitive's name.
Terminal tree node class (Tree genotype).
void setValue(void *value)
Set terminal's value.
void execute(void *result, Tree &tree)
Execute the primitive.
void getValue(void *value)
Get terminal's value.
Tree class - implements genotype as a tree.