Dynamic Programming algorithm

Source: Internet
Author: User

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:

  1. 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.
  2. No effect: The process after a state does not affect the previous state, only the current state.
  3. 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.