1 / 58

Knapsack Model

Knapsack Model. Intuitive idea: what is the most valuable collection of items that can be fit into a backpack?. Race Car Features. Budget of $35,000 Which features should be added?. Formulation. Decision variables ILP. LIN G O Formulation. MODEL : SETS :

addo
Télécharger la présentation

Knapsack Model

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. Knapsack Model • Intuitive idea: what is the most valuable collection of items that can be fit into a backpack? IE 312

  2. Race Car Features Budget of $35,000 Which features should be added? IE 312

  3. Formulation • Decision variables • ILP IE 312

  4. LINGO Formulation MODEL: SETS: FEATURES /F1,F2,F3,F4,F5,F6/: INCLUDE,SPEED_INC,COST; ENDSETS DATA: SPEED_INC = 8 3 15 7 10 12; COST = 10.2 6.0 23.0 11.1 9.8 31.6; BUDGET = 35; ENDDATA MAX = @SUM( FEATURES: SPEED_INC * INCLUDE); @SUM( FEATURES: COST * INCLUDE) <= BUDGET; @FOR( FEATURES: @BIN( INCLUDE)); END Variables indexed by this set Specify index sets Note ; to end command : to begin an environment All the constants Objective Constraints Decision variables are binary IE 312

  5. Solve using Branch & Bound Candidate Problem Relaxed Problem Solution? IE 312

  6. What is the Relative Worth? Want to add this feature second Want to add this feature first IE 312

  7. Solve Relaxed Problem Relaxed Problem Solution: Objective <= 24.8 IE 312

  8. Now the other node… Relaxed Problem Solution: Objective <= 27.8 IE 312

  9. Next Step? Objective <= 24.8 Objective <= 27.8 IE 312

  10. Relaxed Problem Solution: Obj. <=26.4 Obj. <= 27.8 Relaxed Problem Solution: Rule of Thumb: Better Value Obj <= 24.8 IE 312

  11. Next Level Obj <= 24.8 Obj. <=26.4 Obj. = 25 Infeasible Now What? IE 312

  12. Next Steps … Still need to continue branching here. Obj <= 24.8 Obj. <= 26.4 Finally we will have accounted for every solution! Obj. = 25 Infeasible IE 312

  13. Capital Budgeting • Multidimensional knapsack problems are often called capital budgeting problems • Idea: select collection of projects, investments, etc, so that the value is maximized (subject to some resource constraints) IE 312

  14. NASA Capital Budgeting IE 312

  15. Formulation • Decision variables • Budget constraints IE 312

  16. Formulation • Mutually exclusive choices • Dependencies IE 312

  17. Assignment Problems • Assignment problems deal with optimal pairing or matching of objects in two distinct sets • Decision variable • Let A be the set of allowed assignments and cij be the cost of assigning i to j. IE 312

  18. Formulation IE 312

  19. Example • We must determine how jobs should be assigned to machines to minimize setup times, which are given below: IE 312

  20. Hungarian Algorithm • Step 1: (a) Find the minimum element in each row of the cost matrix. Form a new matrix by subtracting this cost from each row. (b) Find the minimum cost in each column of the new matrix, and subtract this from each column. This is the reduced cost matrix. IE 312

  21. Example: Step 1(a) IE 312

  22. Example: Step 1(b) IE 312

  23. Hungarian Algorithm • Step 2: Draw the minimum number of lines that are needed to cover all the zeros in the reduced cost matrix. If m lines are required, then an optimal solution is available among the covered zeros in the matrix. Otherwise, continue to Step 3. IE 312

  24. Example: Step 2 We need 3<4 lines, so continue to Step 3 IE 312

  25. Hungarian Algorithm • Step 3: Find the smallest nonzero element (say, k) in the reduced cost matrix that is uncovered by the lines. Subtract k from each uncovered element, and add k to each element that is covered by two lines. Return to Step 2. IE 312

  26. Example: Step 3 IE 312

  27. Example: Step 2 (again) Need 4 lines, so we have the optimal assignment and we stop IE 312

  28. Example: Final Solution Optimal assignment IE 312

  29. Travelling Salesman Problem (TSP) Fort Dodge Waterloo Boone Ames Carroll Marshalltown What is the shortest route, starting in Ames, that visits each city exactly ones? West Des Moines IE 312

  30. TSP Solution Fort Dodge Waterloo Boone Ames Carroll Marshalltown West Des Moines IE 312

  31. Not a TSP Solution Fort Dodge Waterloo Boone Ames Carroll Marshalltown West Des Moines IE 312

  32. Applications • Routing of vehicles (planes, trucks, etc.) • Routing of postal workers • Drilling holes on printed circuit boards • Routing robots through a warehouse, etc. IE 312

  33. Formulating TSP • A TSP is symmetric if you can go both ways on every arc IE 312

  34. 10 1 2 1 1 1 10 1 3 4 1 1 10 5 6 Example Formulate a TSP IE 312

  35. Subtours • It is not sufficient to have two arcs connected to each node • Why? • Must eliminate all subtours • Every subset of points must be exited IE 312

  36. 10 1 2 1 1 1 10 1 3 4 1 1 10 5 6 How do we eliminate subtours? IE 312

  37. Asymmetric TSP • Now we have decision variables • Constraints IE 312

  38. Asymmetric TSP (cont.) • Each tour must enter and leave every subset of points • Along with all variables being 0 or 1, this is a complete formulation IE 312

  39. 10 1 2 1 1 1 10 1 3 4 1 1 10 5 6 Example Assume a two unit penalty for passing from a high to lower numbered node. This is now an asymmetric TSP. Why? IE 312

  40. Subtour Elimination • Making sure there are no subtours involves a very large number of constraints • Can obtain simpler constraints if we go with a nonlinear objective function IE 312

  41. Quadratic Assignment Formulation IE 312

  42. 10 1 2 1 1 1 10 1 3 4 1 1 10 5 6 Example: reformulate IE 312

  43. Solving TSP • We can use branch-and-bound to get an exact solution to the TSP problem • As always, the key to implementing branch-and-bound is to relax the problem so that we can easily solve the relaxed problem, but we still get good bounds • How can we relax the TSP? IE 312

  44. Reduces to the assignment problem Relaxing the TSP IE 312

  45. Branching Which cities should be selected? What is the most important variable? IE 312

  46. Example: Solution to Assignment Problem Ames CR IC DSM IE 312

  47. Branching Always branch to split up the subtours! Solving the assignment problem will hopefully yield a feasible solution soon. IE 312

  48. Solution to New Assignment Problem (Left Branch) This makes both subtours impossible, so we get Ames CR IC DSM Thus, optimal solution is found by solving a total of three assignment problems! IE 312

  49. Poor Branching Examples IE 312

  50. Set Packing, Covering, and Partitioning IE 312

More Related