An Introduction to Linear Programming (LP)academic.udayton.edu/charlesebeling/MSC521/PDF_PPT...

47
How to optimally allocate scarce resources! 1 An Introduction to Linear Programming (LP) Please hold your applause until the end.

Transcript of An Introduction to Linear Programming (LP)academic.udayton.edu/charlesebeling/MSC521/PDF_PPT...

Page 1: An Introduction to Linear Programming (LP)academic.udayton.edu/charlesebeling/MSC521/PDF_PPT Files/Intro to... · The Graphical Solution LP Defined Application and Examples Solving

How to optimally allocate scarce resources!

1

An Introduction to Linear Programming

(LP)

Please hold your applause until the end.

Page 2: An Introduction to Linear Programming (LP)academic.udayton.edu/charlesebeling/MSC521/PDF_PPT Files/Intro to... · The Graphical Solution LP Defined Application and Examples Solving

What is a Linear Programming

2

A linear program (LP) is an optimization problem consisting

of a function to be maximized or minimized subject to one or

more limitations (called constraints) on the variables of the

function.

Both the optimization function (called the objective function)

and the constraints have only linear relationships.

Page 3: An Introduction to Linear Programming (LP)academic.udayton.edu/charlesebeling/MSC521/PDF_PPT Files/Intro to... · The Graphical Solution LP Defined Application and Examples Solving

George Dantzig

Inventor of linear programming and the simplex algorithm

3

In 1947 Dantzig made the contribution to

mathematics for which he is most famous, the

simplex method of optimisation. It grew out of

his work with the U.S. Air Force known as

"programming", a military term that, at that

time, referred to plans or schedules for

training, logistical supply or deployment of

men. Dantzig mechanised the planning process

by introducing "programming in a linear

structure" Born: 8 Nov 1914

Died: 13 May 2005

Page 4: An Introduction to Linear Programming (LP)academic.udayton.edu/charlesebeling/MSC521/PDF_PPT Files/Intro to... · The Graphical Solution LP Defined Application and Examples Solving

The Road Ahead

4

Example LP

The Graphical Solution

LP Defined

Application and Examples

Solving a LP

The Computer Way

The Algebraic Way

The Simplex Way

Page 5: An Introduction to Linear Programming (LP)academic.udayton.edu/charlesebeling/MSC521/PDF_PPT Files/Intro to... · The Graphical Solution LP Defined Application and Examples Solving

Our Very First Example

5

The Opti Mize Company manufactures two products that compete

for the same (limited) resources. Relevant information is:

Product A B Available resources

Labor-hrs/unit 1 2 20 hrs/day

Machine hrs/unit 2 2 30 hrs/day

Cost/unit $6 $20 $180/day

Profit/unit $5 $15

Page 6: An Introduction to Linear Programming (LP)academic.udayton.edu/charlesebeling/MSC521/PDF_PPT Files/Intro to... · The Graphical Solution LP Defined Application and Examples Solving

The Model

6

Let X = number of units of product A to manufacture

Y = number of units of product B to manufacture

Max Profit = z = 5 X + 15 Y

subject to:

X + 2 Y <= 20 (labor-hours)

2 X + 2 Y <= 30 (machine hours)

6 X + 20Y <= 180 ($ - budget)

X >= 0, Y >= 0

Page 7: An Introduction to Linear Programming (LP)academic.udayton.edu/charlesebeling/MSC521/PDF_PPT Files/Intro to... · The Graphical Solution LP Defined Application and Examples Solving

The Graphical Solution

7

X

Y

5 10 15 25 20 30

5

10

20

15

X + 2 Y = 20

Page 8: An Introduction to Linear Programming (LP)academic.udayton.edu/charlesebeling/MSC521/PDF_PPT Files/Intro to... · The Graphical Solution LP Defined Application and Examples Solving

The Graphical Solution

8

X

Y

5 10 15 25 20 30

5

10

20

15

X + 2 Y = 20

9

6X + 20Y = 180

Page 9: An Introduction to Linear Programming (LP)academic.udayton.edu/charlesebeling/MSC521/PDF_PPT Files/Intro to... · The Graphical Solution LP Defined Application and Examples Solving

The Graphical Solution

9

X

Y

5 10 15 25 20 30

5

10

20

15

X + 2 Y = 20

2X + 2Y = 30

9

6X + 20Y = 180

Page 10: An Introduction to Linear Programming (LP)academic.udayton.edu/charlesebeling/MSC521/PDF_PPT Files/Intro to... · The Graphical Solution LP Defined Application and Examples Solving

The Graphical Solution

10

X

Y

5 10 15 25 20 30

5

10

20

15

X + 2 Y = 20

2X + 2Y = 30

9

6X + 20Y = 180

The feasible region

Page 11: An Introduction to Linear Programming (LP)academic.udayton.edu/charlesebeling/MSC521/PDF_PPT Files/Intro to... · The Graphical Solution LP Defined Application and Examples Solving

The Graphical Solution (continued)

11

X

Y

5 10 15 25 20 30

10

20

15

9 Z = 5X + 15Y = 30

2

6

Page 12: An Introduction to Linear Programming (LP)academic.udayton.edu/charlesebeling/MSC521/PDF_PPT Files/Intro to... · The Graphical Solution LP Defined Application and Examples Solving

The Graphical Solution (continued)

12

X

Y

5 10 15 25 20 30

10

20

15

9 Z = 5X + 15Y = 30

2

6

4

Z = 5X + 15Y = 60

12

Page 13: An Introduction to Linear Programming (LP)academic.udayton.edu/charlesebeling/MSC521/PDF_PPT Files/Intro to... · The Graphical Solution LP Defined Application and Examples Solving

The Graphical Solution (continued)

13

X

Y

5 10 15 25 20 30

10

20

15

9 Z = 5X + 15Y = 30

2

6

4

Z = 5X + 15Y = 60

12

(5, 7.5)

Z = 5 (5) + 15 (7.5) = 137.5

Page 14: An Introduction to Linear Programming (LP)academic.udayton.edu/charlesebeling/MSC521/PDF_PPT Files/Intro to... · The Graphical Solution LP Defined Application and Examples Solving

The Graphical Solution

Alternate Approach

14

X

Y

5 10 15 25 20 30

5

10

20

15

9

(x = 5, y = 7.5; z = 137.5)

(x = 10, y = 5; z = 125)

Z = 5X + 15Y

(x = 15, y = 0; z = 75) (x = 0, y = 9; z = 135)

(x = 0, y = 0; z = 0)

Page 15: An Introduction to Linear Programming (LP)academic.udayton.edu/charlesebeling/MSC521/PDF_PPT Files/Intro to... · The Graphical Solution LP Defined Application and Examples Solving

15

This is powerful stuff!

Can we see another

example followed by a

description of the

general model?

Sure can ……..

Page 16: An Introduction to Linear Programming (LP)academic.udayton.edu/charlesebeling/MSC521/PDF_PPT Files/Intro to... · The Graphical Solution LP Defined Application and Examples Solving

A Minimization Problem

16

The Classical Diet Problem

Page 17: An Introduction to Linear Programming (LP)academic.udayton.edu/charlesebeling/MSC521/PDF_PPT Files/Intro to... · The Graphical Solution LP Defined Application and Examples Solving

The Problem

17

Mr. U. R. Fatte has been placed on a diet by his Doctor (Dr. Ima

Quack) consisting of the foods shown below. The doctor warned

him to insure proper consumption of nutrients to sustain life.

Relevant information is:

Nutrients Beer Pizza Monthly Requirement

Vitamin A 2 mg/oz 3 mg/oz 3500 mg (min rqmt)

Protein 6 mg/oz 2 mg/oz 7000 mg (min rqmt)

Fat 4g/oz 2g/oz 8000 grams (max rqmt)

cost/oz $0.50 $0.20

Page 18: An Introduction to Linear Programming (LP)academic.udayton.edu/charlesebeling/MSC521/PDF_PPT Files/Intro to... · The Graphical Solution LP Defined Application and Examples Solving

The Mathematical Model

18

Let X = ounces of beer consumed per week

Y = ounces of pizza consumed per week

Min cost = z = 0.5X + 0.2Y

subject to:

2X + 3Y >= 3500

6X + 2Y >= 7000

4X + 2Y <= 8000

X, Y >= 0

Page 19: An Introduction to Linear Programming (LP)academic.udayton.edu/charlesebeling/MSC521/PDF_PPT Files/Intro to... · The Graphical Solution LP Defined Application and Examples Solving

The Boundary Equations

19

X

Y

1000

3000

2000

3000 2000

1000

4000 6x + 2y = 7,000

2x + 3y = 3,500

4x + 2y = 8,000

2X + 3Y >= 3500

6X + 2Y >= 7000

4X + 2Y <= 8000

Page 20: An Introduction to Linear Programming (LP)academic.udayton.edu/charlesebeling/MSC521/PDF_PPT Files/Intro to... · The Graphical Solution LP Defined Application and Examples Solving

Feasible Region

20

X

Y

1000

3000

2000

3000 2000

1000

4000

Page 21: An Introduction to Linear Programming (LP)academic.udayton.edu/charlesebeling/MSC521/PDF_PPT Files/Intro to... · The Graphical Solution LP Defined Application and Examples Solving

Feasible Region with Objective Function

21

X

Y

1000

3000

2000

3000 2000

1000

4000 z = .5X + .2Y

z = .5X + .2Y = $800

(0,4000) and (1600,0)

Page 22: An Introduction to Linear Programming (LP)academic.udayton.edu/charlesebeling/MSC521/PDF_PPT Files/Intro to... · The Graphical Solution LP Defined Application and Examples Solving

Optimal Solution

22

X

Y

1000

3000

2000

3000 2000

1000

4000

6 2 7,000

2 3 3,500

6 2 7,000

6 9 10,500

7 3,500 * 500

7,000 2* 1,000

6

* .5 .2 $600

x y

x y

x y

x y

y or y

yx

z x y

Page 23: An Introduction to Linear Programming (LP)academic.udayton.edu/charlesebeling/MSC521/PDF_PPT Files/Intro to... · The Graphical Solution LP Defined Application and Examples Solving

Optimal Solution – alternate approach

23

X

Y

1000

3000

2000

3000 2000

1000

4000

(x = 0, y = 4000, z = $800)

(x = 0, y = 3500, z = $700)

(x = 1000, y = 500, z = $600)

(x =2000, y = 0, z = $1,000)

(x = 1,750, y = 0, z = $875)

z = .5X + .2Y

Page 24: An Introduction to Linear Programming (LP)academic.udayton.edu/charlesebeling/MSC521/PDF_PPT Files/Intro to... · The Graphical Solution LP Defined Application and Examples Solving

Surgeon General’s Warning

24

The minimum cost diet found in solving this problem is illustrative only. One should not attempt to

follow this diet for any prolonged period of time.

Page 25: An Introduction to Linear Programming (LP)academic.udayton.edu/charlesebeling/MSC521/PDF_PPT Files/Intro to... · The Graphical Solution LP Defined Application and Examples Solving

The General Diet Problem

25

Minimize the "cost of the menu" subject to the nutrition requirements: eat enough but not too much of Vitamin A . . eat enough but not too much Vitamin C

Eat at least a certain minimum number of servings of beef but not more than the maximum number of servings of beef you want. . .

Eat at least a certain minimum number of servings of carrots but not more than the maximum number of servings of carrots you want…

Special student exercise: solve the diet problem found on

The supplement homework list of the course website!

Page 26: An Introduction to Linear Programming (LP)academic.udayton.edu/charlesebeling/MSC521/PDF_PPT Files/Intro to... · The Graphical Solution LP Defined Application and Examples Solving

The General LP Model

26

Max or Min z = c1 x1 + c2x2 + . . . + cnxn

subject to:

A11x1 + A12x2 + . . . + A1nxn <= b1

A21 x1 + A22x2 + . . . + A2nxn <= b2

.

.

Am1x1 + Am2x2 + . . . + Amnxn <= bm

x1, x2, . . . xn >= 0

Objective

Function

Constraints

xj = decision variables or activity levels

cj = profit or cost coefficient

Aij = technology coefficient

bi = resource capacities (right hand side values)

Page 27: An Introduction to Linear Programming (LP)academic.udayton.edu/charlesebeling/MSC521/PDF_PPT Files/Intro to... · The Graphical Solution LP Defined Application and Examples Solving

Assumptions

27

Deterministic

all input data (parameters) are known and constant

no statistical uncertainty

Linear

cost or profit is additive and proportional to the

activity levels

output or resources consumed are additive and

proportional to the activity levels

Non-integer

variables (activity levels) are continuous

Page 28: An Introduction to Linear Programming (LP)academic.udayton.edu/charlesebeling/MSC521/PDF_PPT Files/Intro to... · The Graphical Solution LP Defined Application and Examples Solving

Solution Procedures

28

Graphical

two or three variables only

Algebraic

solve systems of equations for corner points

Simplex algorithm

numerical, iterative approach

Ellipsoid

theoretical importance more than applied

Page 29: An Introduction to Linear Programming (LP)academic.udayton.edu/charlesebeling/MSC521/PDF_PPT Files/Intro to... · The Graphical Solution LP Defined Application and Examples Solving

29

Can we see

more examples

of this LP thing?

Please!!!!!

Let’s do it.

Page 30: An Introduction to Linear Programming (LP)academic.udayton.edu/charlesebeling/MSC521/PDF_PPT Files/Intro to... · The Graphical Solution LP Defined Application and Examples Solving

A Blending Problem

30

The B. A. Nutt Company sells mixed nuts of two quality levels.

The expensive mix should not contain more than 25% peanuts

nor less than 40% cashews. The cheap mix should not have more

than 60% peanuts and no less than 20% cashews. Cashews cost 50

cents a pound and peanuts cost 20 cents a pound. The expensive

mix sells for 80 cents a pound and the cheap mix for 40 cents a

pound. What should the blend of each mix be in order to maximize

profit. The company has $100 a day with which to purchase

nuts.

Page 31: An Introduction to Linear Programming (LP)academic.udayton.edu/charlesebeling/MSC521/PDF_PPT Files/Intro to... · The Graphical Solution LP Defined Application and Examples Solving

The Model

31

Let x1 = pounds of cashews in expensive mix

x2 = pounds of peanuts in expensive mix

y1 = pounds of cashews in cheap mix

y2 = pounds of peanuts in cheap mix

Max z = .80 (x1 + x2) + .40 (y1 + y2) - .5(x1+y1) - .2(x2 + y2)

subject to:

.5 (x1 + y1) +.2(x2 + y2 ) <= 100

x2 / (x1+x2) <= .25 y2/(y1 + y2) <= .6

x1 / (x1+x2) >= .40 y1/(y1 + y2) >= .20

Page 32: An Introduction to Linear Programming (LP)academic.udayton.edu/charlesebeling/MSC521/PDF_PPT Files/Intro to... · The Graphical Solution LP Defined Application and Examples Solving

Re-formulate the Model

32

Max z = = .3x1 + .6x2 -.1y1 + .2y2

subject to:

.5x1 +.2x2 +.5y1 +.2 y2 <= 100

-.25x1 + .75x2 <= 0

-.60y1 + .40y2 <= 0

.60x1 - .40x2 >= 0

.80y1 - .20y2 >= 0

Page 33: An Introduction to Linear Programming (LP)academic.udayton.edu/charlesebeling/MSC521/PDF_PPT Files/Intro to... · The Graphical Solution LP Defined Application and Examples Solving

A Marketing Example

33

The I. B. Adman Advertising Company is planning a large media blitz

covering television, radio, and magazines to sell management science

to the public. The company’s objective is to reach as many people as

possible. Results of a market survey show:

Television

Day time Prime Time Radio Magazines

cost per unit $40,000 75,000 30,000 15,000

# people 400,000 900,000 500,000 200,000

# business 300,000 400,000 200,000 100,000

The company has a budget of $800,000 to spend on the campaign. It

requires at least two million exposures among the business community.

Television must be limited to $500,000, and at least 3 units of day time and

2 units of prime time must be purchased. Advertising units on both radio and

magazines should be between 5 and 10.

Page 34: An Introduction to Linear Programming (LP)academic.udayton.edu/charlesebeling/MSC521/PDF_PPT Files/Intro to... · The Graphical Solution LP Defined Application and Examples Solving

The Model

34

Let x1, x2, x3, and x4 be the number of advertising units

bought in daytime TV, primetime TV, radio and magazines.

Max z = 400x1 + 900x2 + 500x3 + 200x4 (in thousands)

subject to:

40,000x1 + 75,000x2 + 30,000x3 + 15,000x4 <= 800,000

300,000x1 + 400,000x2 + 200,000x3 + 100,000x4 >= 2,000,000

40,000x1 + 75,000x2 <= 500,000

x1 >= 3; x2 >= 2; 5 <= x3 <= 10; 5 <= x4 <= 10

Page 35: An Introduction to Linear Programming (LP)academic.udayton.edu/charlesebeling/MSC521/PDF_PPT Files/Intro to... · The Graphical Solution LP Defined Application and Examples Solving

35

The Transportation Problem

A company manufactures a single product at

each of m factories. Factory i has a capacity of

Si per month. There are n warehouses receiving

this product. The demand at warehouse j is Dj.

It cost factory i, cij dollars to ship one unit to

warehouse j. How many units should each factory

send to each warehouse in order to minimize the

total transportation costs?

This is a really neat problem.

Page 36: An Introduction to Linear Programming (LP)academic.udayton.edu/charlesebeling/MSC521/PDF_PPT Files/Intro to... · The Graphical Solution LP Defined Application and Examples Solving

36

The LP Formulation

Min z c x

subject to

x S i m

x D j n

x

ij ij

j

n

i

m

ij

j

n

i

ij j

i

m

ij

11

1

1

1 2

1 2

0

:

, ,...,

, ,...,

Let xij = the number of units sent from factory i to warehouse j

Page 37: An Introduction to Linear Programming (LP)academic.udayton.edu/charlesebeling/MSC521/PDF_PPT Files/Intro to... · The Graphical Solution LP Defined Application and Examples Solving

Job-Training

37

The Never-Say-Die Life Insurance Company hires and

trains a large number of salespersons each month to replace

those who have departed. Trained salespersons must be used

to train new salespersons. Training takes one month and there

is a 20 percent attrition rate by the end of the month. While a

salesperson is training a new employee, that person cannot be

used in the field selling insurance. The monthly demand for

experienced salespeople is:

Month Demand (in the field)

January 100

February 150

March 200

April 225

May 175

Trainees receive $400 per month while it costs the company $850 per

month for an experienced salesperson. Ten percent of all experienced

salespeople will leave the company by the end of each month.

Page 38: An Introduction to Linear Programming (LP)academic.udayton.edu/charlesebeling/MSC521/PDF_PPT Files/Intro to... · The Graphical Solution LP Defined Application and Examples Solving

The Model

38

Let xi = the number of trainees during month i

yi = the number of experienced salespeople in month i

Min z = 1250 (x1 + x2 + x3 + x4 + x5)

subj to: y1 - x1 >= 100

y2 - x2 >= 150

y3 - x3 >= 200

y4 - x4 >= 225

y5 - x5 >= 175

yi = .9yi-1 + .8xi-1 for i = 1, 2, 3, 4, 5

example: yfeb = .9 yjan + .8xjan

Page 39: An Introduction to Linear Programming (LP)academic.udayton.edu/charlesebeling/MSC521/PDF_PPT Files/Intro to... · The Graphical Solution LP Defined Application and Examples Solving

A Large Department Store Somewhere in

the Midwest

Problem Set 2.3F 6

Store operates 7 days a week

Min number of salespersons required is 12 for Mon., 18 for Tues.,

20 for Wed., 28 for Thurs., 32 for Fri., 40 for Sat. and Sun.

Each salesperson works 5 days a week with 2 consecutive days off

What is the minimum number of salespersons and how should

their days off be allocated?

Page 40: An Introduction to Linear Programming (LP)academic.udayton.edu/charlesebeling/MSC521/PDF_PPT Files/Intro to... · The Graphical Solution LP Defined Application and Examples Solving

The Formulation

Let xi = the number of salesperson that start their week on day i (i =

M, T, W, Th, F, Sa, Su)

. . 12

18

20

28

32

40

40

M T W TH F Sa Su

M TH F Sa Su

M T F Sa Su

M T W Sa Su

M T W Th Su

M T W Th F

T W Th F Sa

W Th F Sa Su

Min z x x x x x x x

s t x x x x x

x x x x x

x x x x x

x x x x x

x x x x x

x x x x x

x x x x x

Monday

Tuesday

Wednesday

Thursday

Friday

Saturday

Sunday

Page 41: An Introduction to Linear Programming (LP)academic.udayton.edu/charlesebeling/MSC521/PDF_PPT Files/Intro to... · The Graphical Solution LP Defined Application and Examples Solving

Urban Renewal

41

ORsville has severe budget shortage City council votes to improve the tax base

condemning inner-city housing replacing with new development

Up to 300 substandard houses may be demolished each house occupies .25 acre lot and cost $2,000 to demolish

Lot sizes for single, double, triple, and quadruple family unit are .18, .28, .4, and .5 acre respectively

15% of available acreage need for utilities, streets, green space, etc. Triple and quadruple units must be at least 25% of total, single at least

20%, and double at least 10% Tax levied per single, double, triple, and quadruple is $1,000, $1,900,

$2,700, and $3,400 respectively Construction costs per single, double, triple, and quadruple is $50,000,

$70,000, $130,000, and $160,000 respectively Max of $15 million available for construction

Page 42: An Introduction to Linear Programming (LP)academic.udayton.edu/charlesebeling/MSC521/PDF_PPT Files/Intro to... · The Graphical Solution LP Defined Application and Examples Solving

The Decision Variables

42

x1 = number of units of single-family homes

x2 = number of units of double-family homes

x3 = number of units of triple-family homes

x4 = number of units of quadruple-family homes

x5 = number of old homes to be demolished

A city council member tosses

a coin to see if a particular

house is to be demolished.

Page 43: An Introduction to Linear Programming (LP)academic.udayton.edu/charlesebeling/MSC521/PDF_PPT Files/Intro to... · The Graphical Solution LP Defined Application and Examples Solving

The Model

43

1 2 3 4

1 2 3 4 5

5

1 1 2 3 4

2 1 2 3 4

3 4 1 2 3 4

1 2 3 4 5

1 2 3 4 5

1000 1900 2700 3400

:

.18 .28 .4 .5 .25 .85

300

.2

.1

.25

50 70 130 160 2 15,000

, , , , 0

Max z x x x x

subject to

x x x x x

x

x x x x x

x x x x x

x x x x x x

x x x x x

x x x x x

tax collection

available acreage

max nbr to demolish

minimum nbr of each home type

budget in $1,000

Page 44: An Introduction to Linear Programming (LP)academic.udayton.edu/charlesebeling/MSC521/PDF_PPT Files/Intro to... · The Graphical Solution LP Defined Application and Examples Solving

The Model’s Solution

44

x1 = 35.83

x2 = 98.53

x3 = 44.79

x4 = 0

x5 = 244.49

z = $343,965

I will not live in a house that is only .83

complete!

Page 45: An Introduction to Linear Programming (LP)academic.udayton.edu/charlesebeling/MSC521/PDF_PPT Files/Intro to... · The Graphical Solution LP Defined Application and Examples Solving

Is it okay if we work more of these on our

own?

Gee, this LP stuff can solve just about any

problem.

Page 46: An Introduction to Linear Programming (LP)academic.udayton.edu/charlesebeling/MSC521/PDF_PPT Files/Intro to... · The Graphical Solution LP Defined Application and Examples Solving

Computer Solutions

46

LINDO

LINGO

Excel Solver

What’s Best (Excel add-on)

AMPL

TORA

Can you show us how

the computer solves

these LP problems?

Page 47: An Introduction to Linear Programming (LP)academic.udayton.edu/charlesebeling/MSC521/PDF_PPT Files/Intro to... · The Graphical Solution LP Defined Application and Examples Solving

More LP

The Simplex Algorithm

47

Next

Don”t touch that drop card!

The fun never stops!