Lecture: Introduction to Linear Programming for Natural Resource Economists and Landscape Ecologists

46
Linear Programming 11 December 2014 Daniel L Sandars, Research Fellow IEHRF, School of Applied Science 0 20 40 60 80 100 0 10 20 30 40 50 60 70 80 90 100 Profit contours Potatoes, ha Wheat, ha £200,000-£250,000 £150,000-£200,000 £100,000-£150,000 £50,000-£100,000 £0-£50,000 Land limit <= 100 ha Irrigation limit, <= 27.5 ha potatoes Optimium Feasible region

description

The first hour lecture I give when introducing Linear Programming to MSc students studying 1) landscape ecology and 2) Economics and natural resource management. The second hour I give them hands on experience with Excel and its Solver. The final hour is taken up with real world application case-studies. As a footnote what I notice is that my style of preparing presentation is evolving alongside my membership of Toastmasters International. These slides are far too wordy and simply list the words I want to say rather than illustrate the concept I am get across. Change required but power point slides still need to read well and be comprehensible for those students that don&#x27;t show to hear me present.

Transcript of Lecture: Introduction to Linear Programming for Natural Resource Economists and Landscape Ecologists

Page 1: Lecture: Introduction to Linear Programming for Natural Resource Economists and Landscape Ecologists

Linear Programming11 December 2014Daniel L Sandars, Research FellowIEHRF, School of Applied Science

0

20

40

60

80

100

0

10

20

30

40

50

60

70

80

90

100

Profit

contours

Potatoes, ha

Wheat, ha

£200,000-£250,000

£150,000-£200,000

£100,000-£150,000

£50,000-£100,000

£0-£50,000

Land limit

<= 100 haIrrigation limit, <=

27.5 ha potatoes

Optimium

Feasible

region

Page 2: Lecture: Introduction to Linear Programming for Natural Resource Economists and Landscape Ecologists

Overall Structure

1. Introduction to Linear Programming (LP)

2. Sensitivity Analysis and Solution Interpretation

3. Hands-on practical Excel & Solver

4. Applications

5. Miscellaneous LP

Page 3: Lecture: Introduction to Linear Programming for Natural Resource Economists and Landscape Ecologists

1) Introduction toLinear Programming

• Introduction

• A Simple Maximisation Problem

• Graphical Solution Procedure

• Extreme Points and the Optimal Solution

• A Simple Minimisation Problem

• Special Cases

• General Linear Programming Notation

Page 4: Lecture: Introduction to Linear Programming for Natural Resource Economists and Landscape Ecologists

Introduction

• Linear programming is an important case of a large

set of mathematical programming techniques

• They all seek to maximise or minimise (to optimise) a

quantity subject to conditions or constriants

• pro·gram·ming or pro·gram·ing n.

• 1. The designing, scheduling, or planning of a

program, as in broadcasting.

• 2. The writing of a computer program.

Page 5: Lecture: Introduction to Linear Programming for Natural Resource Economists and Landscape Ecologists

LP Introduction

• The production planning problem

• Finite factors of production: land, labour and

capital

• A vast production possibilities set

• How to deploy the resources with best efficiency?

• What is the marginal value of a resource’s use?

Page 6: Lecture: Introduction to Linear Programming for Natural Resource Economists and Landscape Ecologists

Product

A

Product

B

Hours

Machine 1 2 3 ≤ 3000

Machine 2 4 1 ≤ 3000

Machine 3 2 1.5 ≤ 1800

Profit £7 £4 = Max

Classic example, Product mix

Maximisation: make the most profit

Page 7: Lecture: Introduction to Linear Programming for Natural Resource Economists and Landscape Ecologists

MaximisationGraphical solution

Constraint 1

0

500

1000

1500

2000

2500

3000

0 200 400 600 800 1000 1200 1400

Product A

Pro

du

ct

B

Machine 1 <= 3000 hrs

Take two extreme points, where first

Product A=0 and then Product B=0.

Draw the line that connects them

Page 8: Lecture: Introduction to Linear Programming for Natural Resource Economists and Landscape Ecologists

MaximisationGraphical solution

Constraints 2 & 3

0

500

1000

1500

2000

2500

3000

0 200 400 600 800 1000 1200 1400

Product A

Pro

du

ct

B

Machine 1 <= 3000 hrs

Machine 2 <= 3000 hrs

Machine 3 <=1800 hrs

Page 9: Lecture: Introduction to Linear Programming for Natural Resource Economists and Landscape Ecologists

MaximisationGraphical solution

Identify the Feasible Region

0

500

1000

1500

2000

2500

3000

0 200 400 600 800 1000 1200 1400

Product A

Pro

du

ct

B

Machine 1 <= 3000 hrs

Machine 2 <= 3000 hrs

Machine 3 <=1800 hrs

Feasible

Region

Page 10: Lecture: Introduction to Linear Programming for Natural Resource Economists and Landscape Ecologists

MaximisationGraphical solution

Draw profit contours

0

500

1000

1500

2000

2500

3000

0 200 400 600 800 1000 1200 1400

Product A

Pro

du

ct

B

Machine 1 <= 3000 hrs

Machine 2 <= 3000 hrs

Machine 3 <=1800 hrs

Profit = £5000

Profit = £6000

Profit = £7000

Feasible

Region

Page 11: Lecture: Introduction to Linear Programming for Natural Resource Economists and Landscape Ecologists

Solution

Solution = Profit of £5925 = 675 units Product A & 300 units Product B

0

200

400

600

800

1000

0 200 400 600 800

Product A

Pro

du

ct

B

Machine 1 <= 3000 hrs

Machine 2 <= 3000 hrs

Machine 3 <=1800 hrs

Profit = £5000

Profit = £6000

Profit = £7000

Feasible

Region

Page 12: Lecture: Introduction to Linear Programming for Natural Resource Economists and Landscape Ecologists

Solution and extreme points

Extreme Points

0

100

200

300

400

500

600

700

800

900

1000

0 100 200 300 400 500 600 700 800

Product A

Pro

du

ct

B

Machine 1 <= 3000 hrs

Machine 2 <= 3000 hrs

Machine 3 <=1800 hrs

Profit = £5000

Profit = £6000

Profit = £7000

Feasible

Region

0

1

2

3

4

Page 13: Lecture: Introduction to Linear Programming for Natural Resource Economists and Landscape Ecologists

Binding and slack constraints

Hours Used Hours Available Slack

Machine 1 2250 3000 750

Machine 2 3000 3000 0

Machine 3 1800 1800 0

Where the inequality is ≥ then a slack is a surplus

Page 14: Lecture: Introduction to Linear Programming for Natural Resource Economists and Landscape Ecologists

Crop A Crop B Available

Plant 2 3 ≤ 3000

Harvest 4 1 ≤ 3000

Land 1 1 ≤ 1000

Profit 7 4 = Max

Classic example – crops

Product mix or optimise the production

possibilities set for a given resource of land,

labour and capital

Maximisation and land use planning?

Page 15: Lecture: Introduction to Linear Programming for Natural Resource Economists and Landscape Ecologists

Feed A,

kg

Feed B,

kg

Dry matter intake,

kg2 3 ≤ 3000

Energy, MJ 4 1 ≥ 3000

Protein, g CP 2 1.5 ≥ 1800

Cost £7 £4 = Min

Classic example – feed

The Diet Problem

Minimisation

Page 16: Lecture: Introduction to Linear Programming for Natural Resource Economists and Landscape Ecologists

Minimisation

Minimisation

0

500

1000

1500

2000

2500

3000

0 200 400 600 800 1000 1200 1400

Feed A

Feed

B

Dry matter <= 3000 kg

Energy >= 3000 MJ

Protein >= 1800 g CP

Cost = £5000

Cost = £6000

Cost = £7000

Feasible

Region

Page 17: Lecture: Introduction to Linear Programming for Natural Resource Economists and Landscape Ecologists

Minimisation

Minimisation

0

500

1000

1500

2000

2500

3000

0 200 400 600 800 1000 1200 1400

Feed A

Feed

B

Dry matter <= 3000 kg

Energy >= 3000 MJ

Protein >= 1800 g CP

Cost = £5000

Cost = £6000

Cost = £7000

Feasible

Region

Solution is closest

to origin

Page 18: Lecture: Introduction to Linear Programming for Natural Resource Economists and Landscape Ecologists

Special cases: Alternative Optima

Alternative Optima

-100

100

300

500

700

900

1100

1300

1500

0 200 400 600 800 1000

Product A

Pro

du

ct

B

Machine 1 = 3000 hrs

Machine 2 = 3000 hrs

Machine 3 =1800 hrs

Profit = £7000

Profit = £6000

Profit = £5000

Feasible

Region

Two extreme points are equally

optimal AND every solution

between them (infinite)!

Page 19: Lecture: Introduction to Linear Programming for Natural Resource Economists and Landscape Ecologists

Special cases:Infeasibility

Infeasible

0

500

1000

1500

2000

2500

3000

0 500 1000 1500

Feed A

Feed

B Dry matter <= 1000 kg

Energy >= 3000 MJ

Protein >= 1800 g CP

Page 20: Lecture: Introduction to Linear Programming for Natural Resource Economists and Landscape Ecologists

Special cases:Uboundedness

0

500

1000

1500

2000

2500

3000

- 500 1,000 1,500

So

me a

xis

AA

Some Axis Z

Unboundedness

Profit = £7000

Profit = £6000

Profit = £5000

Page 21: Lecture: Introduction to Linear Programming for Natural Resource Economists and Landscape Ecologists

Special cases:Redundant Constraint

Redundant Constraint

0

500

1000

1500

2000

2500

3000

0 500 1000 1500

Feed A

Feed

B

Dry matter <= 3000 kg

Energy >= 3000 MJ

Protein >= 1800 g CP

Salt <= 50g

Cost = £5000

Cost = £6000

Cost = £7000

Feasible Region

Page 22: Lecture: Introduction to Linear Programming for Natural Resource Economists and Landscape Ecologists

2) LP: Sensitivity analysis &Solution interpretation

• Introduction to sensitivity analysis

• Graphical sensitivity analysis

• Dual and shadow prices

Page 23: Lecture: Introduction to Linear Programming for Natural Resource Economists and Landscape Ecologists

Sensitivity AnalysisTwo questions

• How will a change in an objective function coefficient

affect the optimal solution? For example, what if the

price of wheat went up £1

• How will a change in the right-hand-side value of a

constraint affect the optimal solution? For example, if

the hours available for harvest increased by 1 hour

• The answers are obtained after the optimal solution,

i.e. this is post-optimality analysis.

Page 24: Lecture: Introduction to Linear Programming for Natural Resource Economists and Landscape Ecologists

Objective function sensitivity

Objective function sensitivity

0

500

1000

1500

2000

2500

3000

0 500 1000 1500

Product A

Pro

du

ct

B Machine 1 = 3000 hrs

Machine 2 = 3000 hrs

Machine 3 =1800 hrs

Profit = £5925 (A=£7,B=£4)

Slope -4

Slope -1.75

Slope -1.33

The solution is stable if the slope of the objective function

lies between the slope of the two binding constraints

Page 25: Lecture: Introduction to Linear Programming for Natural Resource Economists and Landscape Ecologists

Objective function sensitivity

• Varying one coefficient at a time

• £5.32 ≤ cx1 ≤ £16

• £1.75 ≤ cx2 ≤ £5.26

• At the limits you get alternative optima with the adjacent extreme points. Beyond that new solutions occur on those extreme points

• Thus, if one varied a price through an extreme range the solution would be stable then lurch to a new optimum giving a response line with step-change discontinuities

Page 26: Lecture: Introduction to Linear Programming for Natural Resource Economists and Landscape Ecologists

Objective function sensitivity

• Reduced Costs

• These indicate how much an objective function coefficient would have to improve before that decision variable enters the solution.

• For a decision variable that is already positive the reduced costs are zero

This is often really useful information because it can help tell you what combination of price and performance a new crop or technology requires for it to be a potential commercial success

Page 27: Lecture: Introduction to Linear Programming for Natural Resource Economists and Landscape Ecologists

Constraint Sensitivity

Constraint sensitivity

-50

150

350

550

750

950

1150

1350

1550

1750

0 200 400 600 800 1000

Product A

Pro

du

ct

B

Machine 1 = 3000 hrs

Machine 2 = 3000 hrs

Machine 3 =1800 hrs

Machine 3 =1900 hrs

Profit = £7000

Profit = £6000

Profit = £5000Feasible

Region

Page 28: Lecture: Introduction to Linear Programming for Natural Resource Economists and Landscape Ecologists

Constraint Sensitivity

• Original solution

• 675 units of A, 300 units of B and profit £5,925

• 100 more hours of machine 3

• 600 units of A, 400 units of B and profit £6,150

• Each additional hour of machine 3 is worth £2.25 (£6,150-£5,925)/100hrs = £2.25

• This is known as the dual price and each binding constraint will have a non-zero value.

• It is valid only over a limited range before another constraint becomes binding

Page 29: Lecture: Introduction to Linear Programming for Natural Resource Economists and Landscape Ecologists

Marginal cost behaviour

£0

£100,000

£200,000

£300,000

£400,000

£500,000

£600,000

£700,000

0 2 4 6 8 10 12 14

Net

Farm

Pro

fit

(1250 h

a)

Maximum number of workers

Page 30: Lecture: Introduction to Linear Programming for Natural Resource Economists and Landscape Ecologists

Marginal cost behaviour

£0

£5,000

£10,000

£15,000

£20,000

£25,000

£0

£100,000

£200,000

£300,000

£400,000

£500,000

£600,000

£700,000

0 2 4 6 8 10 12 14

Tra

cto

r D

ual

Co

st

Net

Farm

Pro

fit

(1250 h

a)

Maximum number of workers

Net Farm Profit (1250 ha) Tractor Dual Cost

Page 31: Lecture: Introduction to Linear Programming for Natural Resource Economists and Landscape Ecologists

Dual and shadow prices

• These are often treated synonymously

• Dual Price is the improvement in the value of the objective function per unit increase in a constraint's right-hand-side

• Shadow price is the change in the value of the objective function per unit increase in a constraint’s right-hand-side. See also marginal value product

• For maximisation problems they are identical, but for minimisation problems the shadow price is the negative of the dual price. (For a least cost problem a change of £10 is a -£10 improvement)

Page 32: Lecture: Introduction to Linear Programming for Natural Resource Economists and Landscape Ecologists

Examples

• Transportation networks

• Cost allocation in collaborative forest

transportation

• Estimating the costs of overlapping tenure

constraints: a case study in Northern Alberta,

Canada

Page 33: Lecture: Introduction to Linear Programming for Natural Resource Economists and Landscape Ecologists

Application: The SilsoeWhole Farm Model

• Whole farm planning LPs have two subtly different roles; Prescriptive uses guide an individual farmerto better decisions whereas predictive uses help understand how farmers response to choice or change. For the policy maker we are still doing prescriptive OR!!

• Profit maximisation has been effective for predicting the aggregate response of farmers to change.

• …even though there might be evidence that this does not describe how individuals behave!

Page 34: Lecture: Introduction to Linear Programming for Natural Resource Economists and Landscape Ecologists

0.00

1.00

2.00

3.00

4.00

5.00

6.00

7.00

0.1 1 10 100 1000 10000 100000 1000000 10000000

Arable area, ha

Perc

en

tag

e a

bs

rela

tiv

e e

rro

r

Page 35: Lecture: Introduction to Linear Programming for Natural Resource Economists and Landscape Ecologists

Soils and Weather

Workable

hours

Profitability

(or loss)

Crop and livestock

outputs

Environmental

Impacts

Possible crops,

yields, maturity

dates, sowing

dates

Silsoe Whole Farm ModelLinear programme, important features timeliness penalties,

rotational penalties, workability per task, uncertainty

Machines

and

people

Constraints

and

penalties

Page 36: Lecture: Introduction to Linear Programming for Natural Resource Economists and Landscape Ecologists

Heavy clay, 800 mm annual rainfall

0

50

100

150

200

250

7 Ja

n

7 Feb

7 M

ar

7 Apr

7 M

ay

7 Ju

n7

Jul

7 Aug

7 Sep

7 Oct

7 Nov

7 Dec

Ho

urs

Sandy loam, 500 mm annual rainfall

-

50

100

150

200

250

7 Ja

n

7 Feb

7 M

ar

7 Apr

7 M

ay

7 Ju

n7

Jul

7 Aug

7 Sep

7 Oct

7 Nov

7 Dec

Ho

urs

Workable hours v. tractor hours

Period, fortnights Period, fortnights

Page 37: Lecture: Introduction to Linear Programming for Natural Resource Economists and Landscape Ecologists
Page 38: Lecture: Introduction to Linear Programming for Natural Resource Economists and Landscape Ecologists

Low gross margin crop

(Sown spring, harvested September)

£370/ha versus £600-750/ha

Crop X

WRape

SBarley

WBarley

WWheat

Page 39: Lecture: Introduction to Linear Programming for Natural Resource Economists and Landscape Ecologists

Nitrate leaching scenarios on an arable sandy loam farm: crop areas; profit; N leaching and N use

Profit = £456/ha

N leach = 56.4 kg/ha

N use = 123.7 kg/ha

£430/ha

55.7 kg/ha

100 kg/ha

£433/ha

44.9 kg/ha

168.5 kg/ha

• N restricting policy increases Nitrate leaching - more spring crops increasing over-

winter leaching

• To decrease N leaching, grow crops which use the N applied efficiently

Base N < 100kg/ha Opt Profit + N leachWW

WB

SB

WR

WBn

RS

Pots

SBt

Peas

SR

SBn

More legumes.

No Oilseed rape

No legumes. No

Oilseed rape

Page 40: Lecture: Introduction to Linear Programming for Natural Resource Economists and Landscape Ecologists
Page 41: Lecture: Introduction to Linear Programming for Natural Resource Economists and Landscape Ecologists

4) LP: miscellaneous

• Working with LPs using computers

• Pointers to assumptions and limitations

• Extensions that solve some of the limitations

• Further reading

Page 42: Lecture: Introduction to Linear Programming for Natural Resource Economists and Landscape Ecologists

LP by computer

• Modelling environment that generates the matrix this maybe supported by databases to quantify the bio-physical data

• A solver which solves the matrix. The original method was the Simplex method although there are now interior point methods, which search through the interior of the simplex rather than the extreme points.

• A report writer that interrogates and presents the solution

Page 43: Lecture: Introduction to Linear Programming for Natural Resource Economists and Landscape Ecologists

LP by computer

• Modelling Environments: GAMS, AIMMS, AMPL

• Solvers: XpressMP, CPLEX, Excel’s Solver Add-in

(Frontline Systems Inc), LINDO

• Programming Languages (to provide the user-

interface and interaction with the solver), Visual

Basic…etc

Page 44: Lecture: Introduction to Linear Programming for Natural Resource Economists and Landscape Ecologists

Assumptions & limitations

Assumptions

• Divisibility

• Linearity

• Additivity

• Proportionality

• Determinism

• Limitations

• Comparative static analysis

• Data availability

• Technical and economic assumptions

• Handling risk and uncertainty

This is just a stub. You need to develop

this to have a critical appreciation of the

assumption and limitations of LPS and

quantitative methods in general in the

context of the economic (bio-physical)

problem that you are addressing

Page 45: Lecture: Introduction to Linear Programming for Natural Resource Economists and Landscape Ecologists

6) LP: Extensions

• Mixed Integer Linear Programming

• Quadratic programming

• Risk: variance co-variance matrix of activity returns

• Stochastic programming

• Multi-Criteria Decision Problems

• Goal Programming

• Multi-Objective Programming

• Compromise Programming

• Non-Linear Programming

• Piecewise Approximation

Page 46: Lecture: Introduction to Linear Programming for Natural Resource Economists and Landscape Ecologists

The End

• Thanks

[email protected]