15
Linear Programming Design and Analysis of Algorithms Andrei Bulatov

Linear Programming - Simon Fraser University fileAlgorithms – Linear Programming 30-12 Simplex Method: Pivot Increase one of the basic variables that appears in the objective function

Embed Size (px)

Citation preview

Page 1: Linear Programming - Simon Fraser University fileAlgorithms – Linear Programming 30-12 Simplex Method: Pivot Increase one of the basic variables that appears in the objective function

Linear Programming

Design and Analysis of Algorithms

Andrei Bulatov

Page 2: Linear Programming - Simon Fraser University fileAlgorithms – Linear Programming 30-12 Simplex Method: Pivot Increase one of the basic variables that appears in the objective function

Algorithms – Linear Programming 30-2Algorithms – Linear Programming

Maximal Flow

u

v

s t

20

10 20

10

30

Page 3: Linear Programming - Simon Fraser University fileAlgorithms – Linear Programming 30-12 Simplex Method: Pivot Increase one of the basic variables that appears in the objective function

Algorithms – Linear Programming 30-3Algorithms – Linear Programming

Linear Programming

Linear Programming

InstanceObjective function z = c1x1 + c2x2 + ... + cnxn

Constraints:a11x1 + a12x2 + ... + a1nxn ≤ b1

a21x1 + a22x2 + ... + a2nxn ≤ b2

:am1x1 + am2x2 + ... + amnxn ≤ bm

Objective

Find values of the variables that satisfy all the constraints and maximize the objective function

Page 4: Linear Programming - Simon Fraser University fileAlgorithms – Linear Programming 30-12 Simplex Method: Pivot Increase one of the basic variables that appears in the objective function

Algorithms – Linear Programming 30-4Algorithms – Linear Programming

Example

Labor Clay Revenue

PRODUCT (hr/unit) (lb/unit) ($/unit)

Bowl 1 4 40

Mug 2 3 50

There are 40 hours of labor and 120 pounds of clay available each day

Decision variables

x1 = number of bowls to produce

x2 = number of mugs to produce

Page 5: Linear Programming - Simon Fraser University fileAlgorithms – Linear Programming 30-12 Simplex Method: Pivot Increase one of the basic variables that appears in the objective function

Algorithms – Linear Programming 30-5Algorithms – Linear Programming

Example

Maximize Z = $40 x1 + 50 x2

Subject to

x1 + 2x2 ≤ 40 hr (labor constraint)

4x1 + 3x2 ≤ 120 lb (clay constraint)

x1 , x2 ≥ 0

Solution is x1 = 24 bowls x2 = 8 mugs

Revenue = $1,360

Page 6: Linear Programming - Simon Fraser University fileAlgorithms – Linear Programming 30-12 Simplex Method: Pivot Increase one of the basic variables that appears in the objective function

Algorithms – Linear Programming 30-6Algorithms – Linear Programming

Example

4 x1 + 3 x2 ≤ 120

x1 + 2 x2 ≤ 40

Area common toboth constraints

50 –

40 –

30 –

20 –

10 –

0 – |

10|

60|

50|

20|

30|

40 x1

x2

growth of the goal function

optimum

Page 7: Linear Programming - Simon Fraser University fileAlgorithms – Linear Programming 30-12 Simplex Method: Pivot Increase one of the basic variables that appears in the objective function

Algorithms – Linear Programming 30-7Algorithms – Linear Programming

Fundamental Theorem

Convex set

A set (or region) is convex if, for any two points (say, x1 and x2) inthat set, the line segment joining these points lies entirely within theset.

A point is by definition convex.

Theorem (Extreme point or Simplex filter theorem)

If the maximum or minimum value of a linear function defined over a polygonal convex region exists, then it is to be found at the boundary of the region.

Page 8: Linear Programming - Simon Fraser University fileAlgorithms – Linear Programming 30-12 Simplex Method: Pivot Increase one of the basic variables that appears in the objective function

Algorithms – Linear Programming 30-8Algorithms – Linear Programming

Simplex Method

A finite number of extreme points implies a finite number of solutions

Hence, search is reduced to a finite set of points

However, a finite set can still be too large for practical purposes

Simplex method provides an efficient systematic search guaranteed toconverge in a finite number of steps.

Page 9: Linear Programming - Simon Fraser University fileAlgorithms – Linear Programming 30-12 Simplex Method: Pivot Increase one of the basic variables that appears in the objective function

Algorithms – Linear Programming 30-9Algorithms – Linear Programming

Simplex Method

1. Convert to slack form

2. Begin the search at an extreme point (i.e., a basic feasiblesolution).

3. Determine if the movement to an adjacent extreme can improve onthe optimization of the objective function. If not, the current solutionis optimal. If, however, improvement is possible, then proceed tothe next step.

4. Move to the adjacent extreme point which offers (or, perhaps,appears to offer) the most improvement in the objective function.

5. Continue steps 3 and 4 until the optimal solution is found or it canbe shown that the problem is either unbounded or infeasible.

Page 10: Linear Programming - Simon Fraser University fileAlgorithms – Linear Programming 30-12 Simplex Method: Pivot Increase one of the basic variables that appears in the objective function

Algorithms – Linear Programming 30-10Algorithms – Linear Programming

Simplex Method: Slack Form

maximize:

subject to:

The corresponding slack form is

321 23 xxx ++

0,,

3624

24522

303

321

321

321

321

≤++

≤++

≤++

xxx

xxx

xxx

xxx

3216

3215

3214

321

2436

52224

330

23

xxxx

xxxx

xxxx

xxxz

−−−=

−−−=

−−−=

++=

Page 11: Linear Programming - Simon Fraser University fileAlgorithms – Linear Programming 30-12 Simplex Method: Pivot Increase one of the basic variables that appears in the objective function

Algorithms – Linear Programming 30-11Algorithms – Linear Programming

Simplex Method: Basic Solution

We have

Variables on the right are

called basic

Variables on the left ---

nonbasic

Set basic variables to 0 and compute the nonbasic variables:

3216

3215

3214

321

2436

52224

330

23

xxxx

xxxx

xxxx

xxxz

−−−=

−−−=

−−−=

++=

0

)36,24,30,0,0,0(),,,,,( 654321

=

=

z

xxxxxx

Page 12: Linear Programming - Simon Fraser University fileAlgorithms – Linear Programming 30-12 Simplex Method: Pivot Increase one of the basic variables that appears in the objective function

Algorithms – Linear Programming 30-12Algorithms – Linear Programming

Simplex Method: Pivot

Increase one of the basic variables that appears in the objective function with nonnegative coefficient

can be increased to 9, that makes the last constraint tight

Solve that constraint for and substitute the solution into other constraints and the objective function

is entering variable

is leaving variable

1x

1x

4249 632

1

xxxx −−−=

24

2

36

42

5

4

321

4249

4

3

2427

63

25

6324

6321

632

xx

xx

xxxx

xxxx

xxxz

+−−=

+−−=

−−−=

−++=

1x

6x

Page 13: Linear Programming - Simon Fraser University fileAlgorithms – Linear Programming 30-12 Simplex Method: Pivot Increase one of the basic variables that appears in the objective function

Algorithms – Linear Programming 30-13Algorithms – Linear Programming

Simplex Method: Pivot

Repeat the procedure

can be increased to 3/2, that makes the last constraint tight3x

848

3

2

3 6523

xxxx +−−=

168

5

16

3

4

69

848

3

2

3

16

5

8164

33

16

11

8164

111

6524

6523

6521

652

xxxx

xxxx

xxxx

xxxz

−++=

+−−=

−+−=

−−+=

Page 14: Linear Programming - Simon Fraser University fileAlgorithms – Linear Programming 30-12 Simplex Method: Pivot Increase one of the basic variables that appears in the objective function

Algorithms – Linear Programming 30-14Algorithms – Linear Programming

Simplex Method: Pivot

Repeat the procedure again

can be increased to 4, that makes the second constraint tight2x

33

2

8

84 653

2

xxxx +−−=

2218

33

2

3

84

3668

3

2

6628

534

6532

6531

653

xxx

xxxx

xxxx

xxxz

+−=

+−−=

−++=

−−−=

Page 15: Linear Programming - Simon Fraser University fileAlgorithms – Linear Programming 30-12 Simplex Method: Pivot Increase one of the basic variables that appears in the objective function

Algorithms – Linear Programming 30-15Algorithms – Linear Programming

Simplex Method: Results

Lemma

The Pivot procedure creates a linear program equivalent to the original one

Lemma

Assuming that a slack form is such that the basic solution is feasible, Simplex either reports that a linear program is unbounded, or it terminates with a feasible solution that delivers a maximum to the objective function