Transcription of Lecture 13: The Knapsack Problem - Electronic Systems
{{id}} {{{paragraph}}}
Lecture13:TheKnapsack ProblemOutlineofthisLecture Introductionof the0-1 Knapsack Problem . A dynamicprogrammingsolutionto ProblemInformalDescription:We have computed datafilesthatwe wantto store, andwe have available bytesof hassize bytesandtakes wanttoavoidasmuchrecomputingaspossible,s owe wantto finda subsetof filesto storesuchthat Thefileshave combinedsize at most . cannotstorepartsoffiles, it is shouldwe selectthefiles?20-1 Knapsack ProblemFormaldescription:Giventwo -tuplesofpositivenumbers and and , we wishto determinethesubset !#" %$& ' ( *)(offilesto store)thatmaximizes ,+ - . subjectto ,+ - 0/ Remark:Thisis :Try all$ possible subsets .Question:Any solutionbetterthanthebrute-force? solve :If thesubproblemsarenotindependent, , thena , it doesmorework thannecessary!Question:Any bettersolution?Yes Dynamicprogramming(DP)!4 TheIdeaofDynamicProgrammingDynamicprogra mmingis a :Computethesolutionsto thesubsub-problemsonceandstorethesolutio nsina table, sothattheycanbereused(repeatedly) :We DPAlgorithmStep1:Structure:Characterize thestructureofanoptimalsolution.
Recall of the Divide-and-Conquer 1. Partition the problem into subproblems. 2. Solve the subproblems. 3. Combine the solutions to solve the original one.
Domain:
Source:
Link to this page:
Please notify us if you found a problem with this document:
{{id}} {{{paragraph}}}