The basic dynamic programming model

One: the optimization problem of multi-stage decision-making process

Two: basic concepts and models of dynamic programming constitution

  1. phase and phase variables

  2. The state and state variables

  3. decision-making, decision variables, the decision to allow collection

  4. Policy and optimal strategy ( thinking Core )

  The state transition equation ( Code Core )

Three: the optimization principle and the principle of no aftereffect

  1. The principle of optimization: optimal solution just depends on local optimization, little to do with non-optimal solution

  2. No after-effect principle: what happened afterwards and I'm going to do does not matter

Four: application of the basic dynamic programming model

  1. The number of tower problems

    (1) Topic

    (2) Ideas

      a burst search: the first beginning the search, it has been found deep to the bottom of the column number, the last return value to the top

      b Memory search: record through each point, and then return the value of a record is stored in an array, the array record the next encounter, as long as the recording, direct return

      c.Dp (Forwards): state transition equation: f [i] [j] = max (f [i-1] [j], f [i-1] [j-1]) + a [i] [ j];

         DP (Backward): state transition equation: f [i] [j] = max (f [i + 1] [j], f [i + 1] [j + 1]) + a [i] [j] ;

    (3) Pseudo Code

      a. explosive search

      b. Memory search

      C. Dp (Forwards)

       Dp (Backward)

      

  2. The longest sequence does not fall

    (1) Topic

    (2) Ideas

      Simple arithmetic n ^ n

      Monotonic optimization nlogn ( Dalao detailed links

        a. Note how the output path, an array c (open capacity requires additional N), the c [i] is positioned at this time queue position, when the output from the last scan start, if c [i] = len output, len - up to len is 0, this time to ensure that the updated position does not fall to the longest stretch of sequence of the tail is not missing, but the subsequent updated location (note that the queue is not a standard length, but there expansion) direct kick, for example, data 7,916,384,910 according strategy should be 79,163,849, but the update is finished array f 79,103,849 series output can not be directly required by tag array, this will automatically filter back, a little good Ha, refer to this dalao

    (3) Optimization: Optimization nlogn above monotonicity

    (4) Pseudo Code

       Simple arithmetic n ^ n

      Monotonic optimization nlogn

  3.

 

To be continued ~ ~ ~

Guess you like

Origin www.cnblogs.com/SeanOcean/p/10990503.html