A log of wood has n marks on it. Cost of cutting wood at a particular mark is proportional to the length of the log. The log of wood can be cut at all the marks. Find the optimal order of the marks where the log should be cut in order to minimize the total cost of cutting.
--------------------------------------------------------------------------------------
Use dynamic programming.
1) Add two auxilary marks on each end of the log (totally n+2 marks)
2) min_cost[i][j]=minimum{min_cost[i][k] + min_cost[k][j] + length[i][j]}, where k=i+1 to j-1
3) min_cost[i][i+1]=0
4) min_cost[i][i+2]=length[i][i+2]
Find min_cost[0][n+1].

本文介绍了一种使用动态规划解决木材切割成本最小化问题的方法。通过添加辅助标记并递归求解子问题,找到最佳切割顺序。
1万+

被折叠的 条评论
为什么被折叠?



