Вы находитесь на странице: 1из 9

LECTURE 2

Solving linear programming problems: the Simplex Method (Chapter 4.1-4.8, 4.11-4.14, 6.2 )
Standard form of the LP-problem

3.1

All main constraints are equations. All variables are nonnegative. In general, the standard form of an LP-problem can be written in the following form:
n

max

z=
j=1 n

cj x j

s.t.
j=1

aij xj = bi , xj 0,

i = 1, . . . , m j = 1, . . . , n

This can be written in the following matrix form: max s.t. cT x Ax = b x0 where x = (x1 , . . . , xn )T , c = (c1 , . . . , cn )T , b = (b1 , . . . , bm )T , and A = [aij ] is an (m n) matrix. How to convert an LP to standard form 1. Constraint 2. Constraint aij xj bi aij xj bi aij xj + si = bi , si 0 aij xj si = bi , si 0

where si is called a slack variable. 3. xj 0 xnew = xj 0 j xj = x+ x , where x+ , x 0 j j j j

4. xj is unrestricted in sign, i.e. xj is a free variable

Example 7 Convert the following LP-problem to standard form: min s.t. z = 10x1 2x2 x1 + x2 10 x1 + x2 = 4 x2 2 x1 0, x2 urs(unrestricted in sign) 1

3.2

Basic solutions

Consider a system of linear equations Ax = b with m equations and n variables (assume n m). Denition 7 A basic solution to a system of linear equations Ax = b is obtained by setting n m variables equal to 0 and solving for the values of the remaining m variables. This assumes that setting the n m variables equal to 0 yields unique valuea for the remaining m variables or, equivalently, the columns for the remaining m variables are linearly independent. The variables that are set to zero are called nonbasic variables, and the remaining ones are called basic variables . If an LP in standard form has m constraints and n variables, then the maximal number of basic solutions is n m = n! (n m)!m!

Denition 8 Any basic solution in which all variables are nonnegative is a basic feasible solution. Otherwise, the basic solution is infeasible. Denition 9 A basic feasible solution is non-degenerate if all of its basic variables are positive. A basic feasible solution is degenerate if some of its basic variables are equal to zero. Theorem 3 A point in the feasible region of an LP-problem is an extreme point if and only if it is a basic feasible solution to the LP.

3.3

Change of basis

Denition 10 For any LP with m constraints, two basic feasible solutions are said to be adjacent if they have m 1 basic variables in common. Notice that The basic feasible solutions The extreme points, or corner points of its feasible region. Moving from one basic feasible solution to an adjacent basic feasible solution involves switching one variable from basic to nonbasic and vice versa for one other variable.

How can we improve the objective function value when a basic feasible solution is moved to an adjacent one? Example 8 max s.t. z = 30x1 + 20x2 2x1 + x2 100 x1 + x2 80 x1 x1 , x2 40 0

3.4

The simplex algorithm in tabular form

The standard form of Example 8: max s.t. z = 30x1 + 20x2 2x1 + x2 + s1 x1 + x2 x1 x1 , x2 , s1 , s2 , s3 0 Initialization: BV z s1 s2 s3 z 1 0 0 0 x1 30 2 1 1 x2 20 1 1 0 s1 0 1 0 0 s2 0 0 1 0 s3 0 0 0 1 b 0 100 80 40 + s2 = 100 = 80 + s3 = 40

Iteration 1: min{30, 20} = 30 Entering variable: x1 ; Search direction d1 = (1, 0, 2, 1, 1)T min{ 100 , 80 , 40 } = 40 (steplength t1 = 40) Leaving variable: s3 2 1 1 BV z s1 s2 x1 z 1 0 0 0 x1 0 0 0 1 x2 -20 1 1 0 s1 0 1 0 0 s2 0 0 1 0 s3 30 -2 -1 1 b 1200 20 40 40

Iteration 2 min{20} = 20 Entering variable: x2 ; Search direction d2 = (0,1,-1,-1,0)T min{ 20 , 40 , } = 20(steplength t2 = 20) Leaving variable: s1 1 1 BV z x2 s2 x1 z 1 0 0 0 x1 0 0 0 1 x2 0 1 0 0 s1 20 1 -1 0 s2 0 0 1 0 s3 -10 -2 1 1 b 1600 20 20 40

Iteration 3 min{10} = 10 Entering variable: s3 ; Search direction d3 = (1, 2, 0, 1, 1)T min{, 20 , 40 } = 20(steplength t3 = 20) Leaving variable: s2 1 1 BV z x2 s3 x1 z 1 0 0 0 x1 0 0 0 1 x2 0 1 0 0 s1 10 -1 -1 0 s2 10 2 1 -1 s3 0 0 1 0 b 1800 60 20 20

All nonbasic variables have non-negative coecients in row 0 (i.e. cj 0), stop! Optimal solution: x = (x , x )T = (20, 60)T , with z = 1800 1 2 Note that the coecient of a variable in row 0 is often referred to as the reduced cost. Summary of the Simplex Algorithm Step 0 Initialization Convert the LP to standard form and nd an initial basic feasible solution x(0) . Set k = 0 Step 1 Optimality test If the coecients of all nonbasic variables in row 0(denoted by cj , j) satisfy cj 0, j (for maximization problem) cj 0 j (for minimization problem) then the basic feasible solution x(k) is optimal. Otherwise, go to Step 2. The LP has alternative optimal solutions (multiple optimal solutions) if, at least, one of the nonbasic variable has a zero coecient in the optimal tableaus row 0.(In the absence of degeneracy) 4

Step 2 Determine the entering variable Choose the nonbasic variable xp that has cp = min {j | cj < 0} (for max problem) (i.e. the most negative coecient row 0) c
j

cp = max {j | cj > 0} (for min problem) (i.e. the most positive coecient in row 0) c
j

to enter the basis (break tie arbitrarily). Step 3 Determine the leaving variable Compute the ratio s i b b = min { | aip > 0} i asp aip

where i is the right-hand-side coecient of equation i and aip is the coecient of entering basic b variable xp in row i. Then the basic variable in row s is the leaving basic variable. Break tie arbitrarily. If the coecients aip < 0 for all i, then the LP is unbounded. Step 4 Determine the new basic feasible solution x(k+1) by Gaussian Elimination. Update k := k + 1 and go to Step 1 Example 9 Consider the following LP max s.t. z = 3x1 + 2x2 x1 4 2x2 12 3x1 + 2x2 18 x1 , x2 The standard form of the problem is: max s.t. z = 3x1 + 2x2 x 1 + s1 = 4 2x2 + s2 = 12 3x1 + 2x2 + s3 = 18 x1 , x2 , s1 , s2 , s3 0 The optimal solution of the problem is given in the following nal simplex tableau: BV z x1 s2 x2 z 1 0 0 0 x1 0 1 0 0 x2 0 0 0 1 s1 0 1 3 3 2 5 s2 0 0 1 0 s3 1 0 1
1 2

b 18 4 6 3

x = (x , x ) = (4, 3), 1 2

z = 18

This LP has alternative optimal solutions (multiple optimal solutions) since the coecient of nonbasic variable s1 is zero. What happens if we enter s1 into the basis? The resulting tableau is given in the following. BV z x1 s1 x2 z 1 0 0 0 x1 0 1 0 0 x2 0 0 0 1 s1 0 0 1 0 s2 0 1 3
1 3 1 2

s3 1
1 3

b 18 2 2 6

1 3 0

An alternative optimal solution: x = (x , x ) = (2, 6), 1 2

z = 18,

The optimal solutions of the LP can be written in the form x = (4, 3)T + (1 )(2, 6)T , where 0 1.

3.5
3.5.1 3.5.2

Determining the starting basic feasible solution


The big M method (Read Chapter 4.12 in the text book.) The Two-Phase Simplex Method(Chapter 4.13)

Example 10 min s.t. z = 2x1 + x2 + x3 2x1 x2 x3 1 2x1 + x2 5 x2 + x3 = 1 x1 , x2 , x3 0 The standard form of the problem is min s.t. z = 2x1 + x2 + x3 2x1 x2 x3 s1 2x1 + x2 x2 + x3 x1 , x2 , x3 , s1 , s2 0 =1 + s2 = 5 =1

To nd the starting basic feasible solution, we introduce articial variables a1 and a3 to the rst and the third constraints. The revised equations of the constraints become the following. 2x1 x2 x3 s1 2x1 + x2 x2 + x3 + s2 + a1 =1 =5 + a3 = 1

x1 , x2 , x3 , s1 , s2 , a1 , a3 0 Phase 1 : Minimizing the sum of the articial variables with revised constraints. Phase 1 problem: min s.t. w = a 1 + a3 2x1 x2 x3 s1 2x1 + x2 x2 + x3 + s2 (until a1 = a3 = 0) =1 =5 + a3 = 1

+ a1

x1 , x2 , x3 , s1 , s2 , a1 , a3 0 Solving the Phase 1 problem will result in one of the following two cases: 1. The optimal solution of the problem has value w = 0, (a1 = a3 = 0), then it is a basic feasible solution for the original problem. 2. The optimal solution of the problem has value w > 0, the original problem has no feasible solution. Notice that The Phase 1 problem is always a minimization problem no matter the original problem is a maximization or minimization problem. Phase 2: Drop the articial variables. Starting from the basic feasible solution obtained at the end of phase 1, use the simplex method to solve the original problem. Phase 2 problem: min s.t. z = 2x1 + x2 + x3 2x1 x2 x3 s1 2x1 + x2 x2 + x3 x1 , x2 , x3 , s1 , s2 0 Home work: Study the examples in Chapter 4.13 in the book and nd the optimal solution to this example. + s2 (original objective function) =1 =5 =1

3.6

The simplex tableau in matrix form (Chapter 6.2)

In general, the standard form of an LP-problem can be written in the following matrix form: max (or min) s.t. cT x Ax = b x0 where x = (x1 , . . . , xn )T , c = (c1 , . . . , cn )T , b = (b1 , . . . , bm )T , 0 = (0, . . . , 0)T and A = [aij ] is an (m n) matrix. Let x = (xB , xN )T , where xB is the vector of basic variables, and xN is the vector of nonbasic variables, A = (B | N), where matrix B consists of the columns of A corresponding to the basic variables, and matrix N consists of the columns of A corresponding to the nonbasic variables, c = (cB , cN )T , where cB is the vector of the objective function coecients for the corresponding basic variables in xB , and cN is the vector of the objective function coecients for the corresponding nonbasic variables in xN . The initial simplex tableau in matrix form can be written as follows. BV z xs z 1 0 xT B cT B B xT N cT N N xT s 0T I b 0 b

where xs be the vector of the slack variables. At any iteration, the simplex tableau in matrix form becomes BV z xB z 1 0 xT B 0T I xT N (cT B1 N cT ) B N B1 N xT s cT B1 B B1 b cT B1 b B B1 b

Notice that If xj is the slack variable in a constraint, then we should add a negative sign for the corresponding column in B1 .

Consider the following problem. Example 11 max s.t. z = 6x1 + x2 + 4x3 + 5x4 2x1 + x2 + x3 + x4 20 x1 x1 + 2x3 + x4 10 + x2 + x3 5

x1 , x2 , x3 , x4 0 Let x5 , x6 and x7 denote the slack variables for the respective constraints. After the simplex method is applied, a portion of the nal simplex tableau (optimal simplex tableau) is as follows. BV z x5 x4 x1 z 1 0 0 0 1 0 0 -1 1 0 -1 -1 1 x1 x2 x3 x4 x5 x6 x7 b

Identify the missing numbers in the simplex tableau, and indicate the optimal solution of the problem.

Вам также может понравиться