-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsimple_run.py
35 lines (31 loc) · 1.39 KB
/
simple_run.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from CoT.task import CoT_Task
from ToT.task import ToT_Task
from MCTS.task import MCTS_Task
from utils.visualize import visualize
def simple_run(q, mode, iteration_limit=50):
if mode == 'mcts':
Task = MCTS_Task(q, iteration_limit=iteration_limit)
final_answer, root = Task.run()
print('-' * 100)
print(final_answer['solution'] + final_answer['summary'])
visualize(root, Task, 'simpleRun', 'test', 1)
elif mode == 'tot':
Task = ToT_Task(q)
final_answer, root = Task.run()
print('-' * 100)
print(final_answer['solution'] + final_answer['summary'])
visualize(root, Task, 'simpleRun', 'test', 1)
elif mode == 'cot':
Task = CoT_Task(q)
final_answer = Task.run()
print('-' * 100)
print(final_answer['solution'])
else:
print("Unsupported mode!\n")
if __name__ == '__main__':
question = '''
A fluid has density $870 \mathrm{~kg} / \mathrm{m}^3$ and flows with velocity $\mathbf{v}=z \mathbf{i}+y^2 \mathbf{j}+x^2 \mathbf{k}$, where $x, y$, and $z$ are measured in meters and the components of $\mathbf{v}$ in meters per second.
Find the rate of flow outward through the cylinder $x^2+y^2=4$, $0 \leqslant z \leqslant 1$.
The unit of the answer should be $\mathrm{kg}/\mathrm{s}$.
'''
simple_run(question, 'tot')