MCPcopy Create free account
hub / github.com/MARIO-Math-Reasoning/Super_MARIO / selection

Method selection

mcts_math/agents/mcts.py:67–77  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

65 self.expansion_evaluation_backpropagation(node)
66
67 def selection(self) -> Optional[Type[MCTSNode]]:
68 node = self.root
69 # while node.has_children() or node.is_terminal: # for some purpose, but i forget it.
70 while node.has_children() and not node.is_terminal: # for mcts, it should be like this
71 next_node = self.select_child(node) # To encourage exploration, select from non-terminal children
72 if next_node is None: # if None,it mean all children are terminal
73 node.is_terminal = True
74 break
75 node = next_node
76
77 return None if node.is_terminal else node
78
79 def select_child(self, node: Type[MCTSNode]) -> Optional[Type[MCTSNode]]:
80 # TODO: implement multi-strategy

Callers 2

searchMethod · 0.95
select_next_stepMethod · 0.95

Calls 2

select_childMethod · 0.95
has_childrenMethod · 0.80

Tested by

no test coverage detected