19
Maximize: 5 x 1 + 4 x 2 + 3 x 3 subject to: x 1 , x 2 , x 3 ≥ 0 and 2 x 1 + 3 x 2 + 1 x 3 5 4 x 1 + 1 x 2 + 2 x 3 11 3 x 1 + 4 x 2 + 2 x 3 8 After one pivot: H N T = [4 2 3] X1 = 2.5 -1.5 X2 -0.5 X3 -0.5 X4 X5 = 1.0 +5.0 X2 +0.0 X3 +2.0 X4 X6 = 0.5 +0.5 X2 -0.5 X3 +1.5 X4 1. What are H B T , C B T , C H T , A B , A H , x B and x H for this dictionary? 2. Solve for z: (a) Solve A B T y = c B for y. (b) z= y T b + [c T - y T A ] x 1

Maximize: 5 x 1 + 4 x 2 + 3 x 3 subject to: x 1, x 2, x 3 ≥ 0 and 2 x 1 + 3 x 2 + 1 x 3 ≤ 5 4 x 1 + 1 x 2 + 2 x 3 ≤ 11 3 x 1 + 4 x 2 + 2 x 3 ≤ 8 After

Embed Size (px)

Citation preview

Page 1: Maximize: 5 x 1 + 4 x 2 + 3 x 3 subject to: x 1, x 2, x 3 ≥ 0 and 2 x 1 + 3 x 2 + 1 x 3 ≤ 5 4 x 1 + 1 x 2 + 2 x 3 ≤ 11 3 x 1 + 4 x 2 + 2 x 3 ≤ 8 After

Maximize: 5 x1 + 4 x2 + 3 x3

subject to: x1 , x2 , x3 ≥ 0 and2 x1 + 3 x2 + 1 x3 ≤ 54 x1 + 1 x2 + 2 x3 ≤ 113 x1 + 4 x2 + 2 x3 ≤ 8After one pivot: HN

T= [4 2 3]X1 = 2.5 -1.5 X2 -0.5 X3 -0.5 X4 X5 = 1.0 +5.0 X2 +0.0 X3 +2.0 X4 X6 = 0.5 +0.5 X2 -0.5 X3 +1.5 X4 1. What are HB

T, CBT, CH

T, AB, AH, xB and xH for this dictionary?

2. Solve for z: (a) Solve AB

T y = cB for y. (b) z= yT b + [cN

T - yT AN ] xN

1

Page 2: Maximize: 5 x 1 + 4 x 2 + 3 x 3 subject to: x 1, x 2, x 3 ≥ 0 and 2 x 1 + 3 x 2 + 1 x 3 ≤ 5 4 x 1 + 1 x 2 + 2 x 3 ≤ 11 3 x 1 + 4 x 2 + 2 x 3 ≤ 8 After

2

Announcements:The deadline for grad lecture notes was extended to Friday Nov. 9 at 3:30pm.

Assignment #4 is posted: Due Wed. Nov. 14.

Nov. 12-14 is reading break.I plan on holding a Test #2 tutorial on Wed. Nov. 14 at 3:30pm, room TBA.

Test #2 is on Thursday Nov. 15, in class.Mandatory attendance starts Mon. Nov. 19.

A handout for the integer programming material is coming soon.

Page 3: Maximize: 5 x 1 + 4 x 2 + 3 x 3 subject to: x 1, x 2, x 3 ≥ 0 and 2 x 1 + 3 x 2 + 1 x 3 ≤ 5 4 x 1 + 1 x 2 + 2 x 3 ≤ 11 3 x 1 + 4 x 2 + 2 x 3 ≤ 8 After

HBT =

[1 5 6]AB =[2 0 0][4 1 0][3 0 1] cB = [5 0 0]T

cN= [0 4 3]T

xB= [x1 x5 x6]T

xN= [x4 x2 x3]T

Current solution:xB= [2.5 1 0.5]T

HNT =

[4 2 3]AN =[1 3 1][0 1 2][0 4 2]

Z= 12.5

3

Page 4: Maximize: 5 x 1 + 4 x 2 + 3 x 3 subject to: x 1, x 2, x 3 ≥ 0 and 2 x 1 + 3 x 2 + 1 x 3 ≤ 5 4 x 1 + 1 x 2 + 2 x 3 ≤ 11 3 x 1 + 4 x 2 + 2 x 3 ≤ 8 After

2. Solve for z:(a) Solve AB

T y = cB for y. AB

T =[2 4 3] [y1] [5][0 1 0] [y2] = [0][0 0 1] [y3] [0]

y= [2.5] [ 0 ] [ 0 ]

4

Page 5: Maximize: 5 x 1 + 4 x 2 + 3 x 3 subject to: x 1, x 2, x 3 ≥ 0 and 2 x 1 + 3 x 2 + 1 x 3 ≤ 5 4 x 1 + 1 x 2 + 2 x 3 ≤ 11 3 x 1 + 4 x 2 + 2 x 3 ≤ 8 After

(b) z= yT b + (cNT - yT AN ) xN

z= +

([0 4 3]-

z = 12.5 – 2.5 x4 -3.5 x2 + 0.5 x3

5

Page 6: Maximize: 5 x 1 + 4 x 2 + 3 x 3 subject to: x 1, x 2, x 3 ≥ 0 and 2 x 1 + 3 x 2 + 1 x 3 ≤ 5 4 x 1 + 1 x 2 + 2 x 3 ≤ 11 3 x 1 + 4 x 2 + 2 x 3 ≤ 8 After

The Revised Simplex Method uses more work to determine the

• z row coefficients,

• the column that should enter,

• and the pivot row number (exiting variable)

but then it takes less work to pivot.

6

Page 7: Maximize: 5 x 1 + 4 x 2 + 3 x 3 subject to: x 1, x 2, x 3 ≥ 0 and 2 x 1 + 3 x 2 + 1 x 3 ≤ 5 4 x 1 + 1 x 2 + 2 x 3 ≤ 11 3 x 1 + 4 x 2 + 2 x 3 ≤ 8 After

7

The Revised Simplex Algorithm Step 1: Determine pivot column.

Solve ABT y = cB for y.

compute [cNT - yT AN] * xN

to get coefficients of non-basic variables.

Look for a positive coefficient, say r corresponding to non-basic xj.

Page 8: Maximize: 5 x 1 + 4 x 2 + 3 x 3 subject to: x 1, x 2, x 3 ≥ 0 and 2 x 1 + 3 x 2 + 1 x 3 ≤ 5 4 x 1 + 1 x 2 + 2 x 3 ≤ 11 3 x 1 + 4 x 2 + 2 x 3 ≤ 8 After

Step 2: Determine the leaving variable. Solve for entering column d in current dictionary: d= AB

-1 a where a is the entering column taken from the initial problem.

Or equivalently, solve for d: AB d = a

If tightest constraint corresponds to

xleaving= v – t * xentering

then the new value of xentering will be s= v/t.8

Page 9: Maximize: 5 x 1 + 4 x 2 + 3 x 3 subject to: x 1, x 2, x 3 ≥ 0 and 2 x 1 + 3 x 2 + 1 x 3 ≤ 5 4 x 1 + 1 x 2 + 2 x 3 ≤ 11 3 x 1 + 4 x 2 + 2 x 3 ≤ 8 After

Step 3: Update variables (xj enters, xk leaves). Update basic variables headers HB by replacing k with j. Update HN by replacing j with k. Set xj = s in the new solution. Plug this value for xj into the other equations to update the values of the other basic variables. The leaving variable will be 0.

Recall r = the coefficient of xj in the z row:Set z = z + r s.

Update AB, AN, cB, cN, xB, xN to match basis headers.

9

Page 10: Maximize: 5 x 1 + 4 x 2 + 3 x 3 subject to: x 1, x 2, x 3 ≥ 0 and 2 x 1 + 3 x 2 + 1 x 3 ≤ 5 4 x 1 + 1 x 2 + 2 x 3 ≤ 11 3 x 1 + 4 x 2 + 2 x 3 ≤ 8 After

10

After the first iteration:HB

T =[1 5 6]AB =[2 0 0][4 1 0][3 0 1] cB = [5 0 0]T

cN= [0 4 3]T

xB= [x1 x5 x6]T

xN= [x4 x2 x3]T

Current solution:[5/2 1 1/2]

HNT =

[4 2 3]AN =[1 3 1][0 1 2][0 4 2]

Z= 25/2

Page 11: Maximize: 5 x 1 + 4 x 2 + 3 x 3 subject to: x 1, x 2, x 3 ≥ 0 and 2 x 1 + 3 x 2 + 1 x 3 ≤ 5 4 x 1 + 1 x 2 + 2 x 3 ≤ 11 3 x 1 + 4 x 2 + 2 x 3 ≤ 8 After

11

Step 1: Determine pivot column.

Solve ABT y = cB for y.

[2 4 3] [y1] [5][0 1 0] [y2] = [0][0 0 1] [y3] [0]

y1= 2.5, y2=0, y3=0

Page 12: Maximize: 5 x 1 + 4 x 2 + 3 x 3 subject to: x 1, x 2, x 3 ≥ 0 and 2 x 1 + 3 x 2 + 1 x 3 ≤ 5 4 x 1 + 1 x 2 + 2 x 3 ≤ 11 3 x 1 + 4 x 2 + 2 x 3 ≤ 8 After

12

Compute [cNT - yT AN] xN to get

coefficients of non-basic variables. Look for a positive coefficient, say r corresponding to non-basic xj. [0 4 3]-[ 2.5 0 0][1 3 1] [0 1 2] [0 4 2]

= [ -2.5 -3.5 0.5]The third variable should enter. Looking at xN, this is x3: xN= [x4 x2 x3]T

r = 1/2

Page 13: Maximize: 5 x 1 + 4 x 2 + 3 x 3 subject to: x 1, x 2, x 3 ≥ 0 and 2 x 1 + 3 x 2 + 1 x 3 ≤ 5 4 x 1 + 1 x 2 + 2 x 3 ≤ 11 3 x 1 + 4 x 2 + 2 x 3 ≤ 8 After

13

Step 2: Find pivot row. Solve AB d = a where a is column in A for entering variable xj. x3 is entering.

[2 0 0] [d1] [1][4 1 0] [d2] = [2][3 0 1] [d3] [2]

d = [0.5] [ 0 ] [0.5]

Page 14: Maximize: 5 x 1 + 4 x 2 + 3 x 3 subject to: x 1, x 2, x 3 ≥ 0 and 2 x 1 + 3 x 2 + 1 x 3 ≤ 5 4 x 1 + 1 x 2 + 2 x 3 ≤ 11 3 x 1 + 4 x 2 + 2 x 3 ≤ 8 After

14

d = [0.5] [ 0 ] [0.5]

Find the tightest constraint: Current solution is:[5/2 1 1/2]T

x1 ≤ 5/2 - 0.5 x3 ⟹ x3 ≤ 5x5 ≤ 1 - 0 x3 NO CONSTRAINTx6 ≤ 1/2 - 0.5 x3 ⟹ x3 ≤ 1 (*) s=1So the third basis variable exits. HB

T= [1 5 6], x6 exits.

Page 15: Maximize: 5 x 1 + 4 x 2 + 3 x 3 subject to: x 1, x 2, x 3 ≥ 0 and 2 x 1 + 3 x 2 + 1 x 3 ≤ 5 4 x 1 + 1 x 2 + 2 x 3 ≤ 11 3 x 1 + 4 x 2 + 2 x 3 ≤ 8 After

15

Pivot:

The new basis value variables:

x1 = 5/2 - 0.5 * 1 = 2x5 = 1 - 0 * 1 = 1x6 = 1/2 - 0.5 * 1 = 0 x3=1

z= 12.5 + r *s = 12.5 + 0.5*1= 13

Page 16: Maximize: 5 x 1 + 4 x 2 + 3 x 3 subject to: x 1, x 2, x 3 ≥ 0 and 2 x 1 + 3 x 2 + 1 x 3 ≤ 5 4 x 1 + 1 x 2 + 2 x 3 ≤ 11 3 x 1 + 4 x 2 + 2 x 3 ≤ 8 After

16

After the second iteration:HB

T =[1 5 3]AB =[2 0 1][4 1 2][3 0 2] cB = [5 0 3]T

cN= [0 4 0]T

xB= [x1 x5 x3]T

xN= [x4 x2 x6]T

Current solution:[2 1 1]T

HNT =

[4 2 6]AN =[1 3 0][0 1 0][0 4 1]

Z= 13

Page 17: Maximize: 5 x 1 + 4 x 2 + 3 x 3 subject to: x 1, x 2, x 3 ≥ 0 and 2 x 1 + 3 x 2 + 1 x 3 ≤ 5 4 x 1 + 1 x 2 + 2 x 3 ≤ 11 3 x 1 + 4 x 2 + 2 x 3 ≤ 8 After

17

Iteration 3: Step 1: Determine pivot column.

Solve ABT y = cB for y.

[2 4 3] [y1] [5][0 1 0] [y2] = [0][1 2 2] [y3] [3]

y1= 1, y2=0, y3=1

Page 18: Maximize: 5 x 1 + 4 x 2 + 3 x 3 subject to: x 1, x 2, x 3 ≥ 0 and 2 x 1 + 3 x 2 + 1 x 3 ≤ 5 4 x 1 + 1 x 2 + 2 x 3 ≤ 11 3 x 1 + 4 x 2 + 2 x 3 ≤ 8 After

18

Compute [cNT - yT AN] xN to get

coefficients of non-basic variables.y1= 1, y2=0, y3=1

[0 4 0]- [1 0 1] = [ -1 -3 -1]

All the coefficients are negative so the current solution is OPTIMAL

Page 19: Maximize: 5 x 1 + 4 x 2 + 3 x 3 subject to: x 1, x 2, x 3 ≥ 0 and 2 x 1 + 3 x 2 + 1 x 3 ≤ 5 4 x 1 + 1 x 2 + 2 x 3 ≤ 11 3 x 1 + 4 x 2 + 2 x 3 ≤ 8 After

After 1 pivot:X1 = 2.5- 1.5 X2 - 0.5 X3 - 0.5 X4 X5 = 1.0+ 5.0 X2 + 0.0 X3 + 2.0 X4 X6 = 0.5+ 0.5 X2 - 0.5 X3 + 1.5 X4 ------------------------------------z = 12.5- 3.5 X2 + 0.5 X3 - 2.5 X4 X3 enters. X6 leaves. After 2 pivots:X1 = 2.0- 2.0 X2 - 2.0 X4 + 1.0 X6 X5 = 1.0+ 5.0 X2 + 2.0 X4 + 0.0 X6 X3 = 1.0+ 1.0 X2 + 3.0 X4 - 2.0 X6 -------------------------------------z = 13.0- 3.0 X2 - 1.0 X4 - 1.0 X6yi’s at each step: -(coeff. of xn+i)

19