bitrl & cuberl Documentation
Simulation engine for reinforcement learning agents
Loading...
Searching...
No Matches
cubeai::rl::algos::mc::MCTSNodeBase< ActionTp, StateTp > Class Template Reference

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

#include <mcts_node.h>

Collaboration diagram for cubeai::rl::algos::mc::MCTSNodeBase< ActionTp, StateTp >:

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< MCTSNodeBaseget_child (uint_t cidx)
 get_child
 
uint_t n_children () const noexcept
 n_children
 
void shuffle_children () noexcept
 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< MCTSNodeBasemax_ucb_child (real_t temperature) const
 max_ucb_child
 
real_t win_pct () const
 win_pct
 
uint_t total_visits () const noexcept
 total_visits
 
uint_t get_action () const noexcept
 get_action
 
std::shared_ptr< MCTSNodeBaseparent ()
 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< MCTSNodeBaseparent_
 parent_
 
std::vector< std::shared_ptr< MCTSNodeBase > > children_
 children_
 

Detailed Description

template<typename ActionTp, typename StateTp>
class cubeai::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 cubeai::rl::algos::mc::MCTSNodeBase< ActionTp, StateTp >::action_type

◆ state_type

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

Constructor & Destructor Documentation

◆ MCTSNodeBase()

template<typename ActionTp , typename StateTp >
cubeai::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 cubeai::rl::algos::mc::MCTSNodeBase< ActionTp, StateTp >::~MCTSNodeBase ( )
virtualdefault

Member Function Documentation

◆ add_child() [1/2]

template<typename ActionTp , typename StateTp >
void cubeai::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 cubeai::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 >
uint_t cubeai::rl::algos::mc::MCTSNodeBase< ActionTp, StateTp >::get_action ( ) const
inlinenoexcept

get_action

Returns

◆ get_child()

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

get_child

Parameters
cidx
Returns

◆ has_children()

template<typename ActionTp , typename StateTp >
bool cubeai::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 > > cubeai::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 cubeai::rl::algos::mc::MCTSNodeBase< ActionTp, StateTp >::n_children ( ) const
inlinenoexcept

n_children

Returns

◆ n_explored_children()

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

explored_children

Returns

◆ parent()

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

parent

Returns

◆ shuffle_children()

template<typename ActionTp , typename StateTp >
void cubeai::rl::algos::mc::MCTSNodeBase< ActionTp, StateTp >::shuffle_children ( )
noexcept

shuffle_children

◆ total_visits()

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

total_visits

Returns

◆ ucb()

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

ucb

Parameters
temperature
Returns

◆ update_explored_children()

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

◆ update_total_score()

template<typename ActionTp , typename StateTp >
void cubeai::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 cubeai::rl::algos::mc::MCTSNodeBase< ActionTp, StateTp >::update_visits ( )
inlinenoexcept

update_visits

◆ win_pct()

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

win_pct

Returns

Member Data Documentation

◆ action_

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

action_

◆ children_

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

children_

◆ explored_children_

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

explored_children_

◆ parent_

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

parent_

◆ total_score_

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

total_score_

◆ total_visits_

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

total_visits_


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