Dave Powell, USDA Forest Service, forestryimages Image number 1210054

38
Dave Powell, USDA Forest Service, www.forestryimages. Image number 1210054 FORS 8450 • Advanced Forest Planning Lecture 3 Linear Programming - The Simplex Method (Appendix B of Bettinger, Boston, Siry, and Grebner)

description

FORS 8450 • Advanced Forest Planning Lecture 3 Linear Programming - The Simplex Method (Appendix B of Bettinger, Boston, Siry, and Grebner). Dave Powell, USDA Forest Service, www.forestryimages.org Image number 1210054. Create DCM. Linear programming Simplex method. Calc. opportunity - PowerPoint PPT Presentation

Transcript of Dave Powell, USDA Forest Service, forestryimages Image number 1210054

Dave Powell, USDA Forest Service, www.forestryimages.org

Image number 1210054

FORS 8450 • Advanced Forest Planning

Lecture 3

Linear Programming - The Simplex Method

(Appendix B of Bettinger, Boston, Siry, and Grebner)

Create DCM

Calc. opportunitycosts

Optimal?

ID Pivot Column

Calc. maximumcontributions

ID Pivot Row

ID Pivot Number

Calc. "Ratio"

Transform Pivot Row

Transform Non-Pivot Row(s)

Linear programming

Simplex method

StopYes

No

Maximize 2.5 X + 8 Y

Subject to:

15 X + 20 Y 60X + 5 Y 10

Y

X

15 X + 20 Y 60

X + 5 Y 10

Linear programming

Simplex method - Example

15

1

20

5

1

1

60

10

2.5 8

X Y S1 S2 Q

Initially, Q = RHS values

X + 5 Y + S2 = 10

2.5 X + 8 Y

15 X + 20 Y + S1 = 60

Objective function

Constraint 1

Constraint 2

Linear programming

Simplex method - Example

Linear programming

Simplex method - Example

15

1

20

5

1

1

60

10

2.5 8

X Y S1 S2 Q

Create DCM

Calc. opportunitycosts

Optimal?

ID Pivot Column

Calc. maximumcontributions

ID Pivot Row

ID Pivot Number

Calc. "Ratio"

Transform Pivot Row

Transform Non-Pivot Row(s)

StopYes

No

Maximize 2.5 X + 8 Y

Subject to:

15 X + 20 Y 60X + 5 Y 10

Y

X

15 X + 20 Y 60

X + 5 Y 10

Linear programming

Simplex method - Example

Where are we?

S1

S2

Linear programming

Simplex method - Example

15

1

20

5

1

1

60

10

2.5 8

X Y S1 S2 Q

Create DCM

Calc. opportunitycosts

Optimal?

ID Pivot Column

Calc. maximumcontributions

ID Pivot Row

ID Pivot Number

Calc. "Ratio"

Transform Pivot Row

Transform Non-Pivot Row(s)

Variablesin thesolution

Variables currently in the solutionhave an opportunity cost of 0 or less.

"Their value" is their value in the objectivefunction.

Stop

0

0

Theirvalue

Yes

No

S1

S2

Linear programming

Simplex method - Example

15

1

20

5

1

1

60

10

2.5 8

X Y S1 S2 Q

Create DCM

Calc. opportunitycosts

Optimal?

ID Pivot Column

Calc. maximumcontributions

ID Pivot Row

ID Pivot Number

Calc. "Ratio"

Transform Pivot Row

Transform Non-Pivot Row(s)

Variablesin thesolution

OCx = (Objective function value of variable X)- ((Columnx1 value) ("their value1"))- ((Columnx2 value) ("their value2"))

Stop

0

0

Theirvalue

OCx = (2.5) - ((15) (0)) - ((1) (0))

OCy = (8) - ((20) (0)) - ((5) (0))

OCS1 = (0) - ((1) (0)) - ((0) (0))

OCS2 = (0) - ((0) (0)) - ((1) (0))

= 2.5

= 8.0

= 0

= 0

Yes

No

S1

S2

Linear programming

Simplex method - Example

15

1

20

5

1

1

60

10

2.5 8

X Y S1 S2 Q

Create DCM

Calc. opportunitycosts

Optimal?

ID Pivot Column

Calc. maximumcontributions

ID Pivot Row

ID Pivot Number

Calc. "Ratio"

Transform Pivot Row

Transform Non-Pivot Row(s)

Variablesin thesolution

Stop

0

0

Theirvalue

2.5 8.0 0 0 Opportunity costs

Not the optimal solution, since someopportunity costs are > 0.

Yes

No

S1

S2

Linear programming

Simplex method - Example

15

1

20

5

1

1

60

10

2.5 8

X Y S1 S2 Q

Create DCM

Calc. opportunitycosts

Optimal?

ID Pivot Column

Calc. maximumcontributions

ID Pivot Row

ID Pivot Number

Calc. "Ratio"

Transform Pivot Row

Transform Non-Pivot Row(s)

Variablesin thesolution

Stop

0

0

Theirvalue

2.5 8.0 0 0 Opportunity costs

Yes

No

Pivot Column is the column with the highest opportunity cost

Whichever variable that column refers to is "coming into the solution."

S1

S2

Linear programming

Simplex method - Example

15

1

20

5

1

1

60

10

2.5 8

X Y S1 S2 Q

Create DCM

Calc. opportunitycosts

Optimal?

ID Pivot Column

Calc. maximumcontributions

ID Pivot Row

ID Pivot Number

Calc. "Ratio"

Transform Pivot Row

Transform Non-Pivot Row(s)

Variablesin thesolution

Stop

0

0

Theirvalue

Yes

No

Maximum contributions are the most that the variable represented by the Pivot Column can bring into the solution.

Max contribution = (Q row / Pivot Column value row )

MC constraint #1 = (60 / 20) = 3MC constraint #2 = (10 / 5) = 2

S1

S2

Linear programming

Simplex method - Example

15

1

20

5

1

1

60

10

2.5 8

X Y S1 S2 Q

Create DCM

Calc. opportunitycosts

Optimal?

ID Pivot Column

Calc. maximumcontributions

ID Pivot Row

ID Pivot Number

Calc. "Ratio"

Transform Pivot Row

Transform Non-Pivot Row(s)

Variablesin thesolution

Stop

0

0

Theirvalue

Yes

No

The most of Y that we can bring into the solution is 2 units (related to constraint row #2).

S1

S2

Linear programming

Simplex method - Example

15

1

20

5

1

1

60

10

2.5 8

X Y S1 S2 Q

Create DCM

Calc. opportunitycosts

Optimal?

ID Pivot Column

Calc. maximumcontributions

ID Pivot Row

ID Pivot Number

Calc. "Ratio"

Transform Pivot Row

Transform Non-Pivot Row(s)

Variablesin thesolution

Stop

0

0

Theirvalue

Yes

No

The Pivot Row is the row related to themaximum contribution of variable Y

S1

S2

Linear programming

Simplex method - Example

15

1

20

5

1

1

60

10

2.5 8

X Y S1 S2 Q

Create DCM

Calc. opportunitycosts

Optimal?

ID Pivot Column

Calc. maximumcontributions

ID Pivot Row

ID Pivot Number

Calc. "Ratio"

Transform Pivot Row

Transform Non-Pivot Row(s)

Variablesin thesolution

Stop

0

0

Theirvalue

Yes

No

The Pivot Number is the value of the cellat the intersection of the Pivot Row and the Pivot Column.

Here, the Pivot Number = 5

S1

S2

Linear programming

Simplex method - Example

15

1

20

5

1

1

60

10

2.5 8

X Y S1 S2 Q

Create DCM

Calc. opportunitycosts

Optimal?

ID Pivot Column

Calc. maximumcontributions

ID Pivot Row

ID Pivot Number

Calc. "Ratio"

Transform Pivot Row

Transform Non-Pivot Row(s)

Variablesin thesolution

Stop

0

0

Theirvalue

Yes

No

The "Ratio" for this simple 2-constraint problemis the value in the cell of the non-Pivot Row / PivotColumn (20) divided by the Pivot Number.

Here, the "ratio" = (20 / 5) = 4

S1

S2

Linear programming

Simplex method - Example

15

0.2

20

1

1

0.2

60

2

2.5 8

X Y S1 S2 Q

Create DCM

Calc. opportunitycosts

Optimal?

ID Pivot Column

Calc. maximumcontributions

ID Pivot Row

ID Pivot Number

Calc. "Ratio"

Transform Pivot Row

Transform Non-Pivot Row(s)

Variablesin thesolution

Stop

0

0

Theirvalue

Yes

No

Transform the Pivot Row by dividing all values inthat row by the Pivot Number.

S1

Y

Linear programming

Simplex method - Example

15

0.2

20

1

1

0.2

60

2

2.5 8

X Y S1 S2 Q

Create DCM

Calc. opportunitycosts

Optimal?

ID Pivot Column

Calc. maximumcontributions

ID Pivot Row

ID Pivot Number

Calc. "Ratio"

Transform Pivot Row

Transform Non-Pivot Row(s)

Variablesin thesolution

Stop

0

8

Theirvalue

Yes

No

This indicates that we are bringing the Yvariable into the solution.

S1

Y

Linear programming

Simplex method - Example

15

0.2

20

1

1

0.2

60

2

2.5 8

X Y S1 S2 Q

Create DCM

Calc. opportunitycosts

Optimal?

ID Pivot Column

Calc. maximumcontributions

ID Pivot Row

ID Pivot Number

Calc. "Ratio"

Transform Pivot Row

Transform Non-Pivot Row(s)

Variablesin thesolution

Stop

0

8

Theirvalue

Yes

No

Transform the Non-Pivot Row (the otherconstraint row).

New cell value = (old cell value) - (old Pivot Row value for the new cell's column x "ratio")

S1

Y

Linear programming

Simplex method - Example

15

0.2

20

1

1

0.2

60

2

2.5 8

X Y S1 S2 Q

Create DCM

Calc. opportunitycosts

Optimal?

ID Pivot Column

Calc. maximumcontributions

ID Pivot Row

ID Pivot Number

Calc. "Ratio"

Transform Pivot Row

Transform Non-Pivot Row(s)

Variablesin thesolution

Stop

0

8

Theirvalue

Yes

No

Example: X variable column, 1st constraint row:

Old cell value = 15Old Pivot Row value for the new cell's column = 1"ratio" = 4

New cell value = 15 - (1 x 4) = 11

S1

Y

Linear programming

Simplex method - Example

11

0.2

0

1

1 -4

0.2

20

2

2.5 8

X Y S1 S2 Q

Create DCM

Calc. opportunitycosts

Optimal?

ID Pivot Column

Calc. maximumcontributions

ID Pivot Row

ID Pivot Number

Calc. "Ratio"

Transform Pivot Row

Transform Non-Pivot Row(s)

Variablesin thesolution

Stop

0

8

Theirvalue

Yes

No

Maximize 2.5 X + 8 Y

Subject to:

15 X + 20 Y 60X + 5 Y 10

Y

X

15 X + 20 Y 60

X + 5 Y 10

Linear programming

Simplex method - Example

Where are we?

S1

Y

Linear programming

Simplex method - Example

11

0.2

0

1

1 -4

0.2

20

2

2.5 8

X Y S1 S2 Q

Create DCM

Calc. opportunitycosts

Optimal?

ID Pivot Column

Calc. maximumcontributions

ID Pivot Row

ID Pivot Number

Calc. "Ratio"

Transform Pivot Row

Transform Non-Pivot Row(s)

Variablesin thesolution

Stop

0

8

Theirvalue

Yes

No

OCx = (Objective function value of variable X)- ((Columnx1 value) ("their value1"))- ((Columnx2 value) ("their value2"))

OCx = (2.5) - ((11) (0)) - ((0.2) (8))

OCy = (8) - ((0) (0)) - ((1) (8))

OCS1 = (0) - ((1) (0)) - ((0) (8))

OCS2 = (0) - ((-4) (0)) - ((0.2) (8))

= 0.9

= 0

= 0

= -1.6

0.9 0 0 -1.6 Opportunity costs

Not the optimal solution, since someopportunity costs are > 0.

S1

Y

Linear programming

Simplex method - Example

11

0.2

0

1

1 -4

0.2

20

2

2.5 8

X Y S1 S2 Q

Create DCM

Calc. opportunitycosts

Optimal?

ID Pivot Column

Calc. maximumcontributions

ID Pivot Row

ID Pivot Number

Calc. "Ratio"

Transform Pivot Row

Transform Non-Pivot Row(s)

Variablesin thesolution

0

8

Theirvalue

Yes

No

Stop

0.9 0 0 -1.6 Opportunity costs

S1

Y

Linear programming

Simplex method - Example

11

0.2

0

1

1 -4

0.2

20

2

2.5 8

X Y S1 S2 Q

Create DCM

Calc. opportunitycosts

Optimal?

ID Pivot Column

Calc. maximumcontributions

ID Pivot Row

ID Pivot Number

Calc. "Ratio"

Transform Pivot Row

Transform Non-Pivot Row(s)

Variablesin thesolution

0

8

Theirvalue

Yes

No

Pivot Column is the column with the highest opportunity cost

Whichever variable that column refers to is "coming into the solution."

Stop

S1

Y

Linear programming

Simplex method - Example

11

0.2

0

1

1 -4

0.2

20

2

2.5 8

X Y S1 S2 Q

Create DCM

Calc. opportunitycosts

Optimal?

ID Pivot Column

Calc. maximumcontributions

ID Pivot Row

ID Pivot Number

Calc. "Ratio"

Transform Pivot Row

Transform Non-Pivot Row(s)

Variablesin thesolution

0

8

Theirvalue

Yes

No

Maximum contributions are the most that the variable represented by the Pivot Column can bring into the solution.

Max contribution = (Q row / Pivot Column value row )

MC constraint #1 = (20 / 11) = 1.8182MC constraint #2 = (2 / 0.2) = 10

Stop

The most of X that we can bring into the solution is 1.8182 units (related to constraint row #1).

S1

Y

Linear programming

Simplex method - Example

11

0.2

0

1

1 -4

0.2

20

2

2.5 8

X Y S1 S2 Q

Create DCM

Calc. opportunitycosts

Optimal?

ID Pivot Column

Calc. maximumcontributions

ID Pivot Row

ID Pivot Number

Calc. "Ratio"

Transform Pivot Row

Transform Non-Pivot Row(s)

Variablesin thesolution

0

8

Theirvalue

Yes

No

Stop

The Pivot Row is the row related to themaximum contribution of variable X

S1

Y

Linear programming

Simplex method - Example

11

0.2

0

1

1 -4

0.2

20

2

2.5 8

X Y S1 S2 Q

Create DCM

Calc. opportunitycosts

Optimal?

ID Pivot Column

Calc. maximumcontributions

ID Pivot Row

ID Pivot Number

Calc. "Ratio"

Transform Pivot Row

Transform Non-Pivot Row(s)

Variablesin thesolution

0

8

Theirvalue

Yes

No

Stop

The Pivot Number is the value of the cellat the intersection of the Pivot Row and the Pivot Column.

Here, the Pivot Number = 11

S1

Y

Linear programming

Simplex method - Example

11

0.2

0

1

1 -4

0.2

20

2

2.5 8

X Y S1 S2 Q

Create DCM

Calc. opportunitycosts

Optimal?

ID Pivot Column

Calc. maximumcontributions

ID Pivot Row

ID Pivot Number

Calc. "Ratio"

Transform Pivot Row

Transform Non-Pivot Row(s)

Variablesin thesolution

0

8

Theirvalue

Yes

No

Stop

The "Ratio" for this simple 2-constraint problemis the value in the cell of the non-Pivot Row / PivotColumn (0.2) divided by the Pivot Number.

Here, the "ratio" = (0.2 / 11) = 0.018182

S1

Y

Linear programming

Simplex method - Example

11

0.2

0

1

1 -4

0.2

20

2

2.5 8

X Y S1 S2 QVariablesin thesolution

0

8

Theirvalue

Create DCM

Calc. opportunitycosts

Optimal?

ID Pivot Column

Calc. maximumcontributions

ID Pivot Row

ID Pivot Number

Calc. "Ratio"

Transform Pivot Row

Transform Non-Pivot Row(s)

Yes

No

Stop

Transform the Pivot Row by dividing all values inthat row by the Pivot Number.

S1

Y

Linear programming

Simplex method - Example

1

0.2

0

1

0.09 -0.364

0.2

1.818

2

2.5 8

X Y S1 S2 QVariablesin thesolution

0

8

Theirvalue

Create DCM

Calc. opportunitycosts

Optimal?

ID Pivot Column

Calc. maximumcontributions

ID Pivot Row

ID Pivot Number

Calc. "Ratio"

Transform Pivot Row

Transform Non-Pivot Row(s)

Yes

No

Stop

X

Y

Linear programming

Simplex method - Example

1

0.2

0

1

0.09 -0.364

0.2

1.818

2

2.5 8

X Y S1 S2 QVariablesin thesolution

2.5

8

Theirvalue

Create DCM

Calc. opportunitycosts

Optimal?

ID Pivot Column

Calc. maximumcontributions

ID Pivot Row

ID Pivot Number

Calc. "Ratio"

Transform Pivot Row

Transform Non-Pivot Row(s)

Yes

No

This indicates that we are bringing the Xvariable into the solution.

Stop

X

Y

Linear programming

Simplex method - Example

1

0.2

0

1

0.09 -0.364

0.2

1.818

2

2.5 8

X Y S1 S2 QVariablesin thesolution

2.5

8

Theirvalue

Create DCM

Calc. opportunitycosts

Optimal?

ID Pivot Column

Calc. maximumcontributions

ID Pivot Row

ID Pivot Number

Calc. "Ratio"

Transform Pivot Row

Transform Non-Pivot Row(s)

Yes

No

Transform the Non-Pivot Row (the otherconstraint row).

New cell value = (old cell value) - (old Pivot Row value for the new cell's column x "ratio")

Stop

X

Y

Linear programming

Simplex method - Example

1

0.2

0

1

0.09 -0.364

0.2

1.818

2

2.5 8

X Y S1 S2 QVariablesin thesolution

2.5

8

Theirvalue

Create DCM

Calc. opportunitycosts

Optimal?

ID Pivot Column

Calc. maximumcontributions

ID Pivot Row

ID Pivot Number

Calc. "Ratio"

Transform Pivot Row

Transform Non-Pivot Row(s)

Yes

No

Example: X variable column, 2nd constraint row:

Old cell value = 0.2Old Pivot Row value for the new cell's column = 11"ratio" = 0.018182

New cell value = 0.2 - (11 x 0.018182) = 0

Stop

X

Y

Linear programming

Simplex method - Example

1

0

0

1

0.09

-0.018

-0.364

0.273

1.818

1.636

2.5 8

X Y S1 S2 QVariablesin thesolution

2.5

8

Theirvalue

Create DCM

Calc. opportunitycosts

Optimal?

ID Pivot Column

Calc. maximumcontributions

ID Pivot Row

ID Pivot Number

Calc. "Ratio"

Transform Pivot Row

Transform Non-Pivot Row(s)

Yes

No

This indicates that we are bringing the Xvariable into the solution.

Stop

X

Y

Linear programming

Simplex method - Example

1

0

0

1

0.09

-0.018

-0.364

0.273

1.818

1.636

2.5 8

X Y S1 S2 QVariablesin thesolution

2.5

8

Theirvalue

Create DCM

Calc. opportunitycosts

Optimal?

ID Pivot Column

Calc. maximumcontributions

ID Pivot Row

ID Pivot Number

Calc. "Ratio"

Transform Pivot Row

Transform Non-Pivot Row(s)

Yes

No

OCx = (Objective function value of variable X)- ((Columnx1 value) ("their value1"))- ((Columnx2 value) ("their value2"))

OCx = (2.5) - ((1) (2.5)) - ((0) (8))

OCy = (8) - ((0) (2.5)) - ((1) (8))

OCS1 = (0) - ((0.09) (2.5)) - ((-.018) (8))

OCS2 = (0) - ((-0.364) (2.5)) - ((0.273) (8))

= 0

= 0

= -0.081

= -1.27

Stop

X

Y

Linear programming

Simplex method - Example

1

0

0

1

0.09

-0.018

-0.364

0.273

1.818

1.636

2.5 8

X Y S1 S2 QVariablesin thesolution

2.5

8

Theirvalue

Create DCM

Calc. opportunitycosts

Optimal?

ID Pivot Column

Calc. maximumcontributions

ID Pivot Row

ID Pivot Number

Calc. "Ratio"

Transform Pivot Row

Transform Non-Pivot Row(s)

Yes

No

0 0 -0.081 -1.27 Opportunity costs

The optimal solution, since no opportunity costs are > 0.

Stop

X

Y

Linear programming

Simplex method - Example

1

0

0

1

0.09

-0.018

-0.364

0.273

1.818

1.636

2.5 8

X Y S1 S2 QVariablesin thesolution

2.5

8

Theirvalue

Create DCM

Calc. opportunitycosts

Optimal?

ID Pivot Column

Calc. maximumcontributions

ID Pivot Row

ID Pivot Number

Calc. "Ratio"

Transform Pivot Row

Transform Non-Pivot Row(s)

Yes

No

Stop

Optimal solution:

X = 1.818Y = 1.636

Solution value = 1.818 (2.5) + 1.636 (8) = 17.633

Maximize 2.5 X + 8 Y

Subject to:

15 X + 20 Y 60X + 5 Y 10

Y

X

15 X + 20 Y 60

X + 5 Y 10

Linear programming

Simplex method - Example

Where are we?