6 #include "ibackpropagation_strategy.hpp" 18 template <
typename Context,
typename Config>
29 vector<node_t *> children_;
46 virtual const vector<node_t *>
children()
const {
return children_; }
50 virtual Config *
config()
const {
return config_; }
52 virtual const Context
context()
const {
return context_; }
57 if (children_.size() == 0)
65 throw std::runtime_error(
"not supported.");
82 for (
unsigned i = 0; i < children_.size(); ++i) {
virtual double ev() const =0
gets the current expected value
virtual void backpropagate(const double &value)
applies a backpropagation strategy to traverse the simulated result back up in the tree.
virtual double ev() const
gets the current expected value.
virtual node_t * parent() const
gets the parent of the current node
virtual void expand()=0
expand the current context and add all possible derived contexts as children.
virtual double variance() const
gets the variance.
virtual double simulate() const
applies a simulation strategy to a terminal node.
virtual void backpropagate(const double &value)=0
applies a backpropagation strategy to traverse the simulated result back up in the tree.
virtual node_t * select_child()=0
selects a childnode according to a configurable metric
virtual double std_deviation() const =0
gets the current standard deviation
virtual int nb_samples() const
number of times a selection strategy selected the current node.
basic interface for a node in the tree. Every node has to implement this functions.
virtual void on_backpropagate(const double &value)=0
saves an value according to some metric.
virtual double std_dev() const
gets the standard deviation.
A backpropagation strategy is used in each node. when a terminal node is simulated,...
virtual const Context context() const
gets the context associated with the current node
virtual double variance() const =0
gets the current variance
IBackpropagationStrategy * backprop_strat_
strategy that is used for propagating values back in the tree.
virtual int nb_samples() const =0
gets the number of samples that are saved in the strat.
implements interface for visitor objects.
virtual void accept(visitor_t *visitor)
accepts a visitor according to the visitor pattern.
virtual const vector< node_t * > children() const
get the children of the current node
virtual void add_child(node_t *child)
insert a new node as a child of the current one.
implements most methods of the inode interface. some methods have to be implemented problem dependend...
virtual node_t * select_recusively()=0
recursively selects nodes with a given simulation strategy until an terminal node is reached.
virtual node_t * select_recusively()
recursively selects nodes with a given simulation strategy until an terminal node is reached.
virtual Config * config() const
gets the config object