Dynamic planning Process: each decision depends on the current state, that is, the next state depends on the current state. A decision sequence is generated in the state of change, and the process of solving this multistage optimization problem is dynamic rule process.
Basic thought principle
Similar to the principle of divide-and-conquer, the problem to be solved is divided into several sub-problems (stages) solving, the order of solving each child problem (stage), the former sub-problem (stage) to provide useful information for the solution of the latter sub-problem (phase). Through the solution of each sub-problem (phase), successive progression, the solution of the initial problem is finally obtained. In general, problems that can be solved by dynamic programming can also be solved by recursion.
The problem of dynamic programming solves most problems with overlapping sub-problems, in order to reduce the repetition, the solution of each sub-problem is solved only once, and the solutions of different sub-problems (phases) are saved in the array.
The difference between divide and conquer: several sub-problems (stages) of divide and conquer are generally independent of each other, and there are no sequential requirements between the sub-problems (stages). In the dynamic programming, the solutions of sub-problems (stages) are ordered , with overlapping sub-problems (stages), and the solution of the latter sub-problem (phase) depends on the solution of the previous sub-problem (phase).
and recursive difference: with the recursive solution is not very different, are divided into sub-problem (phase), the latter sub-problem (stage) depends on the previous sub-problem (stage), but recursion needs to solve the same sub-problem (phase) repeatedly, compared to the dynamic planning to do a lot of repetitive work .
Applicable problem Solving
The problem of solving with dynamic programming generally has the following properties:
- Optimization principle: The solution problem contains the optimal sub-structure, i.e., the optimal solution of the latter sub-problem (stage) can be deduced from the optimal derivation of the previous sub-problem (stage), and the optimal solution of the initial problem is obtained by progressive.
- No effect: The process after a state does not affect the previous state, only the current state.
- Overlapping sub-problems: Sub-problems (stages) are not independent, and a sub-problem (phase) is used in the next sub-problem (phase). (Not a required condition, but dynamic planning is better than the basis of other methods)
Solution steps
Dynamic Programming algorithm