bitsim
Model, simulate, estimate and control robots in C++
Loading...
Searching...
No Matches
bitrl::rl::algos::mc::MCTSNodeBase< ActionTp, StateTp > Class Template Reference

Base class for Nodes in a MC tree search. More...

#include <mcts_node.h>

Public Types

typedef ActionTp action_type
typedef StateTp state_type

Public Member Functions

 MCTSNodeBase (std::shared_ptr< MCTSNodeBase > parent, action_type action)
 MCTreeNodeBase.
virtual ~MCTSNodeBase ()=default
void add_child (std::shared_ptr< MCTSNodeBase< ActionTp, StateTp > > child)
 add_child
void add_child (std::shared_ptr< MCTSNodeBase< ActionTp, StateTp > > parent, action_type action)
 add_child
bool has_children () const noexcept
 has_children
std::shared_ptr< MCTSNodeBase > get_child (uint_t cidx) const
 get_child
uint_t n_children () const noexcept
 n_children
template<typename RandomEngine>
void shuffle_children (RandomEngine &engine)
 shuffle_children
uint_t n_explored_children () const noexcept
 explored_children
void update_visits () noexcept
 update_visits
void update_explored_children () noexcept
void update_total_score (real_t score) noexcept
 update_total_score
real_t ucb (real_t temperature) const
 ucb
std::shared_ptr< MCTSNodeBase > max_ucb_child (real_t temperature) const
 max_ucb_child
real_t win_pct () const
 win_pct
uint_t total_visits () const noexcept
 total_visits
action_type get_action () const noexcept
 get_action
std::shared_ptr< MCTSNodeBase > parent ()
 parent

Protected Attributes

real_t total_score_
 total_score_
uint_t total_visits_
 total_visits_
uint_t explored_children_
 explored_children_
action_type action_
 action_
std::shared_ptr< MCTSNodeBase > parent_
 parent_
std::vector< std::shared_ptr< MCTSNodeBase > > children_
 children_

Detailed Description

template<typename ActionTp, typename StateTp>
class bitrl::rl::algos::mc::MCTSNodeBase< ActionTp, StateTp >

Base class for Nodes in a MC tree search.

Member Typedef Documentation

◆ action_type

template<typename ActionTp, typename StateTp>
typedef ActionTp bitrl::rl::algos::mc::MCTSNodeBase< ActionTp, StateTp >::action_type

◆ state_type

template<typename ActionTp, typename StateTp>
typedef StateTp bitrl::rl::algos::mc::MCTSNodeBase< ActionTp, StateTp >::state_type

Constructor & Destructor Documentation

◆ MCTSNodeBase()

template<typename ActionTp, typename StateTp>
bitrl::rl::algos::mc::MCTSNodeBase< ActionTp, StateTp >::MCTSNodeBase ( std::shared_ptr< MCTSNodeBase< ActionTp, StateTp > > parent,
action_type action )

MCTreeNodeBase.

Parameters
parent
action

◆ ~MCTSNodeBase()

template<typename ActionTp, typename StateTp>
virtual bitrl::rl::algos::mc::MCTSNodeBase< ActionTp, StateTp >::~MCTSNodeBase ( )
virtualdefault

Member Function Documentation

◆ add_child() [1/2]

template<typename ActionTp, typename StateTp>
void bitrl::rl::algos::mc::MCTSNodeBase< ActionTp, StateTp >::add_child ( std::shared_ptr< MCTSNodeBase< ActionTp, StateTp > > child)

add_child

Parameters
child

◆ add_child() [2/2]

template<typename ActionTp, typename StateTp>
void bitrl::rl::algos::mc::MCTSNodeBase< ActionTp, StateTp >::add_child ( std::shared_ptr< MCTSNodeBase< ActionTp, StateTp > > parent,
action_type action )

add_child

Parameters
parent
action

◆ get_action()

template<typename ActionTp, typename StateTp>
action_type bitrl::rl::algos::mc::MCTSNodeBase< ActionTp, StateTp >::get_action ( ) const
inlinenoexcept

get_action

Returns

◆ get_child()

template<typename ActionTp, typename StateTp>
std::shared_ptr< MCTSNodeBase > bitrl::rl::algos::mc::MCTSNodeBase< ActionTp, StateTp >::get_child ( uint_t cidx) const
inline

get_child

Parameters
cidx
Returns

◆ has_children()

template<typename ActionTp, typename StateTp>
bool bitrl::rl::algos::mc::MCTSNodeBase< ActionTp, StateTp >::has_children ( ) const
inlinenoexcept

has_children

Returns

◆ max_ucb_child()

template<typename ActionTp, typename StateTp>
std::shared_ptr< MCTSNodeBase< ActionTp, StateTp > > bitrl::rl::algos::mc::MCTSNodeBase< ActionTp, StateTp >::max_ucb_child ( real_t temperature) const

max_ucb_child

Returns

◆ n_children()

template<typename ActionTp, typename StateTp>
uint_t bitrl::rl::algos::mc::MCTSNodeBase< ActionTp, StateTp >::n_children ( ) const
inlinenoexcept

n_children

Returns

◆ n_explored_children()

template<typename ActionTp, typename StateTp>
uint_t bitrl::rl::algos::mc::MCTSNodeBase< ActionTp, StateTp >::n_explored_children ( ) const
inlinenoexcept

explored_children

Returns

◆ parent()

template<typename ActionTp, typename StateTp>
std::shared_ptr< MCTSNodeBase > bitrl::rl::algos::mc::MCTSNodeBase< ActionTp, StateTp >::parent ( )
inline

parent

Returns

◆ shuffle_children()

template<typename ActionTp, typename StateTp>
template<typename RandomEngine>
void bitrl::rl::algos::mc::MCTSNodeBase< ActionTp, StateTp >::shuffle_children ( RandomEngine & engine)

shuffle_children

◆ total_visits()

template<typename ActionTp, typename StateTp>
uint_t bitrl::rl::algos::mc::MCTSNodeBase< ActionTp, StateTp >::total_visits ( ) const
inlinenoexcept

total_visits

Returns

◆ ucb()

template<typename ActionTp, typename StateTp>
real_t bitrl::rl::algos::mc::MCTSNodeBase< ActionTp, StateTp >::ucb ( real_t temperature) const

ucb

Parameters
temperature
Returns

◆ update_explored_children()

template<typename ActionTp, typename StateTp>
void bitrl::rl::algos::mc::MCTSNodeBase< ActionTp, StateTp >::update_explored_children ( )
inlinenoexcept

◆ update_total_score()

template<typename ActionTp, typename StateTp>
void bitrl::rl::algos::mc::MCTSNodeBase< ActionTp, StateTp >::update_total_score ( real_t score)
inlinenoexcept

update_total_score

Parameters
score

◆ update_visits()

template<typename ActionTp, typename StateTp>
void bitrl::rl::algos::mc::MCTSNodeBase< ActionTp, StateTp >::update_visits ( )
inlinenoexcept

update_visits

◆ win_pct()

template<typename ActionTp, typename StateTp>
real_t bitrl::rl::algos::mc::MCTSNodeBase< ActionTp, StateTp >::win_pct ( ) const
inline

win_pct

Returns

Member Data Documentation

◆ action_

template<typename ActionTp, typename StateTp>
action_type bitrl::rl::algos::mc::MCTSNodeBase< ActionTp, StateTp >::action_
protected

action_

◆ children_

template<typename ActionTp, typename StateTp>
std::vector<std::shared_ptr<MCTSNodeBase> > bitrl::rl::algos::mc::MCTSNodeBase< ActionTp, StateTp >::children_
protected

children_

◆ explored_children_

template<typename ActionTp, typename StateTp>
uint_t bitrl::rl::algos::mc::MCTSNodeBase< ActionTp, StateTp >::explored_children_
protected

explored_children_

◆ parent_

template<typename ActionTp, typename StateTp>
std::shared_ptr<MCTSNodeBase> bitrl::rl::algos::mc::MCTSNodeBase< ActionTp, StateTp >::parent_
protected

parent_

◆ total_score_

template<typename ActionTp, typename StateTp>
real_t bitrl::rl::algos::mc::MCTSNodeBase< ActionTp, StateTp >::total_score_
protected

total_score_

◆ total_visits_

template<typename ActionTp, typename StateTp>
uint_t bitrl::rl::algos::mc::MCTSNodeBase< ActionTp, StateTp >::total_visits_
protected

total_visits_


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