Download Presentation
## Knapsack Model

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -

**Knapsack Model**• Intuitive idea: what is the most valuable collection of items that can be fit into a backpack? IE312**Race Car Features**Budget of $35,000 Which features should be added? IE312**Formulation**• Decision variables • ILP IE312**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**Solve using Branch & Bound**Candidate Problem Solution? Relaxed Problem IE312**What is the Relative Worth?**Want to add this feature second Want to add this feature first IE312**Solve Relaxed Problem**Relaxed Problem Solution: Objective 24.8 IE312**Now the other node…**Relaxed Problem Solution: Objective 27.8 IE312**Next Step?**Objective 24.8 Objective 27.8 IE312**Rule of Thumb: Better Value**Relaxed Problem Obj 24.8 Solution: Obj. 26.4 Obj. 27.8 Relaxed Problem Solution: IE312**Next Level**Candidate Problem Obj 24.8 Solution: Obj. 26.4 (This turns out to be true.) Obj. = 25 Infeasible Now What? IE312**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**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**NASA Capital Budgeting**IE312**Formulation**• Decision variables • Budget constraints IE312**Formulation**• Mutually exclusive choices • Dependencies IE312**Select Locations**IE312**Ways of Splitting the Set**• Set covering constraints • Set packing constraints • Set partitioning constraints IE312**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**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**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**TSP Solution**Fort Dodge Waterloo Boone Ames Carroll Marshalltown West Des Moines IE312**Not a TSP Solution**Fort Dodge Waterloo Boone Ames Carroll Marshalltown West Des Moines IE312**Applications**• Routing of vehicles (planes, trucks, etc.) • Routing of postal workers • Drilling holes on printed circuit boards • Routing robots through a warehouse, etc. IE312**Formulating TSP**• A TSP is symmetric if you can go both ways on every arc IE312**10**1 2 1 1 1 10 1 3 4 1 1 10 5 6 Example Formulate a TSP IE312**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**10**1 2 1 1 1 10 1 3 4 1 1 10 5 6 How do we eliminate subtours? IE312**Asymmetric TSP**• Now we have decision variables • Constraints IE312**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**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**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**10**1 2 1 1 1 10 1 3 4 1 1 10 5 6 Example: reformulate IE312