Problem 5 - University of Washingtoncourses.washington.edu/inde510/513/hw/513hw4.pdf · Sparsity...

14
Problem 5.4 Minimize x 1 + 6x 2 – 7x 3 + x 4 + 5x 5 Subject to x 1 + ¾x 2 + 2x 3 - ¼x 4 = 5 - ¼x 2 + 3x 3 - ¾x 4 + x 5 = 5 x 1 , x 2 , x 3 , x 4 , x 5 0 Iteration 1: let x B = 5 1 X X B [a 1 a 5 ] = 1 0 0 1 B -1 = 1 0 0 1 w = c B B -1 = c B I = c B = (1, 5) z 2 – c 2 = wa 2 – c 2 = (1, 5) 4 1 4 3 - 6 = -8 z 3 – c 3 = wa 3 – c 3 = (1, 5) 3 2 - (-7) = 24 z 4 – c 4 = wa 4 – c 4 = (1, 5) 4 3 4 1 - 1 = -5 Let x 3 be the entering variable (z 3 – c 3 0) y 3 = B -1 a 3 = 3 2 b =B -1 b = 5 5 minratio : 3 5 2 5 Let x 5 be the leaving variable; r = 2, x B2 = x 5 E 1 = 2 1 0 1 ξ ξ = 23 23 11 1 0 1 y y y = 3 1 3 2 0 1

Transcript of Problem 5 - University of Washingtoncourses.washington.edu/inde510/513/hw/513hw4.pdf · Sparsity...

Page 1: Problem 5 - University of Washingtoncourses.washington.edu/inde510/513/hw/513hw4.pdf · Sparsity may be exploited by storing data in packed form (singly or doubly linked lists) and

Problem 5.4 Minimize x1 + 6x2 – 7x3 + x4 + 5x5 Subject to x1 + ¾x2 + 2x3 - ¼x4 = 5 - ¼x2 + 3x3 - ¾x4 + x5 = 5

x1, x2, x3, x4, x5 ≥ 0 Iteration 1:

let xB =

5

1

XX

B [a1 a5] =

1001

B-1 =

1001

w = cBB-1 = cBI = cB = (1, 5)

z2 – c2 = wa2 – c2 = (1, 5)

−−

41

43

- 6 = -8

z3 – c3 = wa3 – c3 = (1, 5)

32

- (-7) = 24

z4 – c4 = wa4 – c4 = (1, 5)

−−

43

41

- 1 = -5

Let x3 be the entering variable (z3 – c3 ≥ 0)

y3 = B-1a3 =

32

b =B-1b =

55

minratio :

3

5

25

Let x5 be the leaving variable; r = 2, xB2 = x5

E1=

2

1

01

ξξ

=

23

23

11

10

1

y

yy

=

31

32

01

Page 2: Problem 5 - University of Washingtoncourses.washington.edu/inde510/513/hw/513hw4.pdf · Sparsity may be exploited by storing data in packed form (singly or doubly linked lists) and

Iteration 2:

let xB =

3

1

XX

B=[a1, a3] =

3021

B-1 = E1 =

31

32

01

w = cBB-1 = cBE1 = [1 -7]

31

32

01

= [1 -3]

z2 – c2 = wa2 – c2 = [1 -3]

−−

41

43

- 6 = -6

z4 – c4 = wa4 – c4 = [1 -3]

−−

43

41

- 1 = 1

z5 – c5 = wa5 – c5 = [1 -3]

10

- 5 = -8

Let x4 be the entering variable (z4 – c4 ≥ 0)

y4 = B-1a4 = E1a4 =

31

32

01

−−

43

41

=

− 4

1

41

b =B-1b = E1b =

31

32

01

55

=

3

5

35

min ratio test : let x1leave

Let x1 be the leaving variable; r = 1, xB1 = x1

E1=

10

2

1

ξξ

=

− 1

01

11

21

11

yy

y =

1104

B-1new = E2E1 =

1104

31

32

01

=

−−

31

38

14

check B = [ ]34 aa =

−−

32

43

41

Page 3: Problem 5 - University of Washingtoncourses.washington.edu/inde510/513/hw/513hw4.pdf · Sparsity may be exploited by storing data in packed form (singly or doubly linked lists) and

Iteration 3:

xB =

3

4

XX

check B = [ ]34 aa =

−−

32

43

41

B-1 = E2E1 =

1104

31

32

01

=

−−

31

38

14

w = cBB-1 = cBE2E1 = [1 -7]

−−

31

38

14

= [-3 - 1/3]

z1 – c1 = wa1 – c1 = [-3 - 1/3]

01

- 1 = -4

z2 – c2 = wa2 – c2 = [-3 - 1/3]

−−

41

43

- 6 = -11/3

z5 – c5 = wa5 – c5 = = [-3 - 1/3]

10

- 5 = -16/3

This current solution xB =

3

4

XX

is optimal!

xB = E2E1b =

−−

31

38

14

55

=

3

10

320

z = cB xB = [1 -7]

3

10

320

= -50/3

x1

* = 0; x2*= 0; x3

*= 10/3; x4*= -20/3; x5

*= 0

Page 4: Problem 5 - University of Washingtoncourses.washington.edu/inde510/513/hw/513hw4.pdf · Sparsity may be exploited by storing data in packed form (singly or doubly linked lists) and

Problem 5.9 A is m x n. At iteration k, suppose there are t ~ O(m) factors. Then the complexity of k following operations are: (1) Simplex multipliers computation O(m2) (2) pricing (total) O(mn) (3) updated column determination O(m2) (4) updated rhs O(m) (5) new factor O(m) Additionally, reinversion when required is O(m3) Sparsity may be exploited by storing data in packed form (singly or doubly linked lists) and using authentic operations in nonzero quantities only.

Problem 5.11 Minimize x1 + 2x2 + 3x3 - x4 Subject to 2x1 - x2 + x3 - 2x4 + x5

S = 6

-x1 + 2x2 - x3 + x4 + x6S = 8

2x1 + x2 - x3 - x7S + x8

a = 2 0 ≤ x1 ≤ 3 1 ≤ x2 ≤ 4 x5

S, x6

S, x7

S, x8

a ≥ 0

0 ≤ x3 ≤ 10 2 ≤ x4 ≤ 5

Let xB =

a

S

S

xxx

8

6

5

and all others are at their lower bounds

x1 = 0; x2 = 1; x3 = 0 ; x4 = 2; x7S = 0

Use the 2-phase method, min x8

a first, them min z x5

S = 6 + 1 + 4 = 11 x6

S = 8 –2 –2 = 4 x8

a = 2 – 1 = 1 Using the phase I objective, choose x1 to enter the basis, the leaving variable can be found with the modified min ratio test:

l l l l l W Z’ X1 X2 X3 X4 X5

S X6S X7

S X8a

W 1 0 2 1 -1 0 0 0 -1 0 1 Z’ 0 1 -1 -2 -3 1 0 0 0 0 0

X5S 0 0 2 -1 1 -2 1 0 0 0 11

X6S 0 0 -1 2 -1 1 0 1 0 0 4

X8a 0 0 2 1 -1 0 0 0 -1 1 1

Page 5: Problem 5 - University of Washingtoncourses.washington.edu/inde510/513/hw/513hw4.pdf · Sparsity may be exploited by storing data in packed form (singly or doubly linked lists) and

γ1 = Minimum

−∞−

201,,

2011 = ½

γ2 = Minimum { } ∞=∞∞∞ ,, ∆1 = min (½, ∞, u1 – l1=3) = ½ min of the ratio is ½ so x1 enters and x8

a leaves

l l l l W Z’ X1 X2 X3 X4 X5

S X6S X7

S X8a

W 1 0 0 0 0 0 0 0 0 -1 0 Z’ 0 1 0 -3/2

-7/2 1 0 0 -1/2 -1/2 1/2 X5

S 0 0 0 -2 2 -2 1 0 1 -1 10 X6

S 0 0 0 5/2 -3/2 1 0 1 -1/2 1/2 9/2 X1 0 0 1 1/2 -1/2 0 0 0 -1/2 1/2 1/2

this tableau is now a BFS to the original problem, so we can eliminate the column for x8a and continue.

Looking at the z objective, x4 is the only variable eligible to enter, so let x4 enter. Modified min ratio test:

γ1 = Minimum

−∞ ,

10

, 29

= 9/2

γ2 = Minimum

∞∞

−−− ,,2010 = 5

u4 – l4 = 5 –2 = 3 ∆4 = min (9/2, 5, u4 – l4) = 3 sp x4 is set to it’s upper bound and it stays nonbasic. The only part of the tableau that changes is the rhs:

xB =

1

6

5

xxx

S

S

= b - y4 ∆4 =

21

29

10- 3

012

=

21

23

16 and this is optimal!

z = cBxB + cnlxnl + cnuxnu x* = (1/2, 1, 0, 5, 3/2, 16 0) = -5/2

l l u l Z’ X1 X2 X3 X4 X5

S X6S X7

S Z’ 1 0 -3/2

-7/2 1 0 0 -1/2 -5/2 X5

S 0 0 -2 2 -2 1 0 1 16 X6

S 0 0 5/2 -3/2 1 0 1 -1/2 3/2 X1 0 1 1/2 -1/2 0 0 0 -1/2 1/2

Page 6: Problem 5 - University of Washingtoncourses.washington.edu/inde510/513/hw/513hw4.pdf · Sparsity may be exploited by storing data in packed form (singly or doubly linked lists) and

Problem 5.12 Max x1 - x2 ST -x1 – x2 ≤ 1 (+x3

S) 2x1 - x2 ≤ 1 (+x4

S) -2 ≤ x1 ≤ 1 (x3

S, x4S ≥ 0)

-∞ ≤ x2 ≤ 2 a)

Optimal solution is (0,-1) = x* and z* = 1 x3

S, x4S = 0

This is not a degenerate solution an can’t be degenerate since neither x1

*, x2* are at their

upper or lower bounds b) For the extreme point (1,1),

x1 is at it’s upper bound (nonbasic) x2 is not at a bound (basic) x3

S = 3 is not at a bound (basic) x4

S = 0 at it’s lower bound (nonbasic)

B = [ a3 a2 ] =

−−

1011

B-1 =

−−

1011

cB = (0 , -1) cBB-1 = (0 , 1)

w = cBB-1 = (0 , -1)

−−

1011

= (0 , 1)

z1 – c1 = wa1 – c1 = [0 1 ]

−21

- 1 = 1 x1 is at it’s upper bound, and z1 – c1 >0 means

x1 is eligible to enter

z4 – c4 = wa4 – c4 = [0 1 ]

10

- 0 = 1 x4 is at it’s lower bound and z1 – c1 >0 means

x4 is not eligible to enter Let x1 be the entering variable decreasing from it’s upper bound

y1 = B-1a1 =

−−

1011

−21

=

−−

23

2 0 22

0

2

4Graph of Constraints

Units of x2

Uni

ts o

f x1

s( )t

y( )t

x( )t

t

(1, 1)

(0, -1)

Page 7: Problem 5 - University of Washingtoncourses.washington.edu/inde510/513/hw/513hw4.pdf · Sparsity may be exploited by storing data in packed form (singly or doubly linked lists) and

b =B-1b – B-1Nlxnl – B-1Nuxnu =

−−

1011

11

-

−−

1011

[a4] )0(4x

-

−−

1011

−21

(1)

=

−10

-

00

-

−−

23

=

13

=

2

3

xxS

The min ratio test yields (using pg 213, xk decreasing from its upper bound)

γ1 = Minimum

−−−∞−

−−−

21,

303 = 1

γ2 = Minimum { }∞∞, = ∞ ∆1 = min (1, ∞, u4 – l4 = 3) = 1 So x3

S leaves at its lower bound 0 Perform pivot, with x1 entering, x3

S leaving at lower bound

xB =

2

1

xx

x3S, x4

S = 0 both at lower bound

xB = b + y1∆x1 =

13

+

−−

23

(1) =

−10

so x1 = 0, x2 = -1

z = z + (z1 - c1)∆x1 = 0 + 1(1) = 1 to check for optimality or an entering variable:

xB =

2

1

xx

=

−10

B =

−−−

1211

B-1 =

−−

31

32

31

31

w = cBB-1 = (1 , -1)

−−

31

32

31

31

= (1/3 , 2/3)

z3 – c3 = wa3 – c3 =(1/3 , 2/3)

01

- 0 = 1/3 x3S is at lower bound, and this max - so it not eligible to enter

z4 – c4 = wa4 – c4 =(1/3 , 2/3)

10

- 0 = 2/3 x4S is at lower bound, and this max - so it not eligible to enter

So this is optimal! x1

* = 0 (basic), x2* = -1 (basic), x3

* = 0 (lower), x4* = 0 (lower)

a1 x1u

Page 8: Problem 5 - University of Washingtoncourses.washington.edu/inde510/513/hw/513hw4.pdf · Sparsity may be exploited by storing data in packed form (singly or doubly linked lists) and

Problem 5.21 Max 2x1 + 3x2 + 8x3 + x4 + 5x5 ST 3x1 + 7x2 + 12x3 + 2x4 + 7x5 ≤ 10 (+x6

S) xi ≥ 0

Z’ X1 X2 X3 X4 X5 X6S

Z’ 1 -2 -3 -8 -1 -5 0 0 X6

S 0 3 7 12 2 7 1 10

if we let x3 enter, and x6S leaves with min ration of 10/12, ∆z = 8 (10/12) = 20/3

but if we let x5 enter, with a min ration of 10/7, ∆z = 5(10/7) = 50/7 – which is larger

So we want to let xk enter, where it max

i

i

ac

Let x5 enter, x6

S leaves

Z’ X1 X2 X3 X4 X5S X6

S Z’ 1 1/7 2 4/7 3/7 0 5/7 50/7 X5 0 3/7 1 12/7 2/7 1 1/7 10/7

Optimal! x* = (0, 0, 0, 0, 10/7) z* = 50/7 ,

b) if cj, aj are positive scalars, and b≥ 0,

then let

K

K

ac =

≤≤ k

k

ni acmax

1 and

optimal solution is

xi* =

0ka

b for

kiki

≠=

i = 1 ... n

z* = k

k

abc

if cj, aj are positive scalars and b< 0, the problem is infeasible

Page 9: Problem 5 - University of Washingtoncourses.washington.edu/inde510/513/hw/513hw4.pdf · Sparsity may be exploited by storing data in packed form (singly or doubly linked lists) and

c) Max c1x1 + ..... + cnxn ST a1x1 + ..... + anxn ≤ b xi ≥ 0 i= 1 ... n if cj, aj are allowed to be any scalars and b≥ 0,

i) if there exists ci ≥ 0 and ai ≤ 0, the problem is unbounded

ii) if there exists ci ≥ 0 and ai < 0, and a cj > 0, aj > 0 such that j

j

ac

>i

i

ac , the problem is

unbounded

this is because B = [aj], B-1 =

ja1 and

cBB-1ai – ci = j

ij

aac

- cj = j

ij

aac

-i

ii

aac = 0<

i

i

j

ji a

cac

a , so its unbounded

example of this case: max -1x1 + 2x2 + 3x3 ST -1x1 + 1x2 + 1x3 ≤10 x1 is xi where c1≤ 0 and a1 ≤ 0 x2 is xj where c2 > 0 and a2 > 0 and (2/1) > (-1/-1). Let x2 be in the basis:

Z’ X1 X2 X3 X4S

Z’ 1 -1 0 -1 2 20 X2 0 -1 1 1 1 10

Zero out the coefficients under x2 1 -2 -3 0 0 -2 2 2 2 20 -1 0 -1 2 20

Now, if x1 were to enter, there is no leaving variable, so LP is unbounded.

i) ........ unbounded ii) ........ unbounded iii) otherwise, (1) ci ≤ 0 for all i, then the optimal solution is (0,...,0)

(2) there exists ci > 0, ai > 0 for some i,

pick r

r

ac =

≤≤ i

i

ni acmax

1 : where ci > 0 and ai > 0

xi* =

0ra

b for

otherwiseri =

-+

Page 10: Problem 5 - University of Washingtoncourses.washington.edu/inde510/513/hw/513hw4.pdf · Sparsity may be exploited by storing data in packed form (singly or doubly linked lists) and

that was all if b ≥ 0, if b ≤ 0, multiply the constraint by –1, then –b ≥ 0, since aj, cj are allowed to be any scalar, then use above (d) First let all scalars ai, cj and b ≥ 0.

Suppose 0 ≤ xj≤ uj for j = 1, .... n and uj < ∞, j = 1 ... n

then compute the ratios j

j

ac

and reorder themso the indices are:

1

1

ac ≥

2

2

ac ≥ ..... ≥

n

n

ac

The optimal solution is to put the variables at their upper bounds in sequence xi, ... xn until equality holds.

That is: find r ∈ (1, ..., n) ST 0 < r

rjjj

a

uab ∑<

−<ur

and xj

* = uj for j < r

xr* =

r

rjjj

a

uab ∑<

− > 0

xj* = 0 for j > r

The mixed signs for aj, cj create modified problem (P’) and use part (c): i) aj = 0 ⇒ put xj

* = uj if cj > 0 and 0 otherwise ii) cj ≥ 0, aj > 0 ⇒ keep in problem (P’) as is iii) cj ≥ 0, aj < 0 ⇒ put xj

* = uj iv) cj ≤ 0, aj > 0 ⇒ xj

* = 0 v) cj < 0, aj < 0 ⇒ put yj = (uj - xj) ⇒ 0 ≤ yj ≤ uj and its coefficients are as in case ii) in (P’)

Now problem (P’) is or the form of part (c) and same method applies Note: there are other approaches that work too.

Page 11: Problem 5 - University of Washingtoncourses.washington.edu/inde510/513/hw/513hw4.pdf · Sparsity may be exploited by storing data in packed form (singly or doubly linked lists) and

Problem 5.32 Model A – 400 cars volume – 12 m3/car Model B – 500 cars volume - 15 m3/car ship 1 – beg of Jan – only model A at $450/car, with max of 200 ship 2 – mid Feb – both models, 35 $/m3 with max volume of 4500 m3 ship 3 – end of March - both models, 40 $/m3 with max volume of 6000 m3 Must ship 250 Model A’s and 200 Model B’s by mid-Feb. and ship the rest by end of March Let xij = number of cars of Model i to be shipped on ship j where i = A,B and j= 1,2,3 (Note: xB1 = 0 or must be left undefined) Min Z = 450 xA1 + (35)(12) xA2 + (35)(15) xB2 + (40)(12) xA3 + (40)(15) xB3 Z = 450 xA1 + 420 xA2 + 525 xB2 + 480 xA3 + 600 xB3 ST Timing constraints - xA1 + xA2 + xA3 = 400 xA1 + xA2 ≥ 250

xB2 + xB3 = 500 xB2 ≥ 200 Capacity Constraints - xA1 ≤ 200 12 xA2 + 15xB2 ≤ 4500 12 xA3 + 15xB2 ≤ 6500 xA1 xA2 xA3 xB2 xB3 ≥ 0 Optimal Solution : xA1 = 200 , xA2 = 50, xA3 = 150, xB2 = 260, xB3 = 240 Z* 463,500 note: ship 1 and 2 are full, but 3 is not

Page 12: Problem 5 - University of Washingtoncourses.washington.edu/inde510/513/hw/513hw4.pdf · Sparsity may be exploited by storing data in packed form (singly or doubly linked lists) and

Problem 5.52 if a1

2 + a22 = 1, then x3

S = distance perpendicular x3

s = b – (a1x1 + a2x2) (x1+ ∆x1, x2) Satisfies the constraint a1(x1 + ∆x1) + a2x2 = b a1x1 + a1∆x1 + a2x2 = b Similarly, (x1, x2 + ∆x2) Satisfies the constraint a1x1 + a2(x2 + ∆x2) = b a1x1 + a2x2 + a2∆x2 = b Now x3

S = b – (a1x1 + a2x2) = a1∆x1 = a2∆x2 For n variables, xn+1

S = b – (a1x1 +....+ anxn) and holding all but one constraint, we get = a1∆x1 ... =an∆xn If a is a unit vector, then xn+1

S is the distance from x to the hyperplane

(x1, 2

11a

xab − )

(1

22a

xab − , x2)

(1a

b , 0)

a1x1 + a2x2 = b

(0, 1a

b )

(`∆x2)

(`∆x1

(x1, x2)

a1x1 + a2x2 + x3S = b

Page 13: Problem 5 - University of Washingtoncourses.washington.edu/inde510/513/hw/513hw4.pdf · Sparsity may be exploited by storing data in packed form (singly or doubly linked lists) and
Page 14: Problem 5 - University of Washingtoncourses.washington.edu/inde510/513/hw/513hw4.pdf · Sparsity may be exploited by storing data in packed form (singly or doubly linked lists) and