10 - Knapsack

10 - Knapsack - Part III: Dynamic Programming Lecture 10:...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
Part III: Dynamic Programming Lecture 10: The 0-1 Knapsack Problem Lecture 10: The 0-1 Knapsack Problem Part III: Dynamic Programming
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Introduction to Part III What is dynamic programming? A technique for solving optimization problems. What are optimization problems? Problems with many possible solutions. Each solution has a value. Objective: Find a solution with the optimal value . Lecture 10: The 0-1 Knapsack Problem Part III: Dynamic Programming
Background image of page 2
Introduction to Part III How to develop a dynamic programming? Four steps 1 Structure : Analyze structure of an optimal solution, and thereby choose a space of subproblems. 2 Recursion : Establish relationship between the optimal value the problem and those of some subproblems 3 Bottom-up computation : Compute the optimal values of the smallest subproblems first, save them in the table, Then compute optimal values of larger subproblems, and so on, until the optimal value of the original problem is computed. 4 Construction of optimal solution : Assemble optimal solution by tracing the computation at the previous step. Notes: Steps 1 and 2 are related. Step 4 is not always necessary: we sometimes need only the optimal value. Lecture 10: The 0-1 Knapsack Problem Part III: Dynamic Programming
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Introduction to Part III Dynamic programming (DP) vs Divide-and-Conquer (DC) Commonalities: 1 Partition the problem into particular subproblems. 2 Solve the subproblems. 3 Combine the solutions to solve the original one. Differences: DC: Efficient when the subproblems are independent. Not efficient when subproblems share subsubproblems. Some subproblems might be solved many times. DP: Suitable when subproblems share subsubproblems. Some each subproblem only once. The result is stored in a table in case it is needed elsewhere. DP trades space for time . Lecture 10: The 0-1 Knapsack Problem Part III: Dynamic Programming
Background image of page 4
Introduction to Part III We will study three examples of Dynamic programming: The 0-1 Knapsack Problem Chain Matrix Multiplication All Pairs Shortest Path Lecture 10: The 0-1 Knapsack Problem Part III: Dynamic Programming
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Outline of Lecture 10 The 0-1 Knapsack Problem. Developing a DP algorithm.
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/18/2009 for the course COMP 271 taught by Professor Arya during the Spring '07 term at HKUST.

Page1 / 24

10 - Knapsack - Part III: Dynamic Programming Lecture 10:...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online