libmcts
A Monte Carlo Tree Search Library
Public Types | Public Member Functions | List of all members
mcts::SamplingSelector< Context, Config > Class Template Reference

selector that chooses random children uniformly More...

#include <sampling_selector.hpp>

Inheritance diagram for mcts::SamplingSelector< Context, Config >:
mcts::ISelectionStrategy< Context, Config >

Public Types

typedef std::uniform_int_distribution DistributionType
 
- Public Types inherited from mcts::ISelectionStrategy< Context, Config >
typedef ISelectionStrategy< Context, Config > sstrategy_t
 

Public Member Functions

node_tselect (node_t *node)
 randomly chooses a child of node More...
 

Detailed Description

template<typename Context, typename Config>
class mcts::SamplingSelector< Context, Config >

selector that chooses random children uniformly

Template Parameters
Context@README
Config@README

Definition at line 17 of file sampling_selector.hpp.

Member Function Documentation

◆ select()

template<typename Context , typename Config >
node_t* mcts::SamplingSelector< Context, Config >::select ( node_t node)
inlinevirtual

randomly chooses a child of node

Parameters
nodeto select child from
Returns
a random node

Implements mcts::ISelectionStrategy< Context, Config >.

Definition at line 30 of file sampling_selector.hpp.

30  {
31  DistributionType dist(0, node->children().size() - 1);
32  int rand = dist(*node->config()->nb_gen());
33  return node->children()[rand];
34  }

Referenced by mcts::SamplingToFunctionSelector< Context, Config >::select().


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