algorithms/mcts_basic.py
def choose(self):
        "Choose the best successor of node. (Choose a move in the game)"
        if self.root_node.is_terminal():
            raise RuntimeError(
                f"choose called on terminal node {self.root_node}")

        if self.root_node not in self.children:
            raise RuntimeError(f"No iterations performed {self.root_node}")

        def all_value_functions(n):
            assert self.N[n] > 0
            return self.Q[n] / self.N[n]  # average reward

        values = [(child, all_value_functions(child))
                  for child in self.children[self.root_node]]
        visitations = [(child, self.N[child])
                       for child in self.children[self.root_node]]
        return values, visitations
Choose the best successor of node. (Choose a move in the game)
Choose the best successor of node. (Choose a move in the game)
Choose the best successor of node . ( Choose a move in the game )
def choose(self):
        if self.root_node.is_terminal():
            raise RuntimeError(
                f"choose called on terminal node {self.root_node}")
        if self.root_node not in self.children:
            raise RuntimeError(f"No iterations performed {self.root_node}")
        def all_value_functions(n):
            assert self.N[n] > 0
            return self.Q[n] / self.N[n]  
        values = [(child, all_value_functions(child))
                  for child in self.children[self.root_node]]
        visitations = [(child, self.N[child])
                       for child in self.children[self.root_node]]
        return values, visitations
def choose ( self ) : if self . root_node . is_terminal ( ) : raise RuntimeError ( f"choose called on terminal node {self.root_node}" ) if self . root_node not in self . children : raise RuntimeError ( f"No iterations performed {self.root_node}" ) def all_value_functions ( n ) : assert self . N [ n ] > 0 return self . Q [ n ] / self . N [ n ] values = [ ( child , all_value_functions ( child ) ) for child in self . children [ self . root_node ] ] visitations = [ ( child , self . N [ child ] ) for child in self . children [ self . root_node ] ] return values , visitations
Choose the best successor of node.
Choose the best successor of node .
"Choose the best successor of node. (Choose a move in the game)" # average reward
self