File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
lectures/_static/lecture_specific/optgrowth Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -4,12 +4,12 @@ def solve_model(og,
44 verbose = True ,
55 print_skip = 25 ):
66 """
7- Solve model by iterating with the Bellman operator.
7+ 通过迭代贝尔曼算子求解
88
99 """
1010
11- # Set up loop
12- v = og .u (og .grid ) # Initial condition
11+ # 设置迭代循环
12+ v = og .u (og .grid ) # 初始条件
1313 i = 0
1414 error = tol + 1
1515
@@ -18,12 +18,12 @@ def solve_model(og,
1818 error = np .max (np .abs (v - v_new ))
1919 i += 1
2020 if verbose and i % print_skip == 0 :
21- print (f"Error at iteration { i } is { error } . " )
21+ print (f"第 { i } 次迭代的误差为 { error } 。 " )
2222 v = v_new
2323
2424 if error > tol :
25- print ("Failed to converge! " )
25+ print ("未能收敛! " )
2626 elif verbose :
27- print (f"\n Converged in { i } iterations. " )
27+ print (f"\n 在 { i } 次迭代后收敛。 " )
2828
2929 return v_greedy , v_new
You can’t perform that action at this time.
0 commit comments