19
1 5. Linear Programming 1. Introduction to Constrained Optimization Three elements: objective, constraints, decisions General formulation Terminology 2. Linear Programming Properties of LP Solving LP problems using Solver Sensitivity analysis: constraints and shadow prices, objective function coefficients

5. Linear Programming

Embed Size (px)

DESCRIPTION

5. Linear Programming. Introduction to Constrained Optimization Three elements: objective, constraints, decisions General formulation Terminology Linear Programming Properties of LP Solving LP problems using Solver - PowerPoint PPT Presentation

Citation preview

Page 1: 5. Linear Programming

1

5. Linear Programming

1. Introduction to Constrained Optimization– Three elements: objective, constraints, decisions

– General formulation

– Terminology

2. Linear Programming– Properties of LP

– Solving LP problems using Solver

– Sensitivity analysis: constraints and shadow prices, objective function coefficients

Page 2: 5. Linear Programming

2

Portfolio Management

• A portfolio manager wants to structure a portfolio from several investments: A, B, C, D

• Decisions:• Objective:• Constraints:

• If is more important

– Objective:

– Constraints:

Page 3: 5. Linear Programming

3

Constrained Optimization

• Constrained Optimization: find decisions that

Maximize (or minimize): objective function

Subject to: constraints (limitations on resources)• Applications

– Portfolio management -- Distribution– Location planning -- Production

planning – Production scheduling -- Workforce planning– Many others

• Example: Produce and ship 100 products from 20 plants to 50 DCs around the world, to minimize costs. Constraints? Decisions? Objective?

Page 4: 5. Linear Programming

4

General Formulation

1

1

1

Max ( ,..., ) objective function

Min

with respect to ,..., decision variables

Subject to ( ,..., ) , 1,..., constraints

n

n

k n k

f X X

X X

g X X b k m m

LHS RHS

Page 5: 5. Linear Programming

5

Terminology

• Decision variables - things we can control

• Objective function - performance measure

• Feasible region - The region in which the decision variables satisfy all of the constraints (choice set)

• Feasible solution - A solution that satisfies all constraints (lies within the feasible region).

• Optimal solution - the feasible solution that achieves the best (max or min) value for the objective function.

• Optimal objective function value - The value of the objective function at the optimal solution.

Page 6: 5. Linear Programming

6

Linear Programs• An important tractable special case

– Very easy for the computer to solve a large scale problem

– Wide applications

• Linear objective function and constraints

10

2

1

13 5 , , , ln( ), max , ,

10 ii

X Y X X X X X Y

• The feasible region will be a convex polyhedron

– Convex: No holes or indentations

– Polyhedron: flat sides

• Optimal solution will always be at a corner – ignore infinite feasible points on sides and interior points

Page 7: 5. Linear Programming

7

Product Mix Problem

$16.00$6.00Marginal Profit

121.52M2

2042M1

Available Machine

Hours

BAProducts

Machineshours

Maximize

Subject to:

Page 8: 5. Linear Programming

8

We must tell Excel’s Solver that:

• Decision variables are in C3:D3 (Changing Cells)

• Objective function is in F4 (Target Cell)

• Constraints are F6:F7 (hours used) E6:E7 (hours available)

LP in Excel: FormulationLP in Excel: Formulation (LP_MILP.xls)(LP_MILP.xls)

• It is a Linear Model with Non-Negative decision variables (under Options)

In Excel Spreadsheet: For given values of the decision variables in C3:D3, • calculate the objective value: F4 = SUMPRODUCT(C4:D4, C3:D3) • calculate the LHS of the constraints: F6 = SUMPRODUCT(C6:D6, $C$3:$D$3) F7 = SUMPRODUCT(C7:D7, $C$3:$D$3)

Page 9: 5. Linear Programming

9

LP in Excel: Instructions for Solver LP in Excel: Instructions for Solver (LP_MILP.xls)(LP_MILP.xls)

Solver Options: Select “Linear Model”

& “Non-Negative”

intbin

Go to Tools and find Solver

Page 10: 5. Linear Programming

10

Microsoft Excel 9.0 Answer Report

Target Cell (Max)Cell Name Original Value Final Value$F$4 Revenue Total 0 80

Adjustable CellsCell Name Original Value Final Value

$C$3 Quantity ProdA 0 0$D$3 Quantity ProdB 0 5

ConstraintsCell Name Cell Value Formula Status Slack$F$6 Mach 1 Used 20 $F$6<=$E$6 Binding 0$F$7 Mach 2 Used 7.5 $F$7<=$E$7 Not Binding 4.5

What is the solution?

ProdA = , ProdB =

Profit =

How much machine time?

Mach1 = , Mach2 =

Unused machine time?

Mach1 = , Mach2 =

Answer Report: The Solution Answer Report: The Solution (LP_MILP.xls)(LP_MILP.xls)

Max 6XA + 16XB

s.t. 2XA + 4XB 20 2XA + 1.5XB 12 XA 0, XB 0

Page 11: 5. Linear Programming

11

Why would we lose $2 to produce 1 unit of ProdA (Reduced CostReduced Cost)?

(a) How much must the profit margin of ProdA increase before we will produce it (Allowable IncreaseAllowable Increase)?

(b) What if the profit margin of ProdA increases by more than $2 (Allowable IncreaseAllowable Increase)?

Microsoft Excel 9.0 Sensitivity Report

Adjustable CellsFinal Reduced Objective Allowable Allowable

Cell Name Value Cost Coefficient Increase Decrease$C$3 Quantity ProdA 0 -2 6 2 1E+30$D$3 Quantity ProdB 5 0 16 1E+30 4

Sensitivity Report: Sensitivity Analysis of Objective FunctionSensitivity Report: Sensitivity Analysis of Objective Function

Page 12: 5. Linear Programming

12

Sensitivity Report: Sensitivity Analysis of Objective FunctionSensitivity Report: Sensitivity Analysis of Objective Function

If you change an Objective Coefficient within its Allowable Increase/Decrease, the “Final Values of the Variables” do not change (i.e. the same corner is optimal)

Outside that range, the “Final Values” change (i.e., new optimal solution).

Page 13: 5. Linear Programming

13

The shadow price is the rate of change of objective function per unit increase of the RHS (constraint limit).

If 2 hours of Mach 1 time were unavailable (i.e. 20 decreases to 18), how much would the objective function change?

Why is the Shadow Price = zero for Mach 2?

Microsoft Excel 9.0 Sensitivity Report

ConstraintsFinal Shadow Constraint Allowable Allowable

Cell Name Value Price R.H. Side Increase Decrease$F$6 Mach 1 Used 20 4 20 12 20$F$7 Mach 2 Used 7.5 0 12 1E+30 4.5

Sensitivity Report: Sensitivity Analysis of ConstraintsSensitivity Report: Sensitivity Analysis of Constraints

Within the Allowable Increase/Decrease for the RHS , the “Shadow Price” is constant.

Outside that range, the “Shadow Price” changes

Page 14: 5. Linear Programming

14

Takeaways

1. Introduction to Constrained Optimization– Three elements: objective (max or min), constraints ( ≤, ≥, =),

decision variables– Formulation

2. Linear Programming: linear constraints and objective function– Properties of LP: optimal solution at a corner– Solving LP problems using Solver

• Answer: optimal objective value, decisions, binding/nonbinding constraints

• Sensitivity analysis: – Objective function coefficients: reduced cost, allowable

increase/decrease (when zero, multiple solutions)– Constraints: shadow prices (if 0, non-bottleneck), allowable

increase/decrease on RHS of constraints

Page 15: 5. Linear Programming

15 1 2 3 4 5 6 7 8 9 10 11 12

1

2

3

4

5

6

7

8

9

10

1

1

12

2XA + 4XB = 20 (Machine 1)

2XA + 1.5XB = 12 (Machine 2)

XA

XB

Graph 1: Solution

See Output 1: Solution

Which constraints are “binding” the optimal solution?

Page 16: 5. Linear Programming

16 1 2 3 4 5 6 7 8 9 10 11 12

1

2

3

4

5

6

7

8

9

10

1

1

12

2XA + 4XB = 20 (Machine 1)

2XA + 1.5XB = 12 (Machine 2)

6XA + 16XB = 16

6XA + 16XB = 80

XA

XB

Solution

See Output 1: Solution

Which constraints are “binding” the optimal solution?

6XA + 16XB = 32

Page 17: 5. Linear Programming

17 1 2 3 4 5 6 7 8 9 10 11 12

1

2

3

4

5

6

7

8

9

10

1

1

12

2XA + 1.5XB = 12 (Machine 2)

6XA + 16XB = 80

XA

XB

• • • • • • • • •

2XA + 4XB = 20 (Machine 1)

How many optimal solutions are there in this case?

Changing One of the Objective Function Coefficient

Allowable Increase = 2 for Objective Coefficient of Product A

Let’s add 2 to the objective coefficient of XA:8XA + 16XB = 80

Page 18: 5. Linear Programming

18 1 2 3 4 5 6 7 8 9 10 11 12

1

2

3

4

5

6

7

8

9

10

1

1

12

2XA + 1.5XB = 12 (Machine 2)

Now Try:10XA + 16XB = 80

6XA + 16XB = 80

Changing the Objective Function Coefficient More than the Allowable Increase or Decrease

Allowable Increase = 2 for Objective Coefficient of Product A

2XA + 4XB = 20 (Machine 1)

New Solution: ( )•

XA

XB

Page 19: 5. Linear Programming

19 1 2 3 4 5 6 7 8 9 10 11 12

1

2

3

4

5

6

7

8

9

10

1

1

12

2XA + 1.5XB = 12 (Machine 2)

Changing the LHS of a ConstraintMachine 1 Constraint has:

Constraint R.H. Side = 20, Allowable Increase = 12, Allowable Decrease = 20

2XA + 4XB = 20

Now lets try 2XA + 4XB = 16

• Do the decision variables change?

• Does the objective function change?

XA

XB