This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: COT 5405 Analysis of Algorithms, Spring 2010. Homework 4 April 16, 2010 Notes • No submission is required. 1 1. The assignment problem is usually stated this way: There are n people to be assigned to n jobs. The cost of assigning the ith person to the jth jobs cost ( i,j ). You are to develop a branch and bound algo rithm that assigns every job to a person and at the same time minimizes the total cost of the assignment. Solution: In our recursive (exhaustive) algorithm we pick a person (who wasn’t assigned before) and assign him a job (which wasn’t assigned before). We need to define how the following two steps are done (i) How to select the next node and (ii) how to prune a subtree. Let f ( x ) be the cost for all assignment already done. g ( x ) be the least cost possible for rest of the assignments. We obtain an estimate for this by calculating the least cost job possible for each person. g l ( i ) = min 1 ≤ j ≤ n cost ( i,j ) g ( x ) = X ∀ remaining persons i g l ( i ) We maintain a value lower which is the current best solution. For step (i) we select a node whose g ( x ) value is minimum. For step (ii) we prune the subtree if g ( x ) value is greater than lower . 2. This problem is called the postage stamp problem. Envision a country that issues n different denomi nations of stamps but allows no more than m stamps on a single letter. For given values of m and n, write values, from one on up, and all possible sets of denominations that realize that range. For exam ple , for n = 4 and m = 5, the stamps with values (1 , 4 , 12 , 21) allow the postage values 1 through 71. Are there any other sets of four denominations that have the same range. Use a backtracking algorithm. Solution: This is similar to nqueens problem. First assume that you have a black box which calculates the range when given n, m and set of stamp values. Now iterate over all possible combinations of ntuples. Let { a 1 ,a 2 ,...,a 4 } , be the ntuple. Start with, be the ntuple....
View
Full
Document
This note was uploaded on 01/15/2012 for the course COT 5405 taught by Professor Ungor during the Fall '08 term at University of Florida.
 Fall '08
 UNGOR
 Algorithms

Click to edit the document details