The basic steps of dynamic programming algorithm

Source: Internet
Author: User

The basic steps of the dynamic programming algorithm (see Computer algorithm design and analysis P44)
    1. The properties of the optimal solution are analyzed and its structural characteristics are characterized.
    2. Defines the optimal value recursively.
    3. The optimal value is calculated in the bottom-up or top-down memory Method (Memo method).
    4. Based on the information obtained when calculating the optimal value, an optimal solution is constructed.

Step (1)-(3) is the basic step of dynamic programming algorithm. In the case where only the optimal value is required, step (4) can be omitted, and if an optimal solution to the problem is required, step (4) must be performed. At this point, when calculating the optimal value in step (3), it is usually necessary to record more information in order to quickly construct an optimal solution in step (4) According to the information recorded.




in the actual problem can also be done.
    1. The dividing stage: according to the question Time or the space characteristic, divides the question into several stages. Note that these stages must be ordered or sortable (i.e., no direction), otherwise the problem cannot be solved by dynamic programming.
    2. Select state: The various objective situations in which the problem is developed into various stages are expressed in different states. Of course, the choice of state to meet no-no validity.
    3. Determine the decision and write out the state transition equation: The two steps are put together because the decision-making and state transfer have a natural connection, state transfer is based on the previous stage of the state and decision-making to export the state of this phase. So, if we determine the decision, the state transfer equation is written out. But in fact, we often do this in turn, depending on the relationship between the States of the two adjacent paragraphs to determine the decision.
    4. Write the programming equation (including boundary conditions): The basic equation of dynamic programming is the general formal expression of the programming equation. Generally speaking, this step is relatively simple as long as the phases, States, decisions and state transitions are determined.

The basic steps of 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.