1. 什么是动态规划
-------------------------------------------
dynamic programming is a method for solving complex problems by breaking them down into simpler subproblems. (通过把原问题分解为相对简单的子问题的方式求解复杂问题的方法)
咦,这不就是分而治之法吗?不,虽然它们的目的是一样的,但它们分解的子问题属性不同。
- 分而治之将问题划分为互不相交的子问题。
- 动态规划不同,动态规划应用于子问题重叠情况,即不同的子问题具有公共的子子问题。
- 最优子结构:如果问题的最优解所包含的子问题的解也是最优的,就称该问题具有最优子结构,即满足最优化原理。
- 无后效性:即某阶段状态一旦确定,就不受这个状态以后决策的影响。也就是说,某状态以后的过程不会影响以前的状态,只与当前状态有关。
- 重叠子问题:即子问题之间是不独立的,一个子问题在下一阶段决策中可能被多次使用到。(该性质并不是动态规划适用的必要条件,但是如果没有这条性质,动态规划算法同其他算法相比就不具备优势)
2. 流水线调度问题
- Characterize the structure of an optimal solution. (分析最优解的性质,并刻画其结构特征)
- Recursively define the value of an optimal solution. (递归的定义最优解)
- Compute the value of an optimal solution in a bottom-up fashion. (以自底向上或自顶向下的记忆化方式(备忘录法)计算出最优值)
- Construct an optimal solution from computed information. (根据计算最优值时得到的信息,构造问题的最优解)
-
the fastest way through station S1,j-1 and then directly through stationS1,j, or
-
the fastest way through station S2,j-1, a transfer from line 2 to line 1, and then through stationS1,j.
-
the fastest way through station S2,j-1 and then directly through stationS2,j, or
-
the fastest way through station S1,j-1, a transfer from line 1 to line 2, and then through stationS2,j.

本文详细介绍了动态规划的概念,包括它的最优子结构、无后效性和重叠子问题特性。通过流水线调度和矩阵链乘法的实际问题,阐述了动态规划的解决思路。此外,还探讨了动态规划不适用于不具备最优子结构的问题,并强调了解决动态规划问题时无后效性的关键作用。最后,提到了动态规划在最长公共子序列、背包问题和最优二叉搜索树等经典问题中的应用。
最低0.47元/天 解锁文章
597

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



