006-algorithm-Dynamic Programming

Source: Internet
Author: User
I. concept:Dynamic Programming (DP) is used in mathematics, scientific computation, and economics to solve complex problems by breaking down the original problem into relatively simple subproblems. DP is often suitable for overlapping subproblems and optimal sub-structure problems. the time consumed by DP is often less than that of the simple solution (take space for time ). The color concept behind dynamic planning is very simple. We can solve a given problem, break down sub-problems, and then combine them to get the solution of the original problem. Generally, many subproblems are very similar. Therefore, the dynamic programming method tries to solve each subproblem one time, thus reducing the calculation workload. Once a subproblem has been solved, the memory is stored, query the table directly when you need to solve the same subproblem again. This approach is particularly useful in the exponential growth of input size in the number of replay issues.
Ii. classification:Dynamic Planning can be divided into four types: linear dynamic planning, regional dynamic planning, tree-like dynamic planning, and backpack dynamic planning. Linear Motion gauge: intercepts missiles, leeches, mines, schools, swordsmen, and other regional motion gauges: Stone merger, bonus Binary Tree, Word Count statistics, artillery layout, and other tree motion gauge: greedy 9-headed dragon, binary search tree, Happy party, digital triangle and other backpack problems: 01 backpack problems, full backpack problems, grouping backpack problems, two-dimensional backpack, packing problems, squeeze milk. Basic Ideas of application instance Shortest Path, project management, and Network Flow Optimization
A dynamic planning algorithm is usually used to solve a problem with an optimal nature. In such problems, there may be many feasible solutions. Each solution corresponds to a value. We hope to find a solution with the optimal value. The dynamic planning algorithm is similar to the divide and conquer method. Its basic idea is to break down the problem to be solved into several subproblems, first solve the subproblems, and then obtain the original solution from the subproblems. Different from the Division and control method, it is suitable for Dynamic Planning and solving problems. After decomposition, subproblems are often not independent of each other. If you use the divide and conquer method to solve this type of problem, the number of subproblems obtained by the decomposition is too large, and some subproblems are repeatedly calculated many times. If we can save the answers to the resolved sub-questions and find the answers we have obtained when necessary, we can avoid a large number of repeated computations and save time. We can use a table to record the answers to all resolved subquestions. Whether or not this subproblem is used in the future, as long as it has been computed, the results will be filled in the table. This is the basic idea of dynamic planning. The specific dynamic planning algorithms are diverse, but they have the same table filling format. In the multi-stage decision-making of the basic structure, the decisions adopted at each stage are generally Time-relatedThe decision depends on the current state, and immediately leads to state transfer. A decision sequence is generated in a changed state, so it has the meaning of "dynamic, this method is called dynamic planning to solve the problem of multi-stage decision optimization. Demo: Ask the coin question. If we have several coins with a nominal value of 1 yuan, 3 yuan, and 5 yuan, how can we use the minimum coin to make up for 11 yuan? (On the surface of this problem can use greedy algorithm, but greedy algorithm can not be guaranteed to find the solution, such as 1 yuan to 2 yuan) http://hawstein.com/posts/dp-novice-to-advanced.html

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.