1 / 35

# 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 :

## Knapsack Model

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? IE312

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

3. Formulation • Decision variables • ILP IE312

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 IE312

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

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

7. Solve Relaxed Problem Relaxed Problem Solution: Objective  24.8 IE312

8. Now the other node… Relaxed Problem Solution: Objective  27.8 IE312

9. Next Step? Objective  24.8 Objective  27.8 IE312

10. Rule of Thumb: Better Value Relaxed Problem Obj  24.8 Solution: Obj.  26.4 Obj.  27.8 Relaxed Problem Solution: IE312

11. Next Level Candidate Problem Obj  24.8 Solution: Obj.  26.4 (This turns out to be true.) Obj. = 25 Infeasible Now What? IE312

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

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) IE312

14. Formulation • Decision variables • Budget constraints IE312

15. Formulation • Mutually exclusive choices • Dependencies IE312

16. Select Locations IE312

17. Ways of Splitting the Set • Set covering constraints • Set packing constraints • Set partitioning constraints IE312

18. Example: Choosing OR Software Formulate a set covering problem to acquire the minimum cost software with LP, IP, and NLP capabilities. Formulate set partitioning and set packing problems. What goals do they meet? IE312

19. Maximum Coverage • Perhaps the budget only allows \$9000 • What can we then do  Maximum coverage • How do we now formulate the problem? • Need new variables IE312

20. 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 IE312

21. TSP Solution Fort Dodge Waterloo Boone Ames Carroll Marshalltown West Des Moines IE312

22. Not a TSP Solution Fort Dodge Waterloo Boone Ames Carroll Marshalltown West Des Moines IE312

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

24. Formulating TSP • A TSP is symmetric if you can go both ways on every arc IE312

25. 10 1 2 1 1 1 10 1 3 4 1 1 10 5 6 Example Formulate a TSP IE312

26. 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 IE312

27. 10 1 2 1 1 1 10 1 3 4 1 1 10 5 6 How do we eliminate subtours? IE312

28. Asymmetric TSP • Now we have decision variables • Constraints IE312

29. 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 IE312

30. 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? IE312

31. 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 IE312

32. 10 1 2 1 1 1 10 1 3 4 1 1 10 5 6 Example: reformulate IE312

More Related