12 template<
typename this_t,
typename HYP>
17 using data_t =
typename HYP::data_t;
20 if(
DEBUG_MCTS)
DEBUG(
"MinimalMCTSNode SEARCH ONE ",
this,
"\t["+current.string()+
"] ", (
unsigned long) this->
nvisits);
24 while(not current.is_evaluable()) {
25 c->add_children(current);
28 auto neigh = current.neighbors();
29 std::vector<double> children_lps(neigh,-
infinity);
30 for(
int k=0;k<neigh;k++) {
31 children_lps[k] = current.neighbor_prior(k);
34 auto idx =
arg_max_int(neigh, [&](
const int i) ->
double {
return children_lps[i];} ).first;
35 current.expand_to_neighbor(idx);
36 c = &c->children[idx];
39 c->process_evaluable(current);
#define DEBUG_MCTS
Definition: MCTSBase.h:3
Definition: MinimalMCTSNode.h:13
typename HYP::data_t data_t
Definition: MCTSBase.h:46
constexpr double infinity
Definition: Numerics.h:20
Definition: generator.hpp:21
virtual this_t * descend_to_childless(HYP ¤t)
This goes down the tree to a node with no children (OR evaluable)
Definition: MCTSBase.h:300
Definition: MCTSBase.h:41
void DEBUG(FIRST f, ARGS... args)
Print to std:ccout with debugging info.
Definition: IO.h:73
std::pair< size_t, double > arg_max_int(unsigned int max, const std::function< double(const int)> &f)
Definition: Random.h:395
std::atomic< unsigned int > nvisits
Definition: MCTSBase.h:59