Presentation is loading. Please wait.

Presentation is loading. Please wait.

Notes 5IE 3121 Knapsack Model Intuitive idea: what is the most valuable collection of items that can be fit into a backpack?

Similar presentations


Presentation on theme: "Notes 5IE 3121 Knapsack Model Intuitive idea: what is the most valuable collection of items that can be fit into a backpack?"— Presentation transcript:

1 Notes 5IE 3121 Knapsack Model Intuitive idea: what is the most valuable collection of items that can be fit into a backpack?

2 Notes 5IE 3122 Race Car Features Budget of $35,000 Which features should be added?

3 Notes 5IE 3123 Decision variables ILP Formulation

4 Notes 5IE 3124 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 Specify index sets All the constants Objective Constraints Variables indexed by this set Decision variables are binary Note ; to end command : to begin an environment

5 Notes 5IE 3125 Solve using Branch & Bound Solution? Candidate Problem Relaxed Problem

6 Notes 5IE 3126 What is the Relative Worth? Want to add this feature first Want to add this feature second

7 Notes 5IE 3127 Solve Relaxed Problem Solution: Relaxed Problem Objective <= 24.8

8 Notes 5IE 3128 Now the other node … Relaxed Problem Solution: Objective <= 27.8

9 Notes 5IE 3129 Next Step? Objective <= 24.8 Objective <= 27.8

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

11 Notes 5IE 31211 Next Level Obj <= 24.8 Obj. <=26.4 InfeasibleObj. = 25 Now What?

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

13 Notes 5IE 31213 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)

14 Notes 5IE 31214 NASA Capital Budgeting

15 Notes 5IE 31215 Formulation Decision variables Budget constraints

16 Notes 5IE 31216 Formulation Mutually exclusive choices Dependencies

17 Notes 5IE 31217 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 c ij be the cost of assigning i to j.

18 Notes 5IE 31218 Formulation

19 Notes 5IE 31219 Example We must determine how jobs should be assigned to machines to minimize setup times, which are given below: Job 1Job 2Job 3Job 4 Machine 114587 Machine 221265 Machine 37839 Machine 424610

20 Notes 5IE 31220 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.

21 Notes 5IE 31221 Example: Step 1(a) Job 1Job 2Job 3Job 4 Machine 114587 Machine 221265 Machine 37839 Machine 424610 Job 1Job 2Job 3Job 4 Machine 19032 Machine 201043 Machine 34506 Machine 40248

22 Notes 5IE 31222 Example: Step 1(b) Job 1Job 2Job 3Job 4 Machine 19030 Machine 201041 Machine 34504 Machine 40246 Job 1Job 2Job 3Job 4 Machine 19032 Machine 201043 Machine 34506 Machine 40248

23 Notes 5IE 31223 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.

24 Notes 5IE 31224 Example: Step 2 Job 1Job 2Job 3Job 4 Machine 19030 Machine 201041 Machine 34504 Machine 40246 We need 3<4 lines, so continue to Step 3

25 Notes 5IE 31225 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.

26 Notes 5IE 31226 Example: Step 3 Job 1Job 2Job 3Job 4 Machine 19030 Machine 201041 Machine 34504 Machine 40246 Job 1Job 2Job 3Job 4 Machine 110030 Machine 20930 Machine 35504 Machine 40135

27 Notes 5IE 31227 Example: Step 2 (again) Job 1Job 2Job 3Job 4 Machine 110030 Machine 20930 Machine 35504 Machine 40135 Need 4 lines, so we have the optimal assignment and we stop

28 Notes 5IE 31228 Example: Final Solution Job 1Job 2Job 3Job 4 Machine 110030 Machine 20930 Machine 35504 Machine 40135 Optimal assignment

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

30 Notes 5IE 31230 TSP Solution Ames Fort Dodge Boone Carroll Marshalltown West Des Moines Waterloo

31 Notes 5IE 31231 Not a TSP Solution Ames Fort Dodge Boone Carroll Marshalltown West Des Moines Waterloo

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

33 Notes 5IE 31233 Formulating TSP A TSP is symmetric if you can go both ways on every arc

34 Notes 5IE 31234 Example 1 5 2 6 34 10 1 1 1 1 1 1 Formulate a TSP

35 Notes 5IE 31235 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

36 Notes 5IE 31236 How do we eliminate subtours? 1 5 2 6 34 10 1 1 1 1 1 1

37 Notes 5IE 31237 Asymmetric TSP Now we have decision variables Constraints

38 Notes 5IE 31238 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

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

40 Notes 5IE 31240 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

41 Notes 5IE 31241 Quadratic Assignment Formulation

42 Notes 5IE 31242 Example: reformulate 1 5 2 6 34 10 1 1 1 1 1 1

43 Notes 5IE 31243 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?

44 Notes 5IE 31244 Relaxing the TSP Reduces to the assignment problem

45 Notes 5IE 31245 Branching Which cities should be selected? What is the most important variable?

46 Notes 5IE 31246 Example: Solution to Assignment Problem Ames DSM CR IC

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

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

49 Notes 5IE 31249 Poor Branching Examples

50 Notes 5IE 31250 Set Packing, Covering, and Partitioning

51 Notes 5IE 31251 Select Locations

52 Notes 5IE 31252 Ways of Splitting the Set Set covering constraints Set packing constraints Set partitioning constraints

53 Notes 5IE 31253 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?

54 Notes 5IE 31254 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

55 Notes 5IE 31255 Useful Formulation Tricks! Integer variables can be used to model numerous things that seem difficult Fixed-charge IP Either-or constraints If-then constraints All of these involve introducing a (dummy) binary variable and a “ very large number ”

56 Notes 5IE 31256 Fixed-Charge Constraint We need to determine how many Gadgets to make We have variable cost of $7/ Gadget made, but also a fixed cost of $500 if we make any Gadgets (but we could also choose not to make any, in which case we would have no cost How do we represent the cost? Here, M is a very large number, e.g. M = 1000

57 Notes 5IE 31257 What-If Constraints Need to model (continuous variable): Trick: add a binary variable y, and a very large M Here, M = 200 would do nicely

58 Notes 5IE 31258 If-Then Constraints We want to represent Similar to before: Here, M =3 would be big enough!


Download ppt "Notes 5IE 3121 Knapsack Model Intuitive idea: what is the most valuable collection of items that can be fit into a backpack?"

Similar presentations


Ads by Google