chapter 3. linear programming - mypolyuweb.hk · the formulation of linear programming is...

12
Chapter 2. Linear Programming CHAPTER 2. LINEAR PROGRAMMING Page Contents 2.1 Problem Formulation 16 2.2 Two Dimensional Case – Graphical Method 18 2.3 Standard Form Model 19 2.4 The Simplex Method 19 Exercise 26 Objectives: After working through this chapter, you should be able to: (i) formulate a linear programming problem; (ii) solve a linear programming problem. 15

Upload: trantuong

Post on 24-Apr-2018

223 views

Category:

Documents


5 download

TRANSCRIPT

Chapter 2. Linear Programming

CHAPTER 2. LINEAR PROGRAMMING Page Contents 2.1 Problem Formulation 16 2.2 Two Dimensional Case – Graphical Method 18 2.3 Standard Form Model 19 2.4 The Simplex Method 19 Exercise 26 Objectives: After working through this chapter, you should be able to: (i) formulate a linear programming problem; (ii) solve a linear programming problem.

15

Chapter 2. Linear Programming

2.1.Problem Formulation

Linear programming deals with single objective such as maximizing total profit or minimizing total cost.

The formulation of linear programming is illustrated in the following

examples. Maximize / Minimize nn xcxcxcx +++= 22110 subject to

11 1 12 2 1 1

21 1 22 2 2 2

1 1 2 2

or or = or or =

or or =

n n

n n

m m mn n

a x a x a x ba x a x a x b

a x a x a x b

+ + + ≤ ≥+ + + ≤ ≥

+ + + ≤ ≥ m

0,,, 21 ≥nxxx … Illustrative examples: 1. Production model: A plastic factory produces three products. The production of

each type of product has to go through 2 to 3 operations as shown below: Time required per unit production (Min.) Operations

Capacity Operation Product 1 Product 2 Product 3 (Min./Day)

1 1 2 1 430 2 3 0 2 460 3 1 4 0 420

Profit/Unit($) 3 2 5 Problem: Determine the production schedule which will maximize the total profit of production. Let be the number of product j to be produced each day, j=1, 2, 3. jxObjective: Max x x x x0 1 23 2 5= + 3+ subject to

1 2 1 4303 0 2 4601 4 0 420

1 2 3

1 2 3

1 2 3

x x xx x xx x x

+ + ≤+ + ≤+ + ≤

x x x1 2 3 0, , ≥

16

Chapter 2. Linear Programming

2. Feed mix model: To formulate a broiler diet. Daily requirement is 100 kg. The diet must contain (a) at least 0.8% but not more than 1.2% calcium, (b) at least 22% protein, (c) at most 5% crude fiber. The main ingredient used including limestone, corn and soybean meal. The nutritive content of these ingredients is as follow:

Unit content per unit of ingredient Ingredient Calcium Protein Fiber Cost per kg Limestone 0.38 0 0 0.0164

Corn 0.001 0.09 0.02 0.0463 Soybean 0.002 0.50 0.08 0.1250

Problem: Determine the feed mix method that minimizes the daily cost of producing 100 kg diet while satisfying the nutritive requirements. Let be the amount in kg of ingredient j to be used in producing 100 kg of feed mix. (j=1 for limestone, j=2 for corn, j=3 for soybean meal)

x j

Objective: Min x x x0 1 20 0164 0 0463 0125= x3+ +. . . subject to

0 380 0 001 0 002 0 008 1000 380 0 001 0 002 0 012 100

0 09 05 0 22 1000 02 0 08 0 05 100

100

1 2 3

1 2 3

2 3

2 3

1 2 3

. . . .

. . . .. . .

. . .

x x xx x x

x xx xx x x

+ + ≥ ×+ + ≤ ×

+ ≥ ×+ ≤ ×+ + =

x x x1 2 3 0, , ≥

17

Chapter 2. Linear Programming

2.2.Two Dimensional Case – Graphical Method Max 210 34 xxx +=subject to

4252323632

21

2

21

21

≤+≤≤+−≤+

xxxxxxx

0, 21 ≥xx

Optimal solution occurs at the intersection of line 1 and line 4. Therefore, and occurs when

∗1x

∗2x

42632

21

21

=+=+

xxxx

That is, =1.5, =1 and ∗1x

∗2x ( ) ( ) 9135.140 =+=∗x .

If , optimal solution occurs at intersection of line 1 and line 2. Therefore, and occurs when

210 4xxx +=′

∗1x

∗2x

323632

21

21

=+−=+

xxxx

That is, =3/13, =24/13 and ∗1x

∗2x ( ) 1399132441330 =+=∗x .

Optimal solution: a corner point or a convex combinations of two corner points.

18

Chapter 2. Linear Programming

2.3.Standard Form Model Introduce slack variables { } S S S S1 2 3 4 0, , , ≥Max x x0 14 3= + x2

63

subject to

2 33 2

2 52 4

1 2 1

1 2 2

2 3

1 2 4

x x Sx x S

x Sx x S

+ + =− + + =

+ =+ + =

x x S S S S1 2 1 2 3 4 0, , , , , ≥ [ ][ ][ ][ ][ ][ ]

Corner point x x S S S Sabcde

1 2 1 2 3 4

0 0 6 3 5 42 0 2 9 5 0

15 1 0 55 3 03 13 24 13 0 0 17 13 22 13

0 15 15 0 2 2 5

. .

. . .

a) corner point solution for the model with 6 variables in 4 equations: set two variables equal to zero and then find the values of the other four ⇒ total number of possible corner points =15 6 4C

b) ignore any one with one or more negative values for the variables c) For those positive solution vectors, find out their values of x0

d) the one with the largest value in the required optimal solution 2.4.The Simplex Method Max 210 34 xxx +=subject to

4252323632

21

2

21

21

≤+≤≤+−≤+

xxxxxxx

0, 21 ≥xx Introduce slack variables { } S S S S1 2 3 4 0, , , ≥Max 210 34 xxx +=subject to

2 33 2

2 52 4

1 2 1

1 2 2

2 3

1 2 4

x x Sx x S

x Sx x S

+ + 63

=− + + =

+ =+ + =

x x S S S S1 2 1 2 3 4 0, , , , , ≥

19

Chapter 2. Linear Programming

Basic x0 x1 x2 S1 S2 S3 S4 Solution x0 1 -4 -3 0 0 0 0 0 S1 0 2 3 1 0 0 0 6 S2 0 -3 2 0 1 0 0 3 S3 0 0 2 0 0 1 0 5 S4 0 2 1 0 0 0 1 4

Optimality: ensure that no inferior solutions (relative to the current solution point) are ever encounter. ⇒ from the -equation, select the variable with the largest negative coefficient as the variable to enter into the basis.

x0

Feasibility: guarantee that starting with a basic feasible solution, only basic feasible solutions are encounter during computations. If , then x2 0= S1 6 2 3= =

S2 3 3 1= − = − (ignore) S3 5 0= = ∞ S4 4 2 2= = ← smallest positive ratio

∴ select as the leaving variable S4

i.e. to drop from the basis, is to be set equal to zero

S4 S4

If , S , then x2 0= 4 0= x1 2=S3 5= S2 9= S1 2= (a feasible basic solution)

If , S , then x2 0= 1 0= x1 3=S2 12= S3 5= S4 2= − (infeasible basic solution)

If , S , then (infeasible basic solution) x2 0= 2 0= x1 1= −

Basic x0 x1 x2 S1 S2 S3 S4 Solution x0 1 0 -1 0 0 0 2 8 S1 0 0 2 1 0 0 -1 2 S2 0 0 7/2 0 1 0 3/2 9 S3 0 0 2 0 0 1 0 5 x1 0 1 1/2 0 0 0 1/2 2 x0 1 0 0 1/2 0 0 3/2 9 x2 0 0 1 1/2 0 0 -1/2 1 S2 0 0 0 -7/4 1 0 13/4 11/2 S3 0 0 0 -1 0 1 1 3 x1 0 1 0 -1/4 0 0 3/4 3/2

20

Chapter 2. Linear Programming

x S S0 1 412

32

9+ + =

i.e. x S0 19 12

32

= − − S4 .

As all the coefficients in the -equation 0, optimal solution is reached. x0 ≥

The optimal solution is =9 when x0∗ x1

32

∗ = and . x2 1∗ =

Example: Max x x x x0 1 23 2 5= + + 3

3

subject to

420 44602 34302

21

31

321

≤+≤+≤++

xxxxxxx

x x x1 2 3 0, , ≥ Introduce slack variables . S S S1 2 3 0, , ≥Objective: Max x x x x0 1 23 2 5= + +subject to

+ S

+ S2

3

x x x Sx xx x

1 2 3 1

1 3

1 2

2 4303 2 460

4 420

+ + + =+ =

+ =

x x x1 2 3 0, , ≥ , S S S1 2 3 0, , ≥

Basic x0 x1 x2 x3 S1 S2 S3 Solution x0 1 -3 -2 -5 0 0 0 0 S1 0 1 2 1 1 0 0 430 S2 0 3 0 2 0 1 0 460 S3 0 1 4 0 0 0 1 420 x0 1 9/2 -2 0 0 5/2 0 1150

1S 0 -1/2 2 0 1 -1/2 0 200

3x 0 3/2 0 1 0 1/2 0 230 S3 0 1 4 0 0 0 1 420 x0 1 4 0 0 1 2 0 1350 x2 0 -1/4 1 0 1/2 -1/4 0 100

3x 0 3/2 0 1 0 1/2 0 230 S3 0 2 0 0 -2 1 1 20

As all the coefficients in the -row are non-negative, optimal solution is reached. It is =1350 when =0, =100 and =230.

x0

x0∗ x1

∗ x2∗ x3

21

Chapter 2. Linear Programming

Minimization Problem Example: Min x x0 14= + x2

6

subject to 3 3

4 32 3

1 2

1 2

1 2

x xx xx x

+ =+ ≥+ ≤

x x1 2 0, ≥ Introduce slack variables { } S S2 3 0, ≥Min x x0 14= + x2

6

R2

subject to

- =

3 34 3

2 3

1 2

1 2 2

1 2 3

x xx x Sx x S

+ =+ =+ +

x x S S1 2 2 3 0, , , ≥ 2.4.1. The M-technique Introduce artifical variables R R1 2 0, ≥Min x x x MR M0 1 2 14= + + + (M -- sufficiently large constant) subject to

3 34 3

2 3

1 2 1

1 2 2

1 2 3

x x Rx x Rx x S

+ +6

=+ ++ +

- S

2 =

=

x x S S R R1 2 2 3 1 2 0, , , , , ≥ Basic x0 x1 x2 S2 R1 R2 S3 Solution x0 1 -4 -1 0 -M -M 0 0 R1 0 3 1 0 1 0 0 3 R2 0 4 3 -1 0 1 0 6 S3 0 1 2 0 0 0 1 3 x0 1 7M-4 4M-1 -M 0 0 0 9M R1 0 3 1 0 1 0 0 3 R2 0 4 3 -1 0 1 0 6 S3 0 1 2 0 0 0 1 3

From the -row, select the variable with the most positive coefficient as entering variable.

x0

22

Chapter 2. Linear Programming

Basic x0 x1 x2 S2 R1 R2 S3 Solution x0 1 0 1 5M

3+ -M 4 7

3− M 0 0 4+2M

x1 0 1 1/3 0 1/3 0 0 1 R2 0 0 5/3 -1 -4/3 1 0 2 S3 0 0 5/3 0 -1/3 0 1 2 x0 1 0 0 1/5 8/5-M -1/5-M 0 18/5 x1 0 1 0 1/5 3/5 -1/5 0 3/5 x2 0 0 1 -3/5 -4/5 3/5 0 6/5 S3 0 0 0 1 1 -1 1 0 x0 1 0 0 0 7/5-M -M -1/5 18/5 x1 0 1 0 0 2/5 0 -1/5 3/5 x2 0 0 1 0 -1/5 0 3/5 6/5 S2 0 0 0 1 1 -1 1 0

As all the coefficients in the -row are negative, optimal solution is reached. It is x0

x0185

∗ = when x135

∗ = and x 652

∗ = . If all the coefficients in the -row are negative,

but with one or more >0, then the original problem has no feasible solution.

x0

RiUsing M-technique as M is very large, relative values of the original objective of and become inactive.

x1

x2

2.4.2. Two-Phase Technique Phase I Min r R R0 1= + 2

6

subject to 3 34 3

2 3

1 2 1

1 2 2

1 2 3

x x Rx x Rx x S

+ + =+ ++ +

- S

2 =

=

x x S S R R1 2 2 3 1 2 0, , , , , ≥

23

Chapter 2. Linear Programming

Basic x0 x1 x2 S2 R1 R2 S3 Solution r0 1 0 0 0 -1 -1 0 0 R1 0 3 1 0 1 0 0 3 R2 0 4 3 -1 0 1 0 6 S3 0 1 2 0 0 0 1 3 r0 1 7 4 -1 0 0 0 9 R1 0 3 1 0 1 0 0 3 R2 0 4 3 -1 0 1 0 6 S3 0 1 2 0 0 0 1 3 r0 1 0 5/3 -1 -7/3 0 0 2 x1 0 1 1/3 0 1/3 0 0 1 R2 0 0 5/3 -1 -4/3 1 0 2 S3 0 0 5/3 0 -1/3 0 1 2 r0 1 0 0 0 -1 -1 0 0 x1 0 1 0 1/5 3/5 -1/5 0 3/5 x2 0 0 1 -3/5 -4/5 3/5 0 6/5 S3 0 0 0 1 1 -1 1 0

As all coefficients in the -row r0 ≤0, optimal solution is reached. As =0, go to Phase II. r0

(If r 0, stop and conclude that the original problem has no feasible solution.) 0∗ ≠

Usage of Phase I: a) to check whether the original problem has a feasible solution space b) to locate a feasible basic solution to start the iterative searching We must minimize the sum of artificial variable no matter the original problem is a minimization or maximization problem. Phase II Replace the objective function by the original one. Start the iterative searching by using the optimal corner point solution of Phase I as the starting point of the searching process.

24

Chapter 2. Linear Programming

Basic x0 x1 x2 S2 R1 R2 S3 Solution x0 1 -4 -1 0 0 0 0 0 x1 0 1 0 1/5 3/5 -1/5 0 3/5 x2 0 0 1 -3/5 -4/5 3/5 0 6/5 S3 0 0 0 1 1 -1 1 0 x0 1 0 0 1/5 8/5 -1/5 0 18/5 x1 0 1 0 1/5 3/5 -1/5 0 3/5 x2 0 0 1 -3/5 -4/5 3/5 0 6/5 S3 0 0 0 1 1 -1 1 0 x0 1 0 0 0 7/5 0 -1/5 18/5 x1 0 1 0 0 2/5 0 -1/5 3/5 x2 0 0 1 0 -1/5 0 3/5 6/5 S2 0 0 0 1 1 -1 1 0

As all coefficients in -row 0, optimal solution is reached. It is x0 ≤ x0185

∗ = when

x135

∗ = and x265

∗ = .

25

Chapter 2. Linear Programming

26

EXERCISE: LINEAR PROGRAMMING 1. Solve the following problem by the simplex method:

Min 3210 23 xxxx −−= Subject to

1083412 42723

321

21

321

≤++−≤+−≤+−

xxxxx

xxx

0,, 321 ≥xxx

2. Solve the following problem using two-phase technique. Max 3210 765 xxxx ++−=Subject to

52010651535

321

321

321

=++≤+−≥−+

xxxxxxxxx

0,, 321 ≥xxx