Skip to content

Commit 8dc5d13

Browse files
committed
add mcts test
1 parent 39a8094 commit 8dc5d13

File tree

7 files changed

+1264
-143
lines changed

7 files changed

+1264
-143
lines changed

visual-tree-search-backend/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,12 @@ python run_demo_treesearch_async.py \
9090
```
9191
uvicorn app.main:app --host 0.0.0.0 --port 3000
9292
python test/test-tree-search-ws-lats.py
93+
```
94+
95+
## 7. Add MCTS agent
96+
* test run_demo_treesearch_async.py
97+
* test web socket
98+
```
99+
uvicorn app.main:app --host 0.0.0.0 --port 3000
100+
python test/test-tree-search-ws-mcts.py
93101
```

visual-tree-search-backend/app/api/lwats/agents_async/SearchAgents/mcts_agent.py

Lines changed: 941 additions & 1 deletion
Large diffs are not rendered by default.

visual-tree-search-backend/app/api/routes/new_tree_search_websocket.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ async def handle_search_request(websocket: WebSocket, message: Dict[str, Any]):
128128
await agent.dfs_with_websocket(websocket)
129129
elif search_algorithm.lower() == "lats":
130130
await agent.run(websocket)
131+
elif search_algorithm.lower() == "mcts":
132+
await agent.run(websocket)
131133
else:
132134
await websocket.send_json({
133135
"type": "error",

visual-tree-search-backend/app/api/routes/tree_search_websocket.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ async def handle_search_request(websocket: WebSocket, message: Dict[str, Any]):
128128
await agent.dfs_with_websocket(websocket)
129129
elif search_algorithm.lower() == "lats":
130130
await agent.run(websocket)
131+
elif search_algorithm.lower() == "mcts":
132+
await agent.run(websocket)
131133
else:
132134
await websocket.send_json({
133135
"type": "error",
Lines changed: 141 additions & 141 deletions
Original file line numberDiff line numberDiff line change
@@ -1,142 +1,142 @@
11
[
2-
{
3-
"name": "mage-cache-storage",
4-
"value": "{}",
5-
"domain": "128.105.145.205",
6-
"path": "/",
7-
"expires": 1775110732,
8-
"httpOnly": false,
9-
"secure": false,
10-
"sameSite": "Lax"
11-
},
12-
{
13-
"name": "mage-cache-storage-section-invalidation",
14-
"value": "{}",
15-
"domain": "128.105.145.205",
16-
"path": "/",
17-
"expires": 1775110732,
18-
"httpOnly": false,
19-
"secure": false,
20-
"sameSite": "Lax"
21-
},
22-
{
23-
"name": "mage-messages",
24-
"value": "",
25-
"domain": "128.105.145.205",
26-
"path": "/",
27-
"expires": 1775272527,
28-
"httpOnly": false,
29-
"secure": false,
30-
"sameSite": "Strict"
31-
},
32-
{
33-
"name": "recently_viewed_product",
34-
"value": "{}",
35-
"domain": "128.105.145.205",
36-
"path": "/",
37-
"expires": 1775110732,
38-
"httpOnly": false,
39-
"secure": false,
40-
"sameSite": "Lax"
41-
},
42-
{
43-
"name": "recently_viewed_product_previous",
44-
"value": "{}",
45-
"domain": "128.105.145.205",
46-
"path": "/",
47-
"expires": 1775110732,
48-
"httpOnly": false,
49-
"secure": false,
50-
"sameSite": "Lax"
51-
},
52-
{
53-
"name": "recently_compared_product",
54-
"value": "{}",
55-
"domain": "128.105.145.205",
56-
"path": "/",
57-
"expires": 1775110732,
58-
"httpOnly": false,
59-
"secure": false,
60-
"sameSite": "Lax"
61-
},
62-
{
63-
"name": "recently_compared_product_previous",
64-
"value": "{}",
65-
"domain": "128.105.145.205",
66-
"path": "/",
67-
"expires": 1775110732,
68-
"httpOnly": false,
69-
"secure": false,
70-
"sameSite": "Lax"
71-
},
72-
{
73-
"name": "product_data_storage",
74-
"value": "{}",
75-
"domain": "128.105.145.205",
76-
"path": "/",
77-
"expires": 1775110732,
78-
"httpOnly": false,
79-
"secure": false,
80-
"sameSite": "Lax"
81-
},
82-
{
83-
"name": "private_content_version",
84-
"value": "c514ad01bc9816ee30ab1f02510aa34a",
85-
"domain": "128.105.145.205",
86-
"path": "/",
87-
"expires": 1778296522.505323,
88-
"httpOnly": false,
89-
"secure": false,
90-
"sameSite": "Lax"
91-
},
92-
{
93-
"name": "PHPSESSID",
94-
"value": "007c737fca0eb4173ab5362c2d9c8b09",
95-
"domain": "128.105.145.205",
96-
"path": "/",
97-
"expires": 1775272526.468528,
98-
"httpOnly": true,
99-
"secure": false,
100-
"sameSite": "Lax"
101-
},
102-
{
103-
"name": "X-Magento-Vary",
104-
"value": "9bf9a599123e6402b85cde67144717a08b817412",
105-
"domain": "128.105.145.205",
106-
"path": "/",
107-
"expires": 1775272526.468754,
108-
"httpOnly": true,
109-
"secure": false,
110-
"sameSite": "Lax"
111-
},
112-
{
113-
"name": "form_key",
114-
"value": "Hsr3n5ycGkOPfr1K",
115-
"domain": "128.105.145.205",
116-
"path": "/",
117-
"expires": 1775272526.468692,
118-
"httpOnly": false,
119-
"secure": false,
120-
"sameSite": "Lax"
121-
},
122-
{
123-
"name": "mage-cache-sessid",
124-
"value": "true",
125-
"domain": "128.105.145.205",
126-
"path": "/",
127-
"expires": 1775272527,
128-
"httpOnly": false,
129-
"secure": false,
130-
"sameSite": "Lax"
131-
},
132-
{
133-
"name": "section_data_ids",
134-
"value": "{%22messages%22:1743736525%2C%22customer%22:1743736525%2C%22compare-products%22:1743736525%2C%22last-ordered-items%22:1743736525%2C%22cart%22:1743736525%2C%22directory-data%22:1743736525%2C%22captcha%22:1743736525%2C%22instant-purchase%22:1743736525%2C%22loggedAsCustomer%22:1743736525%2C%22persistent%22:1743736525%2C%22review%22:1743736525%2C%22wishlist%22:1743736525%2C%22recently_viewed_product%22:1743736525%2C%22recently_compared_product%22:1743736525%2C%22product_data_storage%22:1743736525%2C%22paypal-billing-agreement%22:1743736525}",
135-
"domain": "128.105.145.205",
136-
"path": "/",
137-
"expires": 1775272524,
138-
"httpOnly": false,
139-
"secure": false,
140-
"sameSite": "Lax"
141-
}
142-
]
2+
{
3+
"name": "mage-cache-storage",
4+
"value": "{}",
5+
"domain": "128.105.145.205",
6+
"path": "/",
7+
"expires": 1775110732,
8+
"httpOnly": false,
9+
"secure": false,
10+
"sameSite": "Lax"
11+
},
12+
{
13+
"name": "mage-cache-storage-section-invalidation",
14+
"value": "{}",
15+
"domain": "128.105.145.205",
16+
"path": "/",
17+
"expires": 1775110732,
18+
"httpOnly": false,
19+
"secure": false,
20+
"sameSite": "Lax"
21+
},
22+
{
23+
"name": "mage-messages",
24+
"value": "",
25+
"domain": "128.105.145.205",
26+
"path": "/",
27+
"expires": 1775370120,
28+
"httpOnly": false,
29+
"secure": false,
30+
"sameSite": "Strict"
31+
},
32+
{
33+
"name": "recently_viewed_product",
34+
"value": "{}",
35+
"domain": "128.105.145.205",
36+
"path": "/",
37+
"expires": 1775110732,
38+
"httpOnly": false,
39+
"secure": false,
40+
"sameSite": "Lax"
41+
},
42+
{
43+
"name": "recently_viewed_product_previous",
44+
"value": "{}",
45+
"domain": "128.105.145.205",
46+
"path": "/",
47+
"expires": 1775110732,
48+
"httpOnly": false,
49+
"secure": false,
50+
"sameSite": "Lax"
51+
},
52+
{
53+
"name": "recently_compared_product",
54+
"value": "{}",
55+
"domain": "128.105.145.205",
56+
"path": "/",
57+
"expires": 1775110732,
58+
"httpOnly": false,
59+
"secure": false,
60+
"sameSite": "Lax"
61+
},
62+
{
63+
"name": "recently_compared_product_previous",
64+
"value": "{}",
65+
"domain": "128.105.145.205",
66+
"path": "/",
67+
"expires": 1775110732,
68+
"httpOnly": false,
69+
"secure": false,
70+
"sameSite": "Lax"
71+
},
72+
{
73+
"name": "product_data_storage",
74+
"value": "{}",
75+
"domain": "128.105.145.205",
76+
"path": "/",
77+
"expires": 1775110732,
78+
"httpOnly": false,
79+
"secure": false,
80+
"sameSite": "Lax"
81+
},
82+
{
83+
"name": "private_content_version",
84+
"value": "ff4bba58081243f67b1adee2cc6974bd",
85+
"domain": "128.105.145.205",
86+
"path": "/",
87+
"expires": 1778394118.522057,
88+
"httpOnly": false,
89+
"secure": false,
90+
"sameSite": "Lax"
91+
},
92+
{
93+
"name": "PHPSESSID",
94+
"value": "30247306b1ad824f37f3e0384d86d991",
95+
"domain": "128.105.145.205",
96+
"path": "/",
97+
"expires": 1775370122.385659,
98+
"httpOnly": true,
99+
"secure": false,
100+
"sameSite": "Lax"
101+
},
102+
{
103+
"name": "X-Magento-Vary",
104+
"value": "9bf9a599123e6402b85cde67144717a08b817412",
105+
"domain": "128.105.145.205",
106+
"path": "/",
107+
"expires": 1775370122.385877,
108+
"httpOnly": true,
109+
"secure": false,
110+
"sameSite": "Lax"
111+
},
112+
{
113+
"name": "form_key",
114+
"value": "IEPmx1hKh4NWjeUa",
115+
"domain": "128.105.145.205",
116+
"path": "/",
117+
"expires": 1775370122.385817,
118+
"httpOnly": false,
119+
"secure": false,
120+
"sameSite": "Lax"
121+
},
122+
{
123+
"name": "mage-cache-sessid",
124+
"value": "true",
125+
"domain": "128.105.145.205",
126+
"path": "/",
127+
"expires": 1775370120,
128+
"httpOnly": false,
129+
"secure": false,
130+
"sameSite": "Lax"
131+
},
132+
{
133+
"name": "section_data_ids",
134+
"value": "{%22messages%22:1743834120%2C%22customer%22:1743834120%2C%22compare-products%22:1743834120%2C%22last-ordered-items%22:1743834120%2C%22cart%22:1743834120%2C%22directory-data%22:1743834120%2C%22captcha%22:1743834120%2C%22instant-purchase%22:1743834120%2C%22loggedAsCustomer%22:1743834120%2C%22persistent%22:1743834120%2C%22review%22:1743834120%2C%22wishlist%22:1743834120%2C%22recently_viewed_product%22:1743834120%2C%22recently_compared_product%22:1743834120%2C%22product_data_storage%22:1743834120%2C%22paypal-billing-agreement%22:1743834120}",
135+
"domain": "128.105.145.205",
136+
"path": "/",
137+
"expires": 1775370120,
138+
"httpOnly": false,
139+
"secure": false,
140+
"sameSite": "Lax"
141+
}
142+
]

visual-tree-search-backend/test/test-tree-search-ws-lats.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def parse_arguments():
138138
parser.add_argument("--goal", type=str, default=DEFAULT_GOAL,
139139
help=f"Goal to achieve (default: {DEFAULT_GOAL})")
140140

141-
parser.add_argument("--algorithm", type=str, choices=["bfs", "dfs", "lats"], default="lats",
141+
parser.add_argument("--algorithm", type=str, choices=["bfs", "dfs", "lats", "mcts"], default="lats",
142142
help="Search algorithm to use (default: lats)")
143143

144144
parser.add_argument("--max-depth", type=int, default=3,

0 commit comments

Comments
 (0)