Docsity

The Simplex Algorithm for Linear Programming: Maximization Problem - Prof. Cameron Thraen, Study notes of Agricultural engineering

Partial preview of the text

Download The Simplex Algorithm for Linear Programming: Maximization Problem - Prof. Cameron Thraen and more Study notes Agricultural engineering in PDF only on Docsity!

1

AEDEcon AEDEcon 702

702

Slide Slide

AED Economics 702: Computational Economics

Linear Programming: Finding a Solution

Linear Programming: Finding a Solution –

– An

An

Overview of the simplex method…Dakota

Overview of the simplex method…Dakota

Furniture Model.

Furniture Model.

Class Lecture notes IV (W&V Chapter 4).

2

AEDEcon AEDEcon 702

702

Slide Slide

The Simplex Algorithm (max LPs) The Simplex Algorithm (max LPs)

Consider the simplex algorithm applied to the maximization below Consider the simplex algorithm applied to the maximization below

The Dakota Furniture company manufactures desk, tables, andchairs. The manufacturer of each type of furniture requireslumber and two types of skilled labor: finishing and carpentry. Theamount of each resource needed to make each type of furniture isgiven in the table below.

Resource Resource

Desk Desk

Table Table

ChairChair

Lumber Lumber

8 board ft8 board ft

6 board ft6 board ft

1 board ft 1 board ft

Finishing hours Finishing hours

4 hours4 hours

2 hours2 hours

1.5 hours 1.5 hours

Carpentry hours Carpentry hours

2 hours2 hours

1.5 hours1.5 hours

0.5 hours 0.5 hours

4

AEDEcon AEDEcon 702

702

Slide Slide

4.3 4.

The Simplex Algorithm (max LPs)The Simplex Algorithm (max LPs)

Define:x

1

= number of desks produced

x

2

= number of tables produced

x

3

= number of chairs produced.

The LP is: max z = 60x

1

+ 30x

2

+ 20x

3

s.t.

8x

1

6x

2

x

3

(lumber constraint)

4x

1

2x

2

+ 1.5x

3

(finishing constraint)

2x

1

+ 1.5x

2

+ 0.5x

3

(carpentry constraint)

x

2

(table demand constraint)

x

1

, x

2

, x

3

5

AEDEcon AEDEcon 702

702

Slide Slide

4.3 4.

The Simplex Algorithm (max LPs) The Simplex Algorithm (max LPs)

Step 1 - Convert the LP to Standard Form

Canonical Form Canonical Form

BasicBasic

Variable Variable

Row 0 Row 0

z z

60x60x

1 1

  • –

30x 30x

22

20x 20x

3 3

= 0 = 0

z = 0z = 0

Row 1Row 1

8x 8x

11

6x

6x

22

x

x

33

  • s+ s

11

= 48 = 48

ss

1 1

= 48 = 48

Row 2Row 2

4x 4x

11

2x

2x

22

  • 1.5x+ 1.5x

33

  • s
  • s

22

= 20 = 20

ss

2 2

= 20 = 20

Row 3 Row 3

2x 2x

11

  • 1.5x+ 1.5x

22

  • 0.5x+ 0.5x

33

  • s
  • s

33

= 8 = 8

ss

3 3

= 8 = 8

Row 4 Row 4

xx

2 2

  • s
  • s

44

= 5 = 5

ss

4 4

= 5 = 5

If we set x

1

= x

2

= x

3

= 0, we can solve for the values s

1

, s

2

, s

3

, s

4

Thus, BV = {s

1

, s

2

, s

3

, s

4

} and NBV = {x

1

, x

2

, x

3

Since each constraint

is then in canonical form (BVs have a coefficient = 1 in one row and zeros inall other rows) with a nonnegative rhs, a bfs can be obtained by inspection.

7

AEDEcon AEDEcon 702

702

Slide Slide

4.3 4.

  • –

The Simplex Algorithm (max LPs) The Simplex Algorithm (max LPs)

Step 3

Step 3

Determine if the Current BFS is Optimal

Determine if the Current BFS is Optimal

Once we have obtained a bfs, we need to determine whether it is Once we have obtained a bfs, we need to determine whether it is

optimal. To do this, we try to determine if there is any way z optimal. To do this, we try to determine if there is any way z

can be can be

increased by increasing some nonbasic variable from its current increased by increasing some nonbasic variable from its current

value of zero while holding all other nonbasic variables at thei value of zero while holding all other nonbasic variables at thei

r r

current values of zero. Solving for z in row 0 yields: current values of zero. Solving for z in row 0 yields:

Z = 60x

1

  • 30x

2

  • 20x

3

For each nonbasic variable, we can use the equation above todetermine if increasing a nonbasic variable (while holding all othernonbasic variables to zero) will increase z. Increasing any of thenonbasic variables will cause an increase in z. However increasing x

1

causes the greatest rate of increase in z. If x

1

increases from its

current value of zero, it will have to become a basic variable. For thisreason, x

1

is called the entering variable. Observe x

1

has the most

negative coefficient in row 0.

8

AEDEcon AEDEcon 702

702

Slide Slide

4.3 4.

  • –

The Simplex Algorithm (max LPs) The Simplex Algorithm (max LPs)

The Ratio Test

The Ratio Test

When entering a variable into the

When entering a variable into the

basis

basis

, compute the ratio:

, compute the ratio:

rhs of row / coefficient of entering variable in row

rhs of row / coefficient of entering variable in row

for every constraint in which the entering variable has a

for every constraint in which the entering variable has a

positive coefficient.

positive coefficient.

The constraint with the smallest ratio is called the winner of

The constraint with the smallest ratio is called the winner of

the ratio test. The

the ratio test. The

smallest ratio

smallest ratio

is the largest value of the

is the largest value of the

entering variable that will keep all the current basic

entering variable that will keep all the current basic

variables nonnegative.

variables nonnegative.

10

AEDEcon AEDEcon 702

702

Slide Slide

The Simplex Algorithm (max LPs) The Simplex Algorithm (max LPs)

To make x To make x

1 1

a basic variable in row 3, we use a basic variable in row 3, we use

elementary row operations (ero elementary row operations (ero

’ ’

s) to make x s) to make x

11

have a coefficient of 1 in row 3 and a coefficient have a coefficient of 1 in row 3 and a coefficient

of 0 in all other rows. This procedure is called of 0 in all other rows. This procedure is called

pivoting on row 3; and row 3 is called the pivot pivoting on row 3; and row 3 is called the pivot

row. The final result is that x row. The final result is that x

1 1

replaces s replaces s

3 3

as the as the

basic variable for row 3. The term in the pivot basic variable for row 3. The term in the pivot

row that involves the entering basic variable is row that involves the entering basic variable is

called the pivot term. called the pivot term.

The Gauss The Gauss

Jordan method using ero Jordan method using ero

’ ’

s and simplex s and simplex

tableaus shown on the next slide makes x tableaus shown on the next slide makes x

1 1

a a

basic variable. (For review see Chapter 2) basic variable. (For review see Chapter 2)

11

AEDEcon AEDEcon 702

702

Slide Slide

ero 1

z

x

x

x

s

s

s

s

rhs

ero

0

1

1

8

6

1

1

48

2

4

2

1

20

3

1

4

row 3 divided by 1/

4

1

1

5

ero 2

z

x

x

x

s

s

s

s

rhs

0

1

15

30

240

60 times row 3 added to row 0

1

8

6

1

1

48

2

4

2

1

20

3

1

4

4

1

1

5

ero 3

z

x

x

x

s

s

s

s

rhs

0

1

15

30

240

1

1

16

  • 8 times row 3 added to row 1

2

4

2

1

20

3

1

4

4

1

1

5

ero 4

z

x

x

x

s

s

s

s

rhs

0

1

15

30

240

1

1

16

2

1

4

  • 4 times row 3 added to row 2

3

1

4

4

1

1

5

13

AEDEcon AEDEcon 702

702

Slide Slide

  • –

The Simplex Algorithm (max LPs) The Simplex Algorithm (max LPs)

Returning to Step 3, we attempt to determine if the current bfs Returning to Step 3, we attempt to determine if the current bfs

is optimal. is optimal.

Rearranging row 0 from Canonical Form 1, and solving for a yields:

z = 240 – 15x

+ 5x

–30 s

The current bfs is NOT optimal because increasing x

3

to 1

(while holding the other nonbasic variable to zero) willincrease the value of z. Making either x

2

or s

3

basic will

caused the value of z to decrease. Step 4 - Recall the rule for determining the entering variable isthe row 0 coefficient with the greatest negative value. Sincex

3

is the

only

variable with a negative coefficient, x

3

should be

entered into the basis.

14

AEDEcon AEDEcon 702

702

Slide Slide

The Simplex Algorithm (max LPs) The Simplex Algorithm (max LPs)

Begin iteration (pivot) 2 Begin iteration (pivot) 2Performing the ratio test using x Performing the ratio test using x

33

as the entering variable yields the as the entering variable yields the

following results (holding other NBVs to zero):following results (holding other NBVs to zero):

From row 1, s

1

0 for all values of x

3

since s

1

= 16 + x

3

From row 2, s

2

0 if x

3

From row 3, x

1

0 if x

3

From row 4, s

4

0 for all values of x

3

since s

4

This means to keep all the basic variables nonnegative, thelargest we can make x

1

is min {8,16} = 8. So, row 2 becomes the

pivot row.Step 5 - Now use ero’s, to make x

3

a basic variable in row 2.

16

AEDEcon AEDEcon 702

702

Slide Slide

The Simplex Algorithm (max LPs) The Simplex Algorithm (max LPs)

The result is:

The result is:

Canonical Form 2 Canonical Form 2

Basic Basic

Variable Variable

Row 0 Row 0

z

5x

z

5x

2 2

  • 10s
  • 10s

22

  • 10s
  • 10s

33

z = 280 z = 280

Row 1 Row 1

2x 2x

22

  • s
  • s

1 1

  • 2s+ 2s

2 2

8s8s

33

s s

1 1

Row 2 Row 2

2x 2x

22

x

x

3 3

  • 2s+ 2s

2 2

4s 4s

3 3

x x

3 3

Row 3 Row 3

x x

11

  • 1.25x+ 1.25x

22

0.5 s0.5 s

22

  • 1.5s
  • 1.5s

33

x x

1 1

Row 4 Row 4

x x

22

  • s+ s

4 4

s s

4 4

In Canonical Form 2,

BV = {z, s

1

, x

3

, x

1

, s

4

} and NBV = {s

3

, s

2

, x

2

yielding the bfs z = 280, s

1

= 24, x

3

= 8, x

1

= 2, s

4

= 5, s

2

= s

3

= x

2

17

AEDEcon AEDEcon 702

702

Slide Slide

The Simplex Algorithm (max LPs)The Simplex Algorithm (max LPs)

Z = 280 - 5x

2

  • 10s

2

-10s

3

Solving for z in row 0 yields:

We can see that increasing x2, s2, or s3 (while holding the otherNBVs to zero) will not cause the value of z to increase. Thesolution at the end of iteration 2 is therefore the optimal basicfeasible solution. The following rule can be applied to determinewhether a canonical form’s bfs is optimal:

A canonical form is optimal (for a max problem) if eachnonbasic variable has a nonnegative coefficient in thecanonical form’s row 0.

Row 0

Row 0

z

5x

+ 10s

+ 10s

z

5x

+ 10s

+ 10s

z = 280

z = 280

19

AEDEcon AEDEcon 702

702

Slide Slide

The Simplex Algorithm (min LPs) The Simplex Algorithm (min LPs)

The optimal solution (to the max problem) is The optimal solution (to the max problem) is

z = 12, x z = 12, x

22

= 4, s = 4, s

22

= 10, x = 10, x

11

= s= s

1 1

= 0. Then the optimal solution to the min problem is z = = 0. Then the optimal solution to the min problem is z =

12, x 12, x

2 2

=4, s =4, s

2 2

10, x 10, x

1 1

= s= s

2 2

= 0. The min LP objective function confirms this: z = 2x = 0. The min LP objective function confirms this: z = 2x

11

3x 3x

2 2

In summary, multiply the objective function for themin problem by -1 and solve the problem as a maximization

problem with the objective function

–z. The optimal solution to the max problem will giveyou the optimal solution for to the min problem.Remember that (optimal z-value for the min problem)= - (optimal z-value for the max problem).

20

AEDEcon AEDEcon 702

702

Slide Slide

Unbounded LPs Unbounded LPs

For some LPs, there exist points in the feasible For some LPs, there exist points in the feasible

region for which z assumes arbitrarily large (in region for which z assumes arbitrarily large (in

max problems) or arbitrarily small (in min max problems) or arbitrarily small (in min

problems) values. When this occurs, we say the problems) values. When this occurs, we say the

LP is unbounded. LP is unbounded.

An unbounded LP occurs in a max problem if there An unbounded LP occurs in a max problem if there

is a nonbasic variable with a negative coefficient is a nonbasic variable with a negative coefficient

in row 0 and there is no constraint that limits how in row 0 and there is no constraint that limits how

large we can make this NBV. large we can make this NBV.

Specifically, an unbounded LP for a max problemoccurs when a variable with a negative coefficient inrow 0 has a non positive coefficient in each constraint