2. Dynamic Programming (DP)
• It is a method for solving complex problems
by breaking them down into simpler sub
• It is applicable to problems exhibiting the
properties of overlapping subproblems
which are only slightly smallerand
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
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.
Typical steps of DP
• Characterize the structure of an optimal
• Recursively define the value of an optimal
• Compute the value of an optimal solution in
a bottom-up fashion.
• Compute an optimal solution from
6. Steps of Dynamic Programming (DP)
1)Dynamic programming design involves 4
– 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
7. Steps of Dynamic Programming
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
• Steps 1 and 2 need not be in that order.
Do what makes sense in each problem.
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
• Without the Principle of Optimality, it
won't be possible to derive a sensible
recurrence relation in step 3.
9. • When the Principle of Optimality holds,
the 4 steps of DP are guaranteed to yield
an optimal solution. No proof of
optimality is needed.
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 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
• The technique is useful to determine the
12. Uses of dynamic programming
• It is used to determine optimal combination
of advertising media like TV,Radio,News
• It can be used in replacement theory.