alpaca/alpacka/agents/stochastic_mcts.py
def _traverse(self, root, observation, path):
        """Chooses a path from the root to a leaf in the search tree.

        Does not modify the nodes.

        Args:
            root (TreeNode): Root of the search tree.
            observation (np.ndarray): Observation received at root.
            path (list): Empty list that will be filled with pairs
                (reward, node) of nodes visited during traversal and rewards
                collected when stepping into them. It is passed as an argument
                rather than returned, so we can access the result in case of
                a DeadEnd exception.

        Returns:
            Tuple (observation, done, visited), where observation is the
            observation received in the leaf, done is the "done" flag received
            when stepping into the leaf and visited is a set of GraphNodes
            visited on the path. In case of a "done", traversal is interrupted.
        """
        assert not path, 'Path accumulator should initially be empty.'
        path.append((0, root))
        visited = {root.graph_node}
        node = root
        done = False
        visited = set()
        while not node.is_leaf and not done:
            action = self._choose_action(node, visited)
            node = node.children[action]
            (observation, reward, done, _) = self._model.step(action)
            path.append((reward, node))
            visited.add(node.graph_node)
        return (observation, done, visited)
Chooses a path from the root to a leaf in the search tree.

        Does not modify the nodes.

        Args:
            root (TreeNode): Root of the search tree.
            observation (np.ndarray): Observation received at root.
            path (list): Empty list that will be filled with pairs
                (reward, node) of nodes visited during traversal and rewards
                collected when stepping into them. It is passed as an argument
                rather than returned, so we can access the result in case of
                a DeadEnd exception.

        Returns:
            Tuple (observation, done, visited), where observation is the
            observation received in the leaf, done is the "done" flag received
            when stepping into the leaf and visited is a set of GraphNodes
            visited on the path. In case of a "done", traversal is interrupted.
        
Chooses a path from the root to a leaf in the search tree.
Does not modify the nodes.
Chooses a path from the root to a leaf in the search tree . Does not modify the nodes .
def _traverse(self, root, observation, path):
        assert not path, 'Path accumulator should initially be empty.'
        path.append((0, root))
        visited = {root.graph_node}
        node = root
        done = False
        visited = set()
        while not node.is_leaf and not done:
            action = self._choose_action(node, visited)
            node = node.children[action]
            (observation, reward, done, _) = self._model.step(action)
            path.append((reward, node))
            visited.add(node.graph_node)
        return (observation, done, visited)
def _traverse ( self , root , observation , path ) : assert not path , 'Path accumulator should initially be empty.' path . append ( ( 0 , root ) ) visited = { root . graph_node } node = root done = False visited = set ( ) while not node . is_leaf and not done : action = self . _choose_action ( node , visited ) node = node . children [ action ] ( observation , reward , done , _ ) = self . _model . step ( action ) path . append ( ( reward , node ) ) visited . add ( node . graph_node ) return ( observation , done , visited )
Chooses a path from the root to a leaf in the search tree.
Chooses a path from the root to a leaf in the search tree .
"""Chooses a path from the root to a leaf in the search tree.

        Does not modify the nodes.

        Args:
            root (TreeNode): Root of the search tree.
            observation (np.ndarray): Observation received at root.
            path (list): Empty list that will be filled with pairs
                (reward, node) of nodes visited during traversal and rewards
                collected when stepping into them. It is passed as an argument
                rather than returned, so we can access the result in case of
                a DeadEnd exception.

        Returns:
            Tuple (observation, done, visited), where observation is the
            observation received in the leaf, done is the "done" flag received
            when stepping into the leaf and visited is a set of GraphNodes
            visited on the path. In case of a "done", traversal is interrupted.
        """
Tuple (observation, done, visited), where observation is the
observation received in the leaf, done is the "done" flag received
when stepping into the leaf and visited is a set of GraphNodes
visited on the path. In case of a "done", traversal is interrupted.
Tuple ( observation done visited ) where observation is the observation received in the leaf done is the " done " flag received when stepping into the leaf and visited is a set of GraphNodes visited on the path . In case of a " done " traversal is interrupted .
self
root
Root of the search tree.
Root of the search tree .
observation
Observation received at root.
Observation received at root .
path
Empty list that will be filled with pairs
(reward, node) of nodes visited during traversal and rewards
collected when stepping into them. It is passed as an argument
rather than returned, so we can access the result in case of
a DeadEnd exception.
Empty list that will be filled with pairs ( reward node ) of nodes visited during traversal and rewards collected when stepping into them . It is passed as an argument rather than returned so we can access the result in case of a DeadEnd exception .