MCPcopy Index your code
hub / github.com/algorithmicsuperintelligence/optillm / simulate

Method simulate

optillm/rstar.py:152–165  ·  view source on GitHub ↗
(self, node: Node)

Source from the content-addressed store, hash-verified

150 return child_node
151
152 def simulate(self, node: Node) -> float:
153 current_node = node
154 depth = 0
155 logger.debug("Starting simulation")
156 while depth < self.max_depth:
157 if not current_node.children:
158 action = random.choice(self.actions)
159 current_node = self.expand(current_node, action)
160 else:
161 current_node = random.choice(current_node.children)
162 depth += 1
163 value = self.evaluate(current_node)
164 logger.debug(f"Simulation complete. Final value: {value}")
165 return value
166
167 def backpropagate(self, node: Node, value: float):
168 logger.debug("Starting backpropagation")

Callers 1

mctsMethod · 0.95

Calls 2

expandMethod · 0.95
evaluateMethod · 0.95

Tested by

no test coverage detected