Download presentation

Presentation is loading. Please wait.

Published byKaylynn Harryman Modified over 2 years ago

1
IEOR 4004 Final Review part II. April 30, 2014

2
Integer Programming Standard problems – Knapsack – Fixed-charge Problem (Facility location) – Cutting Stock Problem – Set cover – Travelling Salesman Problem – Job/Machine Scheduling Problems max cx Ax = b x ≥ 0 x integer pure IP = all variables integer mixed IP = some variables integer

3
IP formulations fixed charge (penalty) for a failing a constraint alternative constraints (logical or) if-then constraints piece-wise linear objective f ≤ 0 f ≤ My add +py to the objective y ∈ {0,1} constraint penalty for failing the constraint constraint f ≤ 0 g ≤ M(1-y) y ∈ {0,1} g ≤ 0 f ≤ My if f > 0, g ≤ M(1-y) y ∈ {0,1} then g ≤ 0 f ≤ My

4
Branch-and-Bound solve the LP relaxation optimal solution to the LP relaxation gives an upper bound branch on fractional variables (if exist) how do we (re)-solve the subproblems quickly ? – Upper-bounded Dual Simplex – special subproblem (Knapsack, Transportation Problem) fractional solution = solution to the LP relaxation max 12x 1 + 4x 2 + 5x 3 s.t.5x 1 + 2x 2 + 3x 3 ≤ 13 x 1,x 2,x 3 ≥ 0 and integer max 12x 1 + 4x 2 + 5x 3 s.t.5x 1 + 2x 2 + 3x 3 ≤ 13 x 1,x 2,x 3 ≥ 0 Integer Program Linear Programming (LP) relaxation drop the integrality

5
Upper-bounded Dual Simplex given a dually feasible basic solution (all coeffs in z negative) check if all basic variables satisfy their upper bounds if some x i fails, if x i should be ≤ B but is > B, then substitute x i = B – x i ’ check if all basic variables satisfy their lower bounds if some x i < 0, then use dual ratio test to find x j such that the ratio b/a is smallest possible where: – a is the coefficient of x j in the equation for x i – (-b) is the coefficient of x j in the equation for z – a is positive pivot x i out and x j into the basis Dually feasible solution Optimal ? 1. check upper bounds 2. check lower bounds 1. substitute x i = B – x i ’ where 0 ≤ x i ≤ B 2. pivot (dual ratio test) x i out, x j in the basis x 1 = x 2 – 4x 3 + 3x 4 x 5 = 1 + x 2 + 2x 3 – 2x 4 z = 5 – 3x 2 – 5x 3 – 4x 4 x 1 leaves, ratio test: x 2 : 3 / 2 = 1.5 x 4 : 4 / 3 = x 4 enters

6
Branching tree candidate solution x 1 = 1 x 2 = 2.4 z = 18 x 1 = 1.25 x 2 = 2 z = 17.5 x 1 = 1 x 2 = 2 z = 16 x 1 = 2 x 2 = 0.8 z = 16 x 1 = 0.25 x 2 = 3 z = 16.5 x 1 = 0 x 2 = 3.2 z = 16 infeasible don’t need to branch (no solution here is better than z=16 and we already know a candidate solution of value 16) max 6x 1 + 5x 2 s.t. 4x 1 + 5x 2 ≤ 16 8x 1 + 5x 2 ≤ 20 x 1,x 2 ≥ 0 & integer x 2 ≤ 2 x 2 ≥ 3 LP relaxation optimal fractional solution not an integer solution branch x 2 ≤ 2.4 = 2 x 2 ≥ 2.4 = 3 x 1 ≤ 1 x 1 ≥ 2 x 1 ≤ 0 x 1 ≥ 1 optimal solution

7
Example max 12x 1 + 4x 2 + 5x 3 s.t.5x 1 + 2x 2 + 3x 3 ≤ 13 x 1,x 2,x 3 ≥ 0 max 12x 1 + 4x 2 + 5x 3 s.t.5x 1 + 2x 2 + 3x 3 + x 4 = 13 x 1,x 2,x 3,x 4 ≥ 0 x 1 = 2.6 – 0.4x 2 – 0.6x 3 – 0.2x 4 z = 31.2 – 0.8x 2 – 2.2x 3 – 2.4x 4 Initial solution x 1 ≤ 2 x 1 ≥ 3 infeasible x 1 = 2.6 x 2 = 0 x 3 = 0 z = 31.2 x 1 ≥ 3substitute x 1 = 3 + x 5 x 5 = -0.4 – 0.4x 2 – 0.6x 3 – 0.2x 4 z = 31.2 – 0.8x 2 – 2.2x 3 – 2.4x 4 dictionary is not feasible anymoreSubproblem: x 1 ≥ 3 Upper-bounded Dual Simplex method How to quickly recover an optimum (without starting over) ? check upper bounds: OK check lower bounds: -0.4 = x 5 ≥ 0 x 5 leaves, ratio test: x 2 : no constraint x 3 : no constraint x 4 : no constraint infeasible LP x 1 ≤ 2substitute x 1 = 2 – x 1 ’ x 1 ’ = x x x 4 z = 31.2 – 0.8x 2 – 2.2x 3 – 2.4x 4 check upper bounds: OK check lower bounds: -0.6 = x 1 ’ ≥ 0 x 1 ’ leaves, ratio test: x 2 : 0.8/0.4 = 2 x 3 : 2.2/0.6 = 3⅔ x 4 : 2.4/0.2 = 12 x 2 enters x 2 = x 1 ’ – 1.5x 3 – 0.5x 4 z = 30 – 2x 1 ’ – x 3 – 2x 4 optimal solution recovered x 1 ’ = 0 x 1 = 2–x 1 ’ = 2 x 2 = 1.5 x 3 = 0z = 30 x 2 ≤ 1 x 2 ≥ 2 x 1 = 2 x 2 = 1.5 x 3 = 0 z = 30 not an integer solution branch on x 2 ≤ 1 and x 2 ≥ 2 x 1 = 2 x 2 = 1 x 3 = 1/3 z = 29⅔ x 1 = 2 x 2 = 1 x 3 = 0 z = 28 x 1 = 2 x 2 = 0 x 3 = 1 z = 29 x 1 = 1 x 2 = 4 x 3 = 0 z = 28 infeasible x 3 ≥ 1 x 1 = 2x 1 ≤ 1 x 1 = 1.8 x 2 = 2 x 3 = 0 z = 29.6 candidate solution optimal Repeat x 3 = 0

8
Knapsack max 12x 1 + 4x 2 + 5x 3 s.t.5x 1 + 2x 2 + 3x 3 ≤ 13 x 1,x 2,x 3 ≥ 0 and integer x 1 = 2 x 2 = 1 x 3 = 1/3 z = 29⅔ x 1 = 2 x 2 = 1 x 3 = 0 z = 28 x 1 = 2 x 2 = 0 x 3 = 1 z = 29 x 1 = 1 x 2 = 4 x 3 = 0 z = 28 infeasible x 1 ≤ 2 x 1 ≥ 3 x 2 ≤ 1 x 2 ≥ 2 x 3 = 0 x 3 ≥ 1 x 1 = 2x 1 ≤ 1 x 1 = 2.6 x 2 = 0 x 3 = 0 z = 31.2 x 1 = 2 x 2 = 1.5 x 3 = 0 z = 30 x 1 = 1.8 x 2 = 2 x 3 = 0 z = 29.6 infeasible optimal greedy strategy (for LP relaxation) pick items by value/weight, highest first take as many items of the same type as possible Initial solution candidate solution value/ weight 2.421⅔ max 12x 4 + 4x 2 + 5x s.t.5x 4 + 2x 2 + 3x 3 ≤ -2 x 1 ≥ 3substitute x 1 = 3 + x 4 x 1 ≤ 2pick 2 units of item #1 and then 1.5 of item #2 (as much as possible) max 12x 1 + 4x 5 + 5x s.t.5x 1 + 2x 5 + 3x 3 ≤ 9 x 2 ≥ 2substitute x 2 = 2 + x 5 x 1 ≤ 1pick 1 units of item #1 then 2 of item #5 (i.e. 4 units of item #2) candidate solution pick 1.8 units of item #1 max 4x 5 + 5x s.t.2x 5 + 3x 3 ≤ -1 x 1 = 2substitute x 1 = 2 x 2 ≤ 1 pick 2 units of item #1 then 1 unit of item #2 and then 1/3 of item #3 x 3 = 0do not pick item #3 (1 unit unused in the bag) max 12x 1 + 4x 2 + 5x s.t.5x 1 + 2x 2 + 3x 7 ≤ 10 x 3 ≥ 1substitute x 3 = 1 + x 7 pick 2 units of item #1 optimal

9
Cutting Planes only for pure IPs solve LP relaxation if not an integer optimum, make the feasible region smaller by cutting out fractional points (without removing any integer points) how to generate cuts ? max 6x 1 + 5x 2 s.t. 4x 1 + 5x 2 ≤ 16 8x 1 + 5x 2 ≤ 20 x 1,x 2 ≥ 0 & integer optimal fractional solution new fractional optimum Gomory cuts x 1 + x 2 ≤ 3 x 1,x 2 ≥ 0 & integer

10
Gomory cuts max 6x 1 + 5x 2 s.t. 4x 1 + 5x 2 ≤ 16 8x 1 + 5x 2 ≤ 20 x 1 + x 2 ≤ 3 x 1,x 2 ≥ 0 & integer optimal fractional solution max 6x 1 + 5x 2 s.t. 4x 1 + 5x 2 + x 3 = 16 8x 1 + 5x 2 + x4= 20 x 1 + x 2 +x 5 = 3 x 1,x 2,x 3,x 4,x 5 ≥ 0 & integer x 1 = 1⅔ – ⅓x 4 + 1⅔x 5 x 2 = 1⅓ + ⅓x 4 – 2⅔x 5 x 3 = 2⅔ – ⅓x 4 + 6⅔x 5 z = 16⅔ – ⅓x 4 – 3⅓x 5 x 1 = 1⅔ – ⅓x 4 + 1⅔x 5 x 1 – 2x 5 – 1 = ⅔ – ⅓x 4 – ⅓x 5 1+⅔ 0+⅓ 2–⅓ split to whole and fractional part fractional partwhole part positive constant negative coeffients < 1 ≤ 0 cut Use Dual Simplex to recover the optimum optimal solution x 1 = 1 – x 6 + 2x 5 x 2 = 2 + x 6 – 3x 5 x 3 = 2 – x 6 + 7x 5 x 4 = 2 + 3x 6 – x 5 z = 16 – x 6 – 3x 5 x 6 = – ⅔ + ⅓x 4 + ⅓x 5 z = 16⅔ – ⅓x 4 – 3⅓x 5

11
Dynamic Programming Break down the problem into stages – each stage has possible states – next stage depends only on the previous stage – identify possible decisions/transitions at each stage – find a formula to evaluate (by recursion) Evaluate stage by stage stage 1stage 2stage 3 f i ( j ) = optimum value for the first i stages that ends in state j of stage i e.g. cost of cheapest production plan for first i months where we end up with j items in inventory at the end of month i (inventory in month i+1 only depends on production and inventory level in month i) time (months, years) budget (available resources) Goal: – value of the formula for a target state (in the last stage) – save on calculation by storing the intermediate results f i (j) optimal substructure property

12
Dynamic Programming Investments: #1. x 1 > 0 thousand $ yields c 1 (x 1 )=7x 1 +2 thousand $ #2. x 2 > 0 thousand $ yields c 2 (x 2 )=3x 2 +7 thousand $ #3. x 3 > 0 thousand $ yields c 3 (x 3 )=4x 3 +5 thousand $ c 1 (0)=c 2 (0)=c 3 (0)=0 We can invest up to $6,000. decision in stage i = how much we invest into #i f i ( j ) = maximum profit we can get by investing j thousand dollars into first i investments (all we need to know is how much money we have available for investing) f i ( j ) = k ∈ {0,1,...,j} how much we invest in #i leftover cash best possible profit with the leftover cash profit from #i f 0 ( j ) = #1#2#3 cash start0 # # #349 max { } ci(k)ci(k) + f i-1 ( ) j – k green arrow = best choice of k

13
Traveling Salesman Problem Find a shortest route that goes through all cities and comes back where it starts Map of citiesShortest route

14
Traveling Salesman Problem a shortest route starting at s ending at v and visiting all nodes in S v f(S,v) = length of f(S,v) = min f(S\{x}, x) + c xv x ∈ S (x,v) ∈ E Work backwards – which is the last vertex visited before v ? x optimal substructure property initial condition: f(Ø,s) = 0 solution:f(V\{s},s) s complexity: O(n 2 2 n ) time and space brute force (trying all routes) is O(n!) time and O(1) space

15
Good luck on the final exam.

Similar presentations

© 2016 SlidePlayer.com Inc.

All rights reserved.

Ads by Google