Presentation is loading. Please wait.

Presentation is loading. Please wait.

The Simplex Algorithm 虞台文 大同大學資工所 智慧型多媒體研究室. Content Basic Feasible Solutions The Geometry of Linear Programs Moving From Bfs to Bfs Organization of a.

Similar presentations


Presentation on theme: "The Simplex Algorithm 虞台文 大同大學資工所 智慧型多媒體研究室. Content Basic Feasible Solutions The Geometry of Linear Programs Moving From Bfs to Bfs Organization of a."— Presentation transcript:

1 The Simplex Algorithm 虞台文 大同大學資工所 智慧型多媒體研究室

2 Content Basic Feasible Solutions The Geometry of Linear Programs Moving From Bfs to Bfs Organization of a Tableau Choosing a Profitable Column Pivot Selection Anticycling Algorithm The Two-Phase Simplex Algorithm

3 Linear Programming Basic Feasible Solutions 大同大學資工所 智慧型多媒體研究室

4 The Goal of the Simplex Algorithm Any LP can be converted into the standard form

5 Convex Polytope defines a convex set F F may be 1.Bounded 2.Unbounded 3.Empty

6 The Basic Idea of Simplex Algorithm basic feasible solution at a corner Finding optimum by moving around the corner of the convex polytope in cost descent sense

7 The Basic Idea of Simplex Algorithm basic feasible solution at a corner Finding optimum by moving around the corner of the convex polytope in cost descent sense How to find an initial feasible solution? How to move from corner to corner?

8 Assumption 1 Assume that A is of rank m. There is a basis Independent has an inverse.

9 Basic Solution The basis solution corresponding to B is: The basis solution may be infeasible.

10 Example x1x1 x2x2 x3x3 x4x4 x5x5 x6x6 x7x7

11 x1x1 x2x2 x3x3 x4x4 x5x5 x6x6 x7x7 feasible

12 Example x1x1 x2x2 x3x3 x4x4 x5x5 x6x6 x7x7 infeasible

13 Basic Feasible Solution defines an nonempty convex set F If a basic solution is in F, it is called a basic feasible solution (bfs).

14 The Existence of BFS’s F may be 1.Bounded 2.Unbounded 3.Empty If F is nonempty, at least one bfs. defines an nonempty convex set F

15 The Existence of BFS’s F may be 1.Bounded 2.Unbounded 3.Empty If F is nonempty, at least one bfs. How to find it?

16 Assumptions 1. A is of rank m. 2. F is nonempty. 3. c ’ x is bounded below for x  F. 1. A is of rank m. 2. F is nonempty. 3. c ’ x is bounded below for x  F. defines an nonempty convex set F

17 Assumptions 1. A is of rank m. 2. F is nonempty. 3. c ’ x is bounded below for x  F. 1. A is of rank m. 2. F is nonempty. 3. c ’ x is bounded below for x  F. There exist bfs’s. defines an nonempty convex set F Ensure there is a bounded solution. Are all bfs’s the vertices of the convex polytope defined by F ?

18 The Simplex Alogrithm The Geometry of Linear Programs 大同大學資工所 智慧型多媒體研究室

19 Linear Subspaces of R d S  R d is a subspace of R d if it is closed under vector addition and scalar multiplication. S defined below is a subspace of R d. a set of homogenous linear equations

20 Dimensions

21 Affine subspaces A translated linear subspace. E.g., an affine subspace a set of nonhomogenous linear equations an affine subspace

22 Dimensions an affine subspace

23 Subsets of R d The following subsets are not subspace or affine subspace. A line segment The first quadrant A halfspace

24 Dimensions The following subsets are not subspace or affine subspace. A line segment The first quadrant A halfspace The dimension of any subset of R d is the smallest dimension of any affine subspace which contains it. Dim = 1 Dim = 2

25 The Feasible Spaces of LP 1. A is of rank m. 2. F is nonempty. 3. c ’ x is bounded below for x  F. 1. A is of rank m. 2. F is nonempty. 3. c ’ x is bounded below for x  F. defines an nonempty convex set F

26 Hyperplane/Halfspace An affine subspace of R d of dimension d  1 is called a hyperplane. A hyperplane defines two closed halfspaces: Fact: Halfspaces are convex.

27 Convex Polytopes The intersection of a finite number of halfspaces, when it is bounded and nonempty is called a convex polytope, or simply a polytope. Fact: Halfspaces are convex.

28 x1x1 x2x2 x3x3 Example     (0, 0, 3) (1, 0, 3) (2, 0, 2) (2, 0, 0) (2, 2, 0)(0, 2, 0) (0, 1, 3) (0, 0, 0)    

29 More on Polytopes Geometric views of a polytope – The convex hull of a finite set of points. – The intersection of a finite number of halfspaces, when it is bounded and nonempty, i.e., defined by The algebraic view of a polytope The feasible space defined by LP (in standard form). Any relation?

30 LP  Polytopes Assume m columns n  m columns x1x1 x2x2 xnmxnm x n  m+1 xnxn A can always be in this form if rank(A)=m. LP

31 LP  Polytopes Assume m columns n  m columns x1x1 x2x2 xnmxnm x n  m+1 xnxn LP

32 LP  Polytopes 00 LP

33 Polytopes  LP m inequalities m equalities

34 Polytopes  LP m inequalities Slack variables

35 Polytopes  LP Slack variables

36 Polytopes and LP Slack variables H I H

37 Polytopes and LP The answer

38 Polytopes and LP The answer

39 Polytopes & F of LP defines a polytope defines a feasible set Are there any relations?

40 Polytopes & F of LP defines a polytope defines a feasible set Some points in P are vertices. Some points in F are bfs’s. Are there any relations?

41 Theorem 1 a convex polytope a feasible set of the corresponding LP is a vertex of P is a bfs.

42 Theorem 1 Pf) “”“” See textbook.

43 Theorem 1 Pf) “”“” Fact:is a vertex, then it cannot be the strict combination of points of P, i.e.,

44 Theorem 1 Pf) “”“” Fact:is a vertex, then it cannot be the strict combination of points of P, i.e.,

45 Theorem 1 Pf) “”“” Fact: Define B = {A j : x j > 0, 1  j  n} Let We want to show at most m nonzero x i ’s. We want to show that vectors in B are linearly independent. Suppose not. Then, some d j  0. >0 if  is sufficiently small.

46 Theorem 1 Pf) “”“” Fact: Define B = {A j : x j > 0, 1  j  n} Let We want to show at most m nonzero x i ’s. We want to show that vectors in B are linearly independent. Suppose not. Then, some d j  0. >0 if  is sufficiently small. Define  is sufficiently small.

47 Theorem 1 Pf) “”“” Fact: Define B = {A j : x j > 0, 1  j  n} Let We want to show at most m nonzero x i ’s. A j are linearly independent. | B |  m.  Since rank(A) = m, we can always augment B to include m linearly independent vectors. Using B to form basic columns renders x a bfs.

48 Discussion Pf) “”“” Fact: Define B = {A j : x j > 0, 1  j  n} Let We want to show at most m nonzero x i ’s. A j are linearly independent. | B |  m.  Since rank(A) = m, we can always augment B to include m linearly independent vectors. Using B to form basic columns renders x a bfs. If | B | < m, there may be many ways to augment to m linearly independent vectors. Two different B and B ’ may corresponds to the same bfs. If | B | < m, there may be many ways to augment to m linearly independent vectors. Two different B and B ’ may corresponds to the same bfs. Two different, their corresponding B and B ’ must be different.

49 Example x1x1 x2x2 x3x3     (0, 0, 3) (1, 0, 3) (2, 0, 2) (2, 0, 0) (2, 2, 0)(0, 2, 0) (0, 1, 3) (0, 0, 0)    

50 Example Corresponding F of LP

51 Example Corresponding F of LP

52 Example Corresponding F of LP B and B ’ determine the same bfs, i.e, x = (2, 2, 0, 0, 0, 3, 0) ’. B and B ’ determine the same bfs, i.e, x = (2, 2, 0, 0, 0, 3, 0) ’.

53 Degeneration A bfs is called degenerate if it contains more than n  m zeros.

54 x x Theorem 2 A bfs is called degenerate if it contains more than n  m zeros. If two distinct bases corresponding to the same bfs x, then x is degenerate. Pf) Let B and B ’ be two distinct bases which determine the same bfs x. B B’B’ 0 0 00 n m m

55 x x Theorem 2 A bfs is called degenerate if it contains more than n  m zeros. Pf) Let B and B ’ be two distinct bases which determine the same bfs x. B B’B’ 0 0 00 n m m 00 x has more than n  m zeros and, hence, is degenerate. If two distinct bases corresponding to the same bfs x, then x is degenerate.

56 Discussion A bfs is called degenerate if it contains more than n  m zeros. If two distinct bases corresponding to the same bfs x, then x is degenerate. Changing basis may keep bfs unchanged.

57 More on Theorem 1 and 2 Vertices of polytopeBfs’s of LP Change vertexChange bfs ? A bfs is determined by a chosen basis. Change verticesChange basis ?

58 Costs ? ? ?

59 Costs constant

60 Theorem 3 There is an optimal bfs in any instance of LP. Furthermore, if q bfs’s are optimal, their convex combinations are also optimal.

61 Theorem 3 There is an optimal bfs in any instance of LP. Furthermore, if q bfs’s are optimal, their convex combinations are also optimal. Let x 0  P be the optimal solution, and let x 1, …, x N be the vertices of P. with Let j be the index corresponding to the vertex with lowest cost. x j is the optimum. Pf) and

62 Theorem 3 There is an optimal bfs in any instance of LP. Furthermore, if q bfs’s are optimal, their convex combinations are also optimal. Assume y 1, …, y q be the optimal vertices. Pf) Let withand

63 Linear Programming Moving from Bfs to Bfs 大同大學資工所 智慧型多媒體研究室

64 Facts The optimal solution can be found from vertices of the corresponding polytope. The bfs’s of LP and the vertices of polytope are close correlated. The algorithm to solve LP: – Move from vertex to vertex; or – Move from bfs to bfs

65 The BFS’s Basis columns Nonbasis columns The bfs is determined from the set of basis columns, i.e., B. Move from bfs to bfs:

66 Move from Bfs to Bfs Let x 0 be the bfs determined by B. Denote the basic components of x 0 as x i0, i = 1, …, m. For any, we have    

67 Move from Bfs to Bfs m + 1 columns are involved. Choose one A j from to enter B. Choose one A B(i) to leave B. Who enters? Who leaves?

68 Move from Bfs to Bfs m + 1 columns are involved. Choose one A j from to enter B. Choose one A B(i) to leave B. Who enters? Who leaves?  must be positive. Make one of them zero, and keep others nonnegative. The one that we want to make zero must have x ij > 0. Why?

69 Move from Bfs to Bfs Suppose that A j wants to enter B. Then, we choose Make one of them zero, and keep others nonnegative.

70 Move from Bfs to Bfs Suppose that A j wants to enter B. Then, we choose Make one of them zero, and keep others nonnegative. 1.How about if x i0 = 0 for some i ? 2.How about if all x ij  0 ? 1.How about if x i0 = 0 for some i ? 2.How about if all x ij  0 ?

71 Example x1x1 x2x2 x3x3     (0, 0, 3) (1, 0, 3) (2, 0, 2) (2, 0, 0) (2, 2, 0)(0, 2, 0) (0, 1, 3) (0, 0, 0)    

72 Example Corresponding F of LP

73 Example Corresponding F of LP 2214   

74 Example Corresponding F of LP 2214    Choosing  =  0 = 1 makes A 6 leaves B. 

75 Example Corresponding F of LP 224  01 11 33 11 00 33   = 0  = 1 Choosing  =  0 = 1 makes A 6 leaves B.

76 Linear Programming Organization of a Tableau 大同大學資工所 智慧型多媒體研究室

77 x1x1 x2x2 x3x3 x4x4 x5x5 Ans Example x1x1 x2x2 x3x3 x4x4 x5x5 Ans 1 3 4 3 5 2 2 1 5 1 1 1 0 1 0 0 0 1 1 2 3 3 2 11 2 11 3 1 0 0 0 1 0 0 0 1 R1 R2  R1 R3  R1 Elementary Row operations

78 x1x1 x2x2 x3x3 x4x4 x5x5 Ans Example 1 2 3 3 2 11 2 11 3 1 0 0 0 1 0 0 0 1 B Suppose that we want to choose A 1 to enter the basis, i.e., choosing A 1 as the pivot column.    1/3 2/2 min

79 x1x1 x2x2 x3x3 x4x4 x5x5 Ans Example 1 2 3 3 2 11 2 11 3 1 0 0 0 1 0 0 0 1 B    1/3 2/2 min

80 x1x1 x2x2 x3x3 x4x4 x5x5 Ans Example 1 2 3 3 2 11 2 11 3 1 0 0 0 1 0 0 0 1 1/3 2/2 min x1x1 x2x2 x3x3 x4x4 x5x5 Ans 1/3 4/3 10/3 1 0 0 2/3  7/3 11/3 1/3  2/3 1/3 0 1 0 0 0 1

81 Linear Programming Choosing a Profitable Column 大同大學資工所 智慧型多媒體研究室

82 Cost Change by Bfs 0  Bfs 1 bfs 0 = x 0 obtained using B a basis cost of bfs 0 Aj  BAj  B want to enter the basis cjcj unit cost corresponding to A j (x j ). decomposition of A j. cost difference by bringing one unit of A j into bfs 0.

83 Choose Profitable Columns bfs 0 = x 0 obtained using B a basis cost of bfs 0 Aj  BAj  B want to enter the basis cjcj unit cost corresponding to A j (x j ). decomposition of A j. cost difference by bringing one unit of A j into bfs 0. zjzj <0 relative cost (on B ) Do these for each A j  B.

84 Choose Profitable Columns bfs 0 = x 0 obtained using B a basis cost of bfs 0 Aj  BAj  B want to enter the basis cjcj unit cost corresponding to A j (x j ). decomposition of A j. cost difference by bringing one unit of A j into bfs 0. zjzj <0 relative cost (on B ) Do these for each A j  B. Bringing  0 units of A j into changes bfs 0 to bfs 1 and changes the cost by the amount:

85 Choose Profitable Columns bfs 0 = x 0 obtained using B a basis cost of bfs 0 Aj  BAj  B want to enter the basis cjcj unit cost corresponding to A j (x j ). decomposition of A j. cost difference by bringing one unit of A j into bfs 0. zjzj <0 relative cost (on B ) Do these for each A j  B. Which one is most profitable if more than one are negative?

86 Relative Costs zjzj <0 relative cost (on B ) x1x1 x2x2 xnmxnm x n  m+1 xnxn c1c1 c2c2 cnmcnm c n  m+1 cncn c B =( c B (1), …, c B ( m ) ) ’ ` B The tableau...

87 Optimality Criterion zjzj <0 relative cost (on B ) relative cost vector the basis for the bfs, say x 0.

88 Optimality Criterion zjzj <0 relative cost (on B ) relative cost vector the basis for the bfs, say x 0. The bfs is optimal.

89 The Tableau  : the cost of a given x. <0

90 The Tableau <0 x1x1  xnmxnm x n  m+1 x n  m+2  xnxn  Ans a 11  a 1, n  m 10  00b1b1 a 21  a 2, n  m 01  00b2b2........................................... am1am1  a m, n  m 00  10bmbm c1c1  cnmcnm c n  m+1 c n  m+2  cncn 11 0

91 Assumption <0 x1x1  xnmxnm x n  m+1 x n  m+2  xnxn  Ans a 11  a 1, n  m 10  00b1b1 a 21  a 2, n  m 01  00b2b2........................................... am1am1  a m, n  m 00  10bmbm c1c1  cnmcnm c n  m+1 c n  m+2  cncn 11 0  0 Bfs x 0 = 0 0 b1b1 b2b2 bmbm …… Active Variables Inactive Variables

92 Initialization <0 x1x1  xnmxnm x n  m+1 x n  m+2  xnxn  Ans a 11  a 1, n  m 10  00b1b1 a 21  a 2, n  m 01  00b2b2........................................... am1am1  a m, n  m 00  10bmbm c1c1  cnmcnm c n  m+1 c n  m+2  cncn 11 0 Clear these columns Pivots Bfs x 0 = 0 0 b1b1 b2b2 bmbm

93 Initialization <0 x1x1  xnmxnm x n  m+1 x n  m+2  xnxn  Ans a 11  a 1, n  m 10  00b1b1 a 21  a 2, n  m 01  00b2b2........................................... am1am1  a m, n  m 00  10bmbm c1c1  cnmcnm c n  m+1 c n  m+2  cncn 11 0 c B(1) c B(2) cB(m)cB(m) R1R1 R2R2 RmRm R m+1 11 0...... Bfs x 0 = 0 0 b1b1 b2b2 bmbm

94 Initialization <0 x1x1  xnmxnm x n  m+1 x n  m+2  xnxn  Ans a 11  a 1, n  m 10  00b1b1 a 21  a 2, n  m 01  00b2b2........................................... am1am1  a m, n  m 00  10bmbm c1c1  cnmcnm c n  m+1 c n  m+2  cncn 11 0 c B(1) c B(2) cB(m)cB(m) R1R1 R2R2 RmRm R m+1 11 0 Bfs x 0 = 0 0 b1b1 b2b2 bmbm …… The negative of the cost of the initial bfs......

95 Initialization <0 x1x1  xnmxnm x n  m+1 x n  m+2  xnxn  Ans a 11  a 1, n  m 10  00b1b1 a 21  a 2, n  m 01  00b2b2........................................... am1am1  a m, n  m 00  10bmbm c1c1  cnmcnm c n  m+1 c n  m+2  cncn 11 0 c B(1) c B(2) cB(m)cB(m) R1R1 R2R2 RmRm R m+1 11 0 Bfs x 0 = 0 0 b1b1 b2b2 bmbm ……...... The negative of the cost of the initial bfs

96 Choosing a Pivot Column x1x1  xjxj  xnmxnm x n  m+1  xnm+jxnm+j  xnxn  Ans a 11  a1ja1j  a 1,n  m 1  0  00b1b1................................................. ai1ai1  a ij  ai,nmai,nm 0  1  00bibi................................................. am1am1  a mj  am,nmam,nm 0  0  10bmbm c1c1  cjcj  cnmcnm 0  0  0 11 00 <0 Bfs x 0 = 0 0 b1b1 bibi bmbm ……… 0 If all are positive, we are done. We usually choose the most negative column as the pivot column. But, this is not necessary the best. …

97 Choosing the Pivot x1x1  xjxj  xnmxnm x n  m+1  xnm+jxnm+j  xnxn  Ans a 11  a1ja1j  a 1,n  m 1  0  00b1b1................................................. ai1ai1  a ij  ai,nmai,nm 0  1  00bibi................................................. am1am1  a mj  am,nmam,nm 0  0  10bmbm c1c1  cjcj  cnmcnm 0  0  0 11 00 Bfs x 0 = 0 0 b1b1 bibi bmbm ……… 0 … Suppose that A j is the pivot column, and the pivot is in the i th row. For each row with a ij > 0, compute b i /a ij. Among them, choose the row with minimum b i /a ij as the pivot.  0 unit of A j will enter the basis.

98 Clear the Pivot Column x1x1  xjxj  xnmxnm x n  m+1  xnm+jxnm+j  xnxn  Ans a 11  a1ja1j  a 1,n  m 1  0  00b1b1................................................. ai1ai1  a ij  ai,nmai,nm 0  1  00bibi................................................. am1am1  a mj  am,nmam,nm 0  0  10bmbm c1c1  cjcj  cnmcnm 0  0  0 11 00 Bfs x 0 = 0 0 b1b1 bibi bmbm ……… 0 …  0 unit of A j will enter the basis. 1/a ij b i /a ij a i1 /a ij a i,n  m /a ij 1/a ij

99 Clear the Pivot Column x1x1  xjxj  xnmxnm x n  m+1  xnm+jxnm+j  xnxn  Ans a 11  a1ja1j  a 1,n  m 1  0  00b1b1................................................. ai1ai1  a ij  ai,nmai,nm 0  1  00bibi................................................. am1am1  a mj  am,nmam,nm 0  0  10bmbm c1c1  cjcj  cnmcnm 0  0  0 11 00 Bfs x 0 = 0 0 b1b1 bibi bmbm ……… 0 …  0 unit of A j will enter the basis. 1/a ij b i /a ij a i1 /a ij a i,n  m /a ij 1 RiRi 0 0 0  a 1j /a ij  a mj /a ij b 1  b i a 1j /a ij b m  b i a mj /a ij

100 Bfs 0  Bfs 1 x1x1  xjxj  xnmxnm x n  m+1  xnm+jxnm+j  xnxn  Ans a 11  a1ja1j  a 1,n  m 1  0  00b1b1................................................. ai1ai1  a ij  ai,nmai,nm 0  1  00bibi................................................. am1am1  a mj  am,nmam,nm 0  0  10bmbm c1c1  cjcj  cnmcnm 0  0  0 11 00 Bfs x 1 = 0 0 0 ………  0 unit of A j will enter the basis. 1/a ij b i /a ij a i1 /a ij a i,n  m /a ij 1 RiRi 0 0 0  a 1j /a ij  a mj /a ij b 1  b i a 1j /a ij b m  b i a mj /a ij b i /a ij b 1  b i a 1j /a ij b m  b i a mj /a ij …

101 Cost Improvement x1x1  xjxj  xnmxnm x n  m+1  xnm+jxnm+j  xnxn  Ans a 11  a1ja1j  a 1,n  m 1  0  00b1b1................................................. ai1ai1  a ij  ai,nmai,nm 0  1  00bibi................................................. am1am1  a mj  am,nmam,nm 0  0  10bmbm c1c1  cjcj  cnmcnm 0  0 11 00 Bfs x 1 = 0 0 b 1  b i a 1j /a ij 0 b m  b i a mj /a ij ………  0 unit of A j will enter the basis. 1/a ij b i /a ij a i1 /a ij a i,n  m /a ij 1 RiRi 0 0 0  a 1j /a ij  a mj /a ij b 1  b i a 1j /a ij b m  b i a mj /a ij b i /a ij Negative …

102 The Cost Column x1x1  xjxj  xnmxnm x n  m+1  xnm+jxnm+j  xnxn  Ans a 11  a1ja1j  a 1,n  m 1  0  00b1b1................................................. ai1ai1  a ij  ai,nmai,nm 0  1  00bibi................................................. am1am1  a mj  am,nmam,nm 0  0  10bmbm c1c1  cjcj  cnmcnm 0  0  0 11 00 useless

103 Example x1x1 x2x2 x3x3 x4x4 x5x5 Ans 1 3 4 3 5 2 2 1 5 1 1 1 0 1 0 0 0 1 0 1 1 1 1 1

104 Initialization x1x1 x2x2 x3x3 x4x4 x5x5 Ans 1 3 4 3 5 2 2 1 5 1 1 1 0 1 0 0 0 1 0 1 1 1 1 1 x1x1 x2x2 x3x3 x4x4 x5x5 0 1 1 1 1 1 1 2 3 3 2 11 2 11 3 1 0 0 0 1 0 0 0 1 R1 R2  R1 R3  R1

105 Initialization x1x1 x2x2 x3x3 x4x4 x5x5 Ans x1x1 x2x2 x3x3 x4x4 x5x5 0 1 1 1 1 1 1 2 3 3 2 11 2 11 3 1 0 0 0 1 0 0 0 1 66 33 33 0 0 0 1 2 3 3 2 11 2 11 3 1 0 0 0 1 0 0 0 1 B

106 x1x1 x2x2 x3x3 x4x4 x5x5 66 33 33 0 0 0 1 2 3 3 2 11 2 11 3 1 0 0 0 1 0 0 0 1 1/2 3/3 Choosing the Pivot

107 x1x1 x2x2 x3x3 x4x4 x5x5 Ans 66 33 33 0 0 0 1 2 3 3 2 11 2 11 3 1 0 0 0 1 0 0 0 1 Clear the Pivot Column x1x1 x2x2 x3x3 x4x4 x5x5 Ans  4.5 1.5 0 0 0 0.5 2.5 1.5 3.5  5.5 1 0 0 0.5  1.5 0 1 0 0 0 1

108 The Solution x1x1 x2x2 x3x3 x4x4 x5x5 Ans  4.5 1.5 0 0 0 0.5 2.5 1.5 3.5  5.5 1 0 0 0.5  1.5 0 1 0 0 0 1 x 2 = 0.5 x 4 = 2.5 x 5 = 1.5  = 4.5 0.52.5 1.5 00

109 Linear Programming Pivot Selection 大同大學資工所 智慧型多媒體研究室

110 The Pivot Selection Steepest descent – the aforementioned method Greatest decrement – compute for each and choose the most negative one. All-variable gradient x1x1  xjxj  xnmxnm x n  m+1  xnm+jxnm+j  xnxn Ans a 11  a1ja1j  a 1,n  m 1  0  0b1b1........................................... ai1ai1  a ij  ai,nmai,nm 0  1  0bibi........................................... am1am1  a mj  am,nmam,nm 0  0  1bmbm c1c1  cjcj  cnmcnm 0  0  0 00

111 All-Variable Gradient x1x1  xjxj  xnmxnm x n  m+1  xnm+jxnm+j  xnxn Ans a 11  a1ja1j  a 1,n  m 1  0  0b1b1........................................... ai1ai1  a ij  ai,nmai,nm 0  1  0bibi........................................... am1am1  a mj  am,nmam,nm 0  0  1bmbm c1c1  cjcj  cnmcnm 0  0  0 00 Bfs x 0 = 0 0 b1b1 bibi bmbm ……… 0 … Bfs x ’ = 0 0 0 ……… b i /a ij b 1  b i a 1j /a ij b m  b i a mj /a ij … x’  x0 =x’  x0 = 0 0 bibi ……… b i /a ij  b i a 1j /a ij  b i a mj /a ij … 00  a ij 1 a1ja1j  a mj  a ij /b i Cost change when bringing one unit of x j into the bfs. Compute this for each Choose the most negative one.

112 Linear Programming Anticycling Algorithm 大同大學資工所 智慧型多媒體研究室

113 Cycling x1x1 x2x2 x3x3 x4x4 x5x5 x6x6 x7x7 Ans x1x1 x2x2 x3x3 x4x4 x5x5 x6x6 x7x7

114 x1x1 x2x2 x3x3 x4x4 x5x5 x6x6 x7x7 Cycling x1x1 x2x2 x3x3 x4x4 x5x5 x6x6 x7x7 Ans

115 x1x1 x2x2 x3x3 x4x4 x5x5 x6x6 x7x7 x1x1 x2x2 x3x3 x4x4 x5x5 x6x6 x7x7 Cycling

116 x1x1 x2x2 x3x3 x4x4 x5x5 x6x6 x7x7 Ans x1x1 x2x2 x3x3 x4x4 x5x5 x6x6 x7x7 Cycling

117 x1x1 x2x2 x3x3 x4x4 x5x5 x6x6 x7x7 Ans x1x1 x2x2 x3x3 x4x4 x5x5 x6x6 x7x7 Cycling

118 x1x1 x2x2 x3x3 x4x4 x5x5 x6x6 x7x7 Ans x1x1 x2x2 x3x3 x4x4 x5x5 x6x6 x7x7 Cycling

119 Bland’s Anticycling Algorithm Suppose in the simplex algorithm we choose the column to enter basis by and row by Then, the algorithm terminates after a finite number of steps. choose the lowest numbered favorable column. choose the lowest numbered favorable column to leave the basis.

120 Linear Programming The Two-Phase Simplex Algorithm 大同大學資工所 智慧型多媒體研究室

121 Example x1x1 x2x2 x3x3 x4x4 x5x5 Ans 1 3 4 3 5 2 2 1 5 1 1 1 0 1 0 0 0 1 0 1 1 1 1 1 x1x1 x2x2 x3x3 x4x4 x5x5 0 1 1 1 1 1 1 2 3 3 2 11 2 11 3 1 0 0 0 1 0 0 0 1 R1 R2  R1 R3  R1 B Why?

122 LP in Canonical Form Minimize Subject to Minimize Subject to

123 LP in Canonical Form Minimize Subject to Bfs: How about if b i < 0 for some i ?

124 Example Subject to Minimize Subject to Minimize

125 Example Subject to Minimize The initial basic solution is infeasible.

126 Phase I Subject to Minimize x1x1 x2x2 x3x3 x4x4 x5x5 x6x6 Ans 11 11 0 0 1 22 1 0 1 0 0 0 0 1 0 0 0 0 1 0 11 11 11 1 11 22 1 0

127 x1x1 x2x2 x3x3 x4x4 x5x5 x6x6 Phase I x1x1 x2x2 x3x3 x4x4 x5x5 x6x6 Ans 11 11 0 0 1 22 1 0 1 0 0 0 0 1 0 0 0 0 1 0 11 11 11 1 11 22 1 0 x1x1 x2x2 x3x3 x4x4 x5x5 x6x6 0 1 1 11 3 2 3 22 1 0 0 0 11 11 11 1 0 0 1 0 0 1 0 0 1 2 3 22 most negative

128 x1x1 x2x2 x3x3 x4x4 x5x5 x6x6 Ans Phase I x1x1 x2x2 x3x3 x4x4 x5x5 x6x6 Ans x1x1 x2x2 x3x3 x4x4 x5x5 x6x6 0 1 1 11 3 2 3 22 1 0 0 0 11 11 11 1 0 0 1 0 0 1 0 0 1 2 3 22 0 1 1 11 1 0 0 0 1/3  2/3 11 2/3  1/3 0 1/3 0 0 1 0 0 1 0 0 4/3 2  4/3 1/3 2/2 3/3

129 x1x1 x2x2 x3x3 x4x4 x5x5 x6x6 Ansx1x1 x2x2 x3x3 x4x4 x5x5 x6x6 Phase I x1x1 x2x2 x3x3 x4x4 x5x5 x6x6 Ans 0 1 1 11 1 0 0 0 1/3  2/3 11 2/3  1/3 0 1/3 0 0 1 0 0 1 0 0 4/3 2  4/3 4/3 2 0 1 0 0 1 0 0 0 1/3  2/3  1/3 0 1/3 0 0 0 1 0 0 1 11 1 4/3 2/3 0

130 x1x1 x2x2 x3x3 x4x4 x5x5 x6x6 Ans Phase I 0 1 0 0 1 0 0 0 1/3  2/3  1/3 0 1/3 0 0 0 1 0 0 1 11 1 4/3 2/3 0 x 1 = 4/3 x 2 = 1/3 x 5 = 2/3 11 22 1

131 x1x1 x2x2 x3x3 x4x4 x5x5 x6x6 Ans Phase I 0 1 0 0 1 0 0 0 1/3  2/3  1/3 0 1/3 0 0 0 1 0 0 1 11 1 4/3 2/3 0 x 1 = 4/3 x 2 = 1/3 x 5 = 2/3 Discussion: In what condition, we can conclude the problem is infeasible?

132 x1x1 x2x2 x3x3 x4x4 x5x5 x6x6 Ans Phase II 0 1 0 0 1 0 0 0 1/3  2/3  1/3 0 1/3 0 0 0 1 0 0 1 11 1 4/3 2/3 0 x 1 = 4/3 x 2 = 1/3 x 5 = 2/3 x1x1 x2x2 x3x3 x4x4 x5x5 Ans 0 1 0 2 1 0 0 1 1/3  2/3  1/3 0 1/3 0 0 0 1 0 4/3 2/3 0

133 x1x1 x2x2 x3x3 x4x4 x5x5 Ansx1x1 x2x2 x3x3 x4x4 x5x5 Phase II x 1 = 4/3 x 2 = 1/3 x 5 = 2/3 x1x1 x2x2 x3x3 x4x4 x5x5 Ans 0 1 0 2 1 0 0 1 1/3  2/3  1/3 0 1/3 0 0 0 1 0 4/3 2/3 0 00110 0 1 0 1 0 0 1/3  2/3  1/3 1/3 0 0 1 4/3 2/3 33

134 x1x1 x2x2 x3x3 x4x4 x5x5 Ans Phase II x 1 = 4/3 x 2 = 1/3 x 5 = 2/3 00110 0 1 0 1 0 0 1/3  2/3  1/3 1/3 0 0 1 4/3 2/3 33 You can start the original simplex algorithm from here. In this example, it is now optimal.

135 Two-Phase Simplex Algorithm  LP in Standard Form Minimize Subject to Minimize Subject to Negate both sides if b i < 0. Therefore, we assume b i ’s are nonnegative. Phase I  must be zero if succeeded.

136 Two-Phase Simplex Algorithm  LP in Standard Form Minimize Subject to Minimize Subject to Phase II Start this phase if we find a bfs in Phsae I. Phase I  must be zero if succeeded.

137 Example Phase I

138 x1x1 x2x2 x3x3 x4x4 x5x5 x6x6 x7x7 x8x8 Ans 321001001 511100103 251010014 000001110

139 Phase I x1x1 x2x2 x3x3 x4x4 x5x5 x6x6 x7x7 x8x8 Ans 321001001 511100103 251010014 000001110 x1x1 x2x2 x3x3 x4x4 x5x5 x6x6 x7x7 x8x8 321001001 511100103 251010014  10 88 33 11 11 000 88

140 x1x1 x2x2 x3x3 x4x4 x5x5 x6x6 x7x7 x8x8 Ans 321001001 511100103 251010014  10 88 33 11 11 000 88 Phase I x1x1 x2x2 x3x3 x4x4 x5x5 x6x6 x7x7 x8x8 Ans 12/31/300 00 0  7/3  2/3 10  5/3 104/3 011/31/301  2/3 0110/3 0  4/3 1/3 11 11 10/300  14/3

141 Phase I x1x1 x2x2 x3x3 x4x4 x5x5 x6x6 x7x7 x8x8 Ans 12/31/300 00 0  7/3  2/3 10  5/3 104/3 011/31/301  2/3 0110/3 0  4/3 1/3 11 11 10/300  14/3 x1x1 x2x2 x3x3 x4x4 x5x5 x6x6 x7x7 x8x8 Ans 1.510.500 00 3.500.510  0.5 102.5  5.5 0  1.5 01  2.5 011.5 201 11 11 400 44

142 Phase I x1x1 x2x2 x3x3 x4x4 x5x5 x6x6 x7x7 x8x8 Ans 1.510.500 00 3.500.510  0.5 102.5  5.5 0  1.5 01  2.5 011.5 201 11 11 400 44 x1x1 x2x2 x3x3 x4x4 x5x5 x6x6 x7x7 x8x8 Ans 1.510.500 00 3.500.510  0.5 102.5  5.5 0  1.5 01  2.5 011.5 5.501.50 11 3.510  1.5

143 Phase I x1x1 x2x2 x3x3 x4x4 x5x5 x6x6 x7x7 x8x8 Ans 1.510.500 00 3.500.510  0.5 102.5  5.5 0  1.5 01  2.5 011.5 5.501.50 11 3.510  1.5 x1x1 x2x2 x3x3 x4x4 x5x5 x6x6 x7x7 x8x8 Ans 1.510.500 00 3.500.510  0.5 102.5  5.5 0  1.5 01  2.5 011.5 000001110

144 Phase II x1x1 x2x2 x3x3 x4x4 x5x5 x6x6 x7x7 x8x8 Ans 1.510.500 00 3.500.510  0.5 102.5  5.5 0  1.5 01  2.5 011.5 000001110 x1x1 x2x2 x3x3 x4x4 x5x5 Ans 1.510.500 3.500.5102.5  5.5 0  1.5 011.5 111110

145 Phase II x1x1 x2x2 x3x3 x4x4 x5x5 Ans 1.510.500 3.500.5102.5  5.5 0  1.5 011.5 111110 x1x1 x2x2 x3x3 x4x4 x5x5 Ans 1.510.500 3.500.5102.5  5.5 0  1.5 011.5 0 00  4.5

146 Phase II x1x1 x2x2 x3x3 x4x4 x5x5 Ans 1.510.500 3.500.5102.5  5.5 0  1.5 011.5 0 00  4.5 x 2 = 0.5 x 4 = 2.5 x 5 = 1.5 We now can enter the Phase II of the two-phase simplex algorithm. However, we are now already in optimum.


Download ppt "The Simplex Algorithm 虞台文 大同大學資工所 智慧型多媒體研究室. Content Basic Feasible Solutions The Geometry of Linear Programs Moving From Bfs to Bfs Organization of a."

Similar presentations


Ads by Google