SLIDE 1 Linear programming
Anders Ringgaard Kristensen
Department of Veterinary and Animal Sciences
SLIDE 2 Decision making in general
When a decision is made concerning a unit, the following information is necessary:
- The present state of the unit
- The relation between factors and production
- Immediate production
- Future production
- The farmer’s personal preferences
- All constraints of legal, economic, physical or personal
kind
Department of Veterinary and Animal Sciences
Slide 2
SLIDE 3 Linear programming
Knowledge representation:
- State of system:
- Hidden in model formulation – often as constraints or as parameters
- Factor/product relation:
- Immediate production:
- Linear function
- Future production:
- Static method
- Farmer preferences:
- Linear utility function
- Constraints:
- Linear constraints
Department of Veterinary and Animal Sciences
Slide 3
SLIDE 4 Example: Ration formulation
A group of dairy cows is fed a ration consisting of x1 kg silage and x2 kg concentrates. The price of silage is p1 and the price of concentrates is p2. The ration must satisfy some nutritional “demands”:
- The energy content must be at least b1.
- The AAT1 value must be at least b2
- The PBV2 value must be at most b3
- The fill must be at most b4
For both feeds, i, xi ≥ 0 Determine x1 and x2 so that the cost of the ration is minimized.
1AAT = Amino Acids absorbed in the intestine 2PBV = Protein balance in the rumen
State of the cows
Department of Veterinary and Animal Sciences
Slide 4
SLIDE 5 What are the states of the feeds?
Energy (SFU/kg) of silage and concentrates: a11 and a12, respectively. AAT (g/kg) of silage and concentrates: a21 and a22, respectively. PBV (g/kg) of silage and concentrates: a31 and a32, respectively. Fill (units/kg) of silage and concentrates: a41 and a42, respectively.
Department of Veterinary and Animal Sciences
Slide 5
SLIDE 6
What are the states of the feeds?
Silage Concentrates Energy a11 a12 AAT a21 a22 PBV a31 a32 Fill a41 a42
SLIDE 7 LP problem
p1x1 + p2x2 = Min! (minimize costs)
a11x1 + a12x2 ≥ b1 (energy at least b1) a21 x1 + a22x2 ≥ b2 (AAT at least b2) a31 x1 + a32x2 ≤ b3 (PBV at most b3) a41 x1 + a42x2 ≤ b4 (fill at most b4) x1 ≥ 0, x2 ≥ 0 Objective function Constraints
Department of Veterinary and Animal Sciences
Slide 7
SLIDE 8 LP - problem in matrix notation
px = Min!
Ax ≤ b where p = (p1 , p2), x = (x1, x2)’, b = (-b1, -b2, b3, b4)’, and
Department of Veterinary and Animal Sciences
Slide 8
SLIDE 9 The linear relations: Two “activities”
The permitted area is bounded by a straight line in the diagram
a11x1 + a12x2 ≥ b1 ⇔ x2 ≥ b1/a12 – (a11/a12)x1 x1
b1/a12
x2
Slope: a11/a12
Department of Veterinary and Animal Sciences
Slide 9
SLIDE 10
Graphical solution, convex area
Energy, ≥ AAT, ≥ PBV, ≤ Fill, ≤ The per-mitted area forms a convex set
x1 x2
SLIDE 11 The objective function
Combinations of x1 and x2 having same total cost form a straight line in the plane.
p1x1 + p2x2 = c (costs) For fixed cost c’ we have x2 = c’/p2 – (p1/p2)x1
Department of Veterinary and Animal Sciences
Slide 11
SLIDE 12
Graphical solution, iso-cost line
x1 x2 Combinations of x1 and x2 having cost c’ c’/p2 Slope: p1/p2
We want to minimize cost c’
SLIDE 13 Graphical solution, minimization
x1 x2
We want to minimize cost c’ Decrease c’ until the permitted area is reached. Decrease c’ until the lowest value of the permitted area is found. Optimal combination is x1’, x2’
x2’ x1’
SLIDE 14 What determines the optimum
For a given set of constraints, the optimum is determined solely by the price relations. In our two-dimensional example it is simply the price ratio p1/p2 Illustration
Department of Veterinary and Animal Sciences
Slide 14
SLIDE 15
Influence of prices, I
x1 x2
Original setting
x2’ x1’
SLIDE 16
Influence of prices, II
x1 x2
Slight increase of p1 Drastic change in terms of x1 and x2 but only sligtly in terms of costs c
x2’ x1’
SLIDE 17
Influence of prices, III
x1 x2
Large increase of p2 Drastic change in terms of x1 and x2 and to some extent c
x2’ x1’
SLIDE 18
Non-unique optimum
x1 x2
Increase of p2 All combinations of x1 and x2 along a border are optimal
SLIDE 19 Properties of linear programming
The permitted area is always a convex set The optimal solution is:
- Either uniquely located in a corner
- Or along a border line (accordingly also in two corners)
It is therefore sufficient to search the corners of the convex set.
A non-convex set A convex set
Department of Veterinary and Animal Sciences
Slide 19
SLIDE 20 Modeling tricks
From maximization to minimization:
- p1x1 + p2x2 = Max! ⇔ -p1x1 - p2x2 = Min!
From greater than to less than:
- ai1x1 + ai2x2 ≥ bi ⇔ -ai1x1 - ai2x2 ≤ -bi
From “equal to” to “less than”
- ai1x1 + ai2x2 = bi ⇔
- -ai1x1 - ai2x2 ≤ -bi
- ai1x1 + ai2x2 ≤ bi
Department of Veterinary and Animal Sciences
Slide 20
SLIDE 21 More than two variables
We cannot illustrate graphically anymore, but the same principles apply:
- Convex (multi-dimensional) set
- Optimum always in a corner
Department of Veterinary and Animal Sciences
Slide 21
SLIDE 22 The simplex algorithm
The most commonly applied optimization algorithm for linear programming. The simplex algorithm:
- Identifies a corner of the convex set forming the permitted area.
- Searches along the edges to find a better corner.
- Checks whether the present corner is optimal
Implemented in modern standard spreadsheets Implemented in ration formulation programs
Department of Veterinary and Animal Sciences
Slide 22
SLIDE 23 Shadow prices
What is the economic benefit of relaxing a constraint by one unit?
- If it is not limiting it is zero!
- Trivial method:
- Change the constraint by one
- Optimize again
- How much did the result improve?
- Software systems typically provides these values by
default.
Department of Veterinary and Animal Sciences
Slide 23
SLIDE 24 Basic assumptions of LP
Proportionality
- No start-up costs
- No decreasing returns to scale
Additivity
- No interactions between activities
Divisibility
- Any proportion of an activity allowed
Certainty
- All parameters (coefficients, prices, constraints) are known precisely.
Department of Veterinary and Animal Sciences
Slide 24
SLIDE 25
McCull and his sheep & steers
McCull owns 200 ha of pasture where he can have ewes and/or steers. Gross margins are $24 per ewe and $60 per steer. Limited carrying capacity – refer to table
Season Carrying capacity Ewes Steers Spring 15 5 Summer 24 4 Autumn 15 Winter 8
SLIDE 26
McCull: LP-problem
Objective function: 24x1 + 60x2 = Max! Constraints: Spring grazing 1/15 x1 + 1/5 x2 ≤ 200 Summer grazing 1/24 x1 + 1/4 x2 ≤ 200 Sheep in autumn x1 ≤ 3000 (i.e 15 x 200) Sheep in winter x1 ≤ 1600 (i.e 8 x 200) x1 ≥ 0, x2 ≥ 0
SLIDE 27 McCull: Graphical solution
500 1000 1500 2000 2500 3000 3500 4000 4500 5000 200 400 600 800 1000 Spring grazing Summer grazing Sheep in autumn Sheep in winter Iso-cost
Department of Veterinary and Animal Sciences
Slide 27
SLIDE 28 Herd constraints Optimization Biological variation Uncertainty Functional limitations Dynamics
Linear programming
Properties of methods for decision support
Department of Veterinary and Animal Sciences
Slide 28