HW4sol_001 - COT 5405 Analysis of Algorithms Spring 2010...

Info icon This preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
COT 5405 Analysis of Algorithms, Spring 2010. Homework 4 April 16, 2010 Notes No submission is required. 1
Image of page 1

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

View Full Document Right Arrow Icon
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 n-queens 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 n-tuples. Let { a 1 , a 2 , ..., a 4 } , be the n-tuple. Start with { 1 , 2 , ..., 4 } . Vary a i from i till 71. Do this for each a i , from a 4 to a 2 .
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern