File tree Expand file tree Collapse file tree 1 file changed +27
-1
lines changed
visual-tree-search-backend/app/api/lwats/agents_async/SearchAgents Expand file tree Collapse file tree 1 file changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -17,4 +17,30 @@ async def run(self, websocket=None) -> list[LATSNode]:
1717 "timestamp" : datetime .utcnow ().isoformat ()
1818 })
1919
20- pass
20+ best_node = await self .mcts_search (websocket )
21+ print_trajectory (best_node )
22+ return best_node
23+
24+
25+ # Performs Monte Carlo Tree Search starting from the root node with WebSocket updates.
26+ # Uses GPT-4 for node selection and reflection-based backpropagation.
27+ async def mcts_search (self , websocket = None ):
28+ for i in range (self .config .iterations ):
29+ await self .websocket_iteration_start (i , websocket = websocket )
30+
31+ print (f"Iteration { i } /{ self .config .iterations } ..." )
32+
33+ # Step 1: Node Selection
34+ # Selection: Use GPT-4 to select a promising path
35+
36+
37+ # Step 2: Node Expansion
38+ # Expansion: Expand the selected node if possible
39+
40+
41+ # Step 3: Node Simulation
42+ # Simulation: Evaluate the current path
43+
44+
45+ # Step 4: Backpropagation
46+ # # Reflection-based backpropagation
You can’t perform that action at this time.
0 commit comments