1 / 4

ECE 665 Spring 2005 Computer Algorithms

ECE 665 Spring 2005 Computer Algorithms. Dynamic Programming Knapsack revisited. Recurrence equation. Problem statement: max  i pi , s.to:  i w i  M = knapsack volume p i = benefit of item i w i = weight of item i Optimum solution at decision variable x n

richb
Download Presentation

ECE 665 Spring 2005 Computer Algorithms

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ECE 665Spring 2005Computer Algorithms Dynamic Programming Knapsack revisited

  2. Recurrence equation • Problem statement: max i pi, s.to: i wi  M = knapsack volume pi = benefit of item i wi = weight of item i • Optimum solution at decision variable xn Fn(M) = max{fn-1(M), fn-1(M-wn)+pn)

  3. Recurrence equation • For arbitrary fi(X): fi(X) = max{ fi-1(X), fi-1(X-wi)+pi } If item i is not added. If item i is added (with benefit cost pi, contributing weight wi) • We can represent solution space conveniently in terms of pairs (wi, pi)

  4. (P,W) =(ipi, iwi) (0,0) X1=1 X3=0 X1=0 X2=0 X2=0 X2=1 X2=1 (0,0) (0,0) (1,2) (0,0) (2,3) (3,5) (1,2) X3=0 X3=1 X3=0 X3=1 X3=1 X3=1 X3=0 (5,4) (2,3) (7,7) (1,2) (6,6) (3,5) (8,9) Knapsack Solution space (pi,wi) M=6 • Purge solution (Pj, Wj)dominated by (Pk, Wk)if Pj Pkand Wj Wk • Delete solutions with W > M (knapsack volume exceeded

More Related