Dynamic
Programming
1
Dynamic Programming (DP)
• It is a method for solving complex problems
by breaking them down into simpler sub
problems.
• It is applicable to problems exhibiting the
properties of overlapping subproblems
which are only slightly smallerand
optimal substructure
2
• When applicable, the method takes far less
time than naive methods.
• In terms of mathematical optimization,
dynamic programming usually refers to
simplifying a decision by breaking it down
into a sequence of decision steps over time
3
4
Application domain of DP
• Optimization problem: find a solution with
optimal (maximum or minimum) value.
• An optimal solution, not the optimal
solution, since may more than one optimal
solution, any one is OK.
5
Typical steps of DP
• Characterize the structure of an optimal
solution.
• Recursively define the value of an optimal
solution.
• Compute the value of an optimal solution in
a bottom-up fashion.
• Compute an optimal solution from
computed/stored information.
Steps of Dynamic Programming (DP)
1)Dynamic programming design involves 4
major steps:
– Develop a mathematical notation that can
express any solution and subsolution for the
problem at hand.
– Prove that the Principle of Optimality holds.
2)Develop a recurrence relation that relates
a solution to its subsolutions, using the
6
Steps of Dynamic Programming
(DP)
math notation of step 1. Indicate what the
initial values are for that recurrenec relation,
and which term signifies the final solution.
3)Write an algorithm to compute the recurrence
relation.
• Steps 1 and 2 need not be in that order.
Do what makes sense in each problem.
7
Dynamic Programming (DP)
• Step 3 is the heart of the design process.
In high level algorithmic design
situations, one can stop at step 3. In this
course, however, we will carry out step 4
as well.
• Without the Principle of Optimality, it
won't be possible to derive a sensible
recurrence relation in step 3.
8
• When the Principle of Optimality holds,
the 4 steps of DP are guaranteed to yield
an optimal solution. No proof of
optimality is needed.
9
10
Elements of DP
• Optimal (sub)structure
– An optimal solution to the problem contains within it
optimal solutions to subproblems.
• Overlapping subproblems
– The space of subproblems is “small” in that a recursive
algorithm for the problem solves the same subproblems
over and over. Total number of distinct subproblems is
typically polynomial in input size.
Uses of dynamic programming
• It is used to solve production,scheduling
and employment smoothening problems.
• The technique can be applied for allocating
the scarce resources to different alternative
uses.
• The technique is useful to determine the
inventory level.
11
Uses of dynamic programming
• It is used to determine optimal combination
of advertising media like TV,Radio,News
paper.
• It can be used in replacement theory.
12

Dynamic programming 2

  • 1.
  • 2.
    Dynamic Programming (DP) •It is a method for solving complex problems by breaking them down into simpler sub problems. • It is applicable to problems exhibiting the properties of overlapping subproblems which are only slightly smallerand optimal substructure 2
  • 3.
    • When applicable,the method takes far less time than naive methods. • In terms of mathematical optimization, dynamic programming usually refers to simplifying a decision by breaking it down into a sequence of decision steps over time 3
  • 4.
    4 Application domain ofDP • Optimization problem: find a solution with optimal (maximum or minimum) value. • An optimal solution, not the optimal solution, since may more than one optimal solution, any one is OK.
  • 5.
    5 Typical steps ofDP • Characterize the structure of an optimal solution. • Recursively define the value of an optimal solution. • Compute the value of an optimal solution in a bottom-up fashion. • Compute an optimal solution from computed/stored information.
  • 6.
    Steps of DynamicProgramming (DP) 1)Dynamic programming design involves 4 major steps: – Develop a mathematical notation that can express any solution and subsolution for the problem at hand. – Prove that the Principle of Optimality holds. 2)Develop a recurrence relation that relates a solution to its subsolutions, using the 6
  • 7.
    Steps of DynamicProgramming (DP) math notation of step 1. Indicate what the initial values are for that recurrenec relation, and which term signifies the final solution. 3)Write an algorithm to compute the recurrence relation. • Steps 1 and 2 need not be in that order. Do what makes sense in each problem. 7
  • 8.
    Dynamic Programming (DP) •Step 3 is the heart of the design process. In high level algorithmic design situations, one can stop at step 3. In this course, however, we will carry out step 4 as well. • Without the Principle of Optimality, it won't be possible to derive a sensible recurrence relation in step 3. 8
  • 9.
    • When thePrinciple of Optimality holds, the 4 steps of DP are guaranteed to yield an optimal solution. No proof of optimality is needed. 9
  • 10.
    10 Elements of DP •Optimal (sub)structure – An optimal solution to the problem contains within it optimal solutions to subproblems. • Overlapping subproblems – The space of subproblems is “small” in that a recursive algorithm for the problem solves the same subproblems over and over. Total number of distinct subproblems is typically polynomial in input size.
  • 11.
    Uses of dynamicprogramming • It is used to solve production,scheduling and employment smoothening problems. • The technique can be applied for allocating the scarce resources to different alternative uses. • The technique is useful to determine the inventory level. 11
  • 12.
    Uses of dynamicprogramming • It is used to determine optimal combination of advertising media like TV,Radio,News paper. • It can be used in replacement theory. 12