Linear Programming
1 1
Part I: Linear Programming
Model Formulation and Graphical Solution
• Model Formulation
• A Maximization Model Example
• Graphical Solutions of Linear Programming Models
• A Minimization Model Example
• Irregular Types of Linear Programming Models
• Characteristics of Linear Programming Problems
Linear Programming - An Overview
• Objectives of business firms frequently include maximizing profit or
minimizing costs.
• Linear programming is an analysis technique in which linear
algebraic relationships represent a firm’s decisions given a business
objective and resource constraints.
• Steps in application:
1- Identify problem as solvable by linear programming.
2- Formulate a mathematical model of the unstructured problem.
3- Solve the model.
Model Components and Formulation
• Decision variables: mathematical symbols representing
levels of activity of a firm.
• Objective function: a linear mathematical relationship
describing an objective of the firm, in terms of decision
variables, that is maximized or minimized
• Constraints: restrictions placed on the firm by the
operating environment stated in linear relationships of
the decision variables.
• Parameters: numerical coefficients and constants used
in the objective function and constraint equations.
A Maximization Model Example (1 of 2)
Problem Definition
• Product mix problem - Beaver Creek Pottery
Company
• How many bowls and mugs should be produced to
maximize profits given labor and materials
constraints?
• Product resource requirements and unit profit:
Resource Requirements
Product Labor Clay Profit
(hr/unit) (lb/unit) ($/unit)
Bowl 1 4 40
Mug 2 3 50
A Maximization Model Example (2 of 2)
Resource availability:
40 hours of labor per day
120 pounds of clay
Decision Variables:
x1=number of bowls to produce/day
x2= number of mugs to produce/day
Objective function
maximize Z = $40x1 + 50x2
where Z= profit per day
Resource Constraints:
1x1 + 2x2 40 hours of labor
4x1 + 3x2 120 pounds of clay
Non-negativity Constraints:
x10; x2 0
Complete Linear Programming Model:
maximize Z=$40x1 + 50x2
subject to
1x1 + 2x2 40
4x2 + 3x2 120
x1, x2 0
Feasible/Infeasible Solutions
• A feasible solution does not violate any of the constraints:
Example x1= 5 bowls
x2= 10 mugs
Z = $40 x1 + 50x2= $700
Labor constraint check:
1(5) + 2(10) = 25 < 40 hours, within constraint
Clay constraint check:
4(5) + 3(10) = 70 < 120 pounds, within constraint
• An infeasible solution violates at least one of the constraints:
Example x1 = 10 bowls
x2 = 20 mugs
Z = $1400
Labor constraint check:
1(10) + 2(20) = 50 > 40 hours, violates constraint
Graphical Solution of Linear Programming Models
• Graphical solution is limited to linear programming
models containing only two decision variables. (Can be
used with three variables but only with great difficulty.)
• Graphical methods provide visualization of how a
solution for a linear programming problem is obtained.
Graphical Solution of a Maximization Model
Coordinate Axes
maximize Z=$40x1 + 50x2
subject to
1x1 + 2x2 40 hours of labor
4x2 + 3x2 120 pounds of clay
x1 , x2 0
Coordinates for graphical analysis
Graphical Solution of a Maximization Model
Labor Constraint
maximize Z=$40x1 + 50x2
subject to
1x1 + 2x2 40 hours of labor
4x2 + 3x2 120 pounds of clay
x1, x2 0
Graph of the labor constraint line
Graphical Solution of a Maximization Model
Labor Constraint Area
maximize Z=$40x1 + 50x2
subject to
1x1 + 2x2 40 hours of labor
4x2 + 3x2 120 pounds of clay
x1, x2 0
The labor constraint area
Graphical Solution of a Maximization Model
Clay Constraint Area
maximize Z=$40x1 + 50x2
subject to
1x1 + 2x2 40 hours of labor
4x2 + 3x2 120 pounds of clay
x1, x2 0
The constraint area for clay
Graphical Solution of a Maximization Model
Both Constraints
maximize Z=$40x1 + 50x2
subject to
1x1 + 2x2 40 hours of labor
4x2 + 3x2 120 pounds of clay
x1, x2 0
Graph of both model Constraints
Graphical Solution of a Maximization Model
Feasible Solution Area
maximize Z=$40x1 + 50x2
subject to
1x1 + 2x2 40 hours of labor
4x2 + 3x2 120 pounds of clay
x 1, x2 0
The feasible solution area constraints
Graphical Solution of a Maximization Model
Objective Function = $800
Z= $800 = $40x1 + 50x2
subject to
1x1 + 2x2 40 hours of labor
4x2 + 3x2 120 pounds of clay
x1, x2 0
Objective function line for Z 5 $800
Graphical Solution of a Maximization Model
Alternative Objective Functions
Z=$800, $1200, $1600 = $40x1 + 50x2
subject to
1x1 + 2x2 40 hours of labor
4x2 + 3x2 120 pounds of clay
x1, x2 0
Alternative objective function lines for profits, Z, of $800, $1,200, and $1,600
Graphical Solution of a Maximization Model
Optimal Solution
Z= $800 =$40x1 + 50x2
subject to
1x1 + 2x2 40 hours of labor
4x2 + 3x2 120 pounds of clay
x 1, x2 0
Identification of optimal solution point
Graphical Solution of a Maximization Model
Optimal Solution Coordinates
maximize Z=$40x1 + 50x2
subject to
1x1 + 2x2 40 hours of labor
4x2 + 3x2 120 pounds of clay
x1, x2 0
Optimal solution coordinates
Graphical Solution of a Maximization Model
Corner Point Solutions
maximize Z=$40x1 + 50x2
subject to
1x1 + 2x2 40 hours of labor
4x2 + 3x2 120 pounds of clay
x1, x2 0
Solutions at all corner points
Graphical Solution of a Maximization Model
Optimal Solution for New Objective Function
maximize Z=$40x1 + 50x2
subject to
1x1 + 2x2 40 hours of labor
4x2 + 3x2 120 pounds of clay
x1, x2 0
The optimal solution with Z 5 70x1 1 20x2
Slack Variables
• Standard form requires that all constraints be in the form of
equations.
• A slack variable is added to a constraint to convert it to an
equation (=).
• A slack variable represents unused resources.
• A slack variable contributes nothing to the objective function
value.
Complete Linear Programming Model in Standard Form
maximize Z=$40x1 + 50x2 + 0s1 + 0s2
subject to
1x1 + 2x2 + s1 = 40
4x2 + 3x2 + s2 = 120
x1,x2,s1,s2 = 0
where x1 = number of bowls
x2 = number of mugs
s1, s2 are slack variables
Solutions at points A, B, and C with slack
A Minimization Model Example
Problem Definition
• Two brands of fertilizer available - Super-gro, Crop-quick.
• Field requires at least 16 pounds of nitrogen and 24 pounds of phosphate.
• Super-gro costs $6 per bag, Crop-quick $3 per bag.
• Problem : How much of each brand to purchase to minimize total cost of
fertilizer given following data ?
Chemical Contribution
Nitrogen Phosphate
Brand (lb/bag) (lb/bag)
Super-gro 2 4
Crop-quick 4 3
A Minimization Model Example Model Construction
Decision variables
x1 = bags of Super-gro
x2 = bags of Crop-quick
The objective function:
minimize Z = $6x1 + 3x2
where $6x1 = cost of bags of Super-gro
3x2 = cost of bags of Crop-quick
Model constraints:
2x1 + 4x2 16 lb (nitrogen constraint)
4x1 + 3x2 24 lb (phosphate constraint)
x1, x2 0 (nonnegativity constraint)
A Minimization Model Example
Complete Model Formulation and Constraint Graph
Complete model formulation:
minimize Z = $6x1 + 3x2
subject to
2x1 + 4x2 16 lb of
nitrogen
4x1 + 3x2 24 lb of
phosphate
x1, x2 0
A Minimization Model Example
Feasible Solution Area
minimize Z = $6x1 + 3x2
subject to
2x1 + 4x2 16 lb of nitrogen
4x1 + 3x2 24 lb of phosphate
x1, x2 0
Feasible solution area
A Minimization Model Example
Optimal Solution Point
minimize Z = $6x1 + 3x2
subject to
2x1 + 4x2 16 lb of nitrogen
4x1 + 3x2 24 lb of phosphate
x1, x2 0
The optimal solution point
A Minimization Model Example
Surplus Variables
• A surplus variable is subtracted from a constraint to convert it
to an equation (=).
• A surplus variable represents an excess above a constraint
requirement level.
• Surplus variables contribute nothing to the calculated value of
the objective function.
• Subtracting slack variables in the farmer problem constraints:
2x1 + 4x2 - s1 = 16 (nitrogen)
4x1 + 3x2 - s2 = 24 (phosphate)
A Minimization Model Example
Graphical Solutions
Minimize
Z = $6x1 + 3x2 + 0s1 + 0s2
subject to
2x1 + 4x2 - s1 = 16
4x1 + 3x2 - s2 = 24
x1, x2, s1, s2 = 0
Graph of the fertilizer example
Irregular Types of Linear Programming
Problems
• For some linear programming models, the general rules
do not apply.
• Special types of problems include those with:
1. Multiple optimal solutions
2. Infeasible solutions
3. Unbounded solutions
Multiple Optimal Solutions
Objective function is parallel to a
constraint line:
maximize Z=$40x1 + 30x2
subject to
1x1 + 2x2 40 hours of labor
4x2 + 3x2 120 pounds of clay
x1, x2 0
where x1 = number of bowls
x2 = number of mugs
Graph of the Beaver Creek Pottery Company example with multiple
optimal solutions
An Infeasible Problem
Every possible solution violates
at least one constraint:
maximize Z = 5x1 + 3x2
subject to
4x1 + 2x2 8
x1 4
x2 6
x1, x2 0
Graph of an infeasible problem
An Unbounded Problem
Value of objective function
increases indefinitely:
maximize Z = 4x1 + 2x2
subject to
x1 4
x2 2
x1, x2 0
An unbounded problem
Characteristics of Linear Programming Problems
• A linear programming problem requires a decision - a choice
amongst alternative courses of action.
• The decision is represented in the model by decision variables.
• The problem encompasses a goal, expressed as an objective
function, that the decision maker wants to achieve.
• Constraints exist that limit the extent of achievement of the
objective.
• The objective and constraints must be definable by linear
mathematical functional relationships.
Properties of Linear Programming Models
• Proportionality - The rate of change (slope) of the
objective function and constraint equations is constant.
• Additivity - Terms in the objective function and constraint
equations must be additive.
• Divisability -Decision variables can take on any fractional
value and are therefore continuous as opposed to
integer in nature.
• Certainty - Values of all the model parameters are
assumed to be known with certainty (non-probabilistic).
Example Problem No. 1
Problem Statement
Hot dog mixture in 1000-Kg batches.
Two ingredients, chicken ($3/Kg) and beef ($5/Kg),
Recipe requirements:
at least 500 Kg of chicken
at least 200 Kg of beef.
• Ratio of chicken to beef must be at least 2 to 1.
• Determine optimal mixture of ingredients that will minimize
costs.
Example Problem No. 1
Solution
Step 1: Identify decision variables.
x1 = Kg of chicken
x2 = Kg of beef
Step 2: Formulate the objective function.
minimize Z = $3x1 + 5x2
where Z = cost per 1,000-Kg batch
$3x1 = cost of chicken
5x2 = cost of beef
Example Problem No.1
Solution (continued)
Step 3: Establish Model Constraints
x1 + x2 = 1,000 Kg
x1 500 Kg of chicken
x2 200 Kg of beef
x1/x2 2/Kg or x1 - 2x2 0
x1,x2 0
The model: minimize Z = $3x1 + 5x2
subject to
x1 + x2 = 1,000 Kg
x1 50
x2 200
x1 - 2x2 0
x1,x2 0
Example Problem No.2
Solve the following model
graphically:
maximize Z = 4x1 + 5x2
subject to
x1 + 2x2 10
6x1 + 6x2 36
x1 4
x1,x2 0
Step 1: Plot the constraint s as
equations:
The constraint equations
Example Problem No.2
maximize Z = 4x1 + 5x2
subject to
x1 + 2x2 1
6x1 + 6x2 36
x1 4
x1,x2 0
Step 2: Determine the feasible
solution area:
The feasible solution space and extreme points
Example Problem No.2
maximize Z = 4x1 + 5x2
subject to
x1 + 2x2 10
6x1 + 6x2 36
x1 4
x1,x2 0
Steps 3 and 4:
Determine the solution points
and optimal solution.
Optimal solution point
Part II: Linear Programming
Modeling Examples
• A Product Mix Example
• A Diet Example
• An Investment Example
• A Marketing Example
• A Transportation Example
• A Blend Example
• A Multiperiod Scheduling Example
• A Data Envelopment Analysis Example
Product Mix Example
Problem Definition
- Four-product T-shirt/sweatshirt manufacturing company.
- Must complete production within 72 hours
- Truck capacity = 1,200 standard sized boxes.
- Standard size box holds12 T-shirts.
- One-dozen sweatshirts box is three times size of standard box.
- $25,000 available for a production run.
- 500 dozen blank T-shirts and sweatshirts in stock.
- How many dozens (boxes) of each type of shirt to produce?
43
Product Mix Example
Data
Processing Cost Profit
Time (hr) ($) ($)
Per dozen per dozen per dozen
Sweatshirt - F 0.10 36 90
Sweatshirt – 0.25 48 125
B/F
T-shirt - F 0.08 25 45
T-shirt - B/F 0.21 35 65
Product Mix Example
Model Construction
Decision variables:
x1 = sweatshirts, front printing
x2 = sweatshirts, back and front printing
x3 = T-shirts, front printing
x4 = T-shirts, back and front printing
Objective function:
maximize Z = $90x1 + 125x2 + 45x3 + 65x4
Model constraints:
0.10x1 + 0.25x2+ 0.08x3 + 0.21x4 72 hr
3x1 + 3x2 + x3 + x4 1,200 boxes
$36x1 + 48x2 + 25x3 + 35x4 $25,000
x1 + x2 500 dozen sweatshirts
x3 + x4 500 dozen T-shirts
Product Mix Example
Computer Solution with QM for Windows
maximize Z = $90x1 + 125x2 + 45x3 + 65x4
subject to:
0.10x1 + 0.25x2+ 0.08x3 + 0.21x4 72
3x1 + 3x2 + x3 + x4 1,200 boxes
$36x1 + 48x2 + 25x3 + 35x4 $25,000
x1 + x2 500 dozed sweatshirts
x3 + x4 500 dozen T-shirts
x1, x2, x3, x4 0
Product Mix Example
Computer Solution with QM for Windows (continued)
maximize Z = $90x1 + 125x2 + 45x3 + 65x4
subject to:
0.10x1 + 0.25x2+ 0.08x3 + 0.21x4 72
3x1 + 3x2 + x3 + x4 1,200 boxes
$36x1 + 48x2 + 25x3 + 35x4 $25,000
x1 + x2 500 dozed sweatshirts
x3 + x4 500 dozen T-shirts
x1, x2, x3, x4 0
Diet Example
Data and Problem Definition
Breakfast Fat Cholesterol Iron Calcium Protein Fiber Cost
Food Calories (g) (mg) (mg) (mg) (g) (g) ($)
1. Bran cereal (cup) 90 0 0 6 20 3 5 0.18
2. Dry cereal (cup) 110 2 0 4 48 4 2 0.22
3. Oatmeal (cup) 100 2 0 2 12 5 3 0.10
4. Oat bran (cup) 90 2 0 3 8 6 4 0.12
5. Egg 75 5 270 1 30 7 0 0.10
6. Bacon (slice) 35 3 8 0 0 2 0 0.09
7. Orange 65 0 0 1 52 1 1 0.40
8. Milk-2% (cup) 100 4 12 0 250 9 0 0.16
9. Orange juice (cup) 120 0 0 0 3 1 0 0.50
10.Wheat toast (slice) 65 1 0 1 26 3 3 0.07
Breakfast to include at least 420 calaries, 5 milligrams of iron, 400 milligrams of calcium, 20
grams of protein, 12 grams of fiber, and must have no more than 20 grams of fat and 30 milligrams
of cholesterol.
Diet Example
Model Construction: Decision Variables
x1 = cups of bran cereal
x2 = cups of dry cereal
x3 = cups of oatmeal
x4 = cups of oat bran
x5 = eggs
x6 = slices of bacon
x7 = oranges
x8 = cups of milk
x9 = cups of orange juice
x10 = slices of wheat toast
Diet Example
Model Summary
minimize Z =0.18x1 + 0.22x2 + 0.10x3 + 0.12x4 + 0.10x5 + 0.09x6+ 0.40x7 + 0.16x8 +
0.50x9 0.07x10
subject to
90x1 + 110x2 + 100x3 + 90x4 + 75x5 + 35x6 + 65x7 + 100x8 + 120x9 + 65x10 420
2x2 + 2x3 + 2x4 + 5x5 + 3x6 + 4x8 + x10 20
270x5 + 8x6 + 12x8 30
6x1 + 4x2 + 2x3 + 3x4+ x5 + x7 + x10 5
20x1 + 48x2 + 12x3 + 8x4+ 30x5 + 52x7 + 250x8 + 3x9 + 26x10 400
3x1 + 4x2 + 5x3 + 6x4 + 7x5 + 2x6 + x7+ 9x8+ x9 + 3x10 20
5x1 + 2x2 + 3x3 + 4x4+ x7 + 3x10 12
xi 0
An Investment Example
Model Summary
maximize Z = $0.085x1 + 0.05x2 + 0.065 x3+ 0.130x4
subject to
x1 14,000
x2 - x1 - x3- x4 0
x2 + x3 21,000
-1.2x1 + x2 + x3 - 1.2 x4 0
x1 + x2 + x3 + x4 = 70,000
x1, x2, x3 , x4 0
where
x1 = amount invested in municipal bonds ($)
x2 = amount invested in certificates of deposit ($)
x3 = amount invested in treasury bills ($)
x4 = amount invested in growth stock fund($)
A Marketing Example
Data and Problem Definition
Exposure Cost
(people/ad or
commercial)
Television 20,000 $15,000
commercial
Radio commercial 12,000 6,000
Newspaper ad 9,000 4,000
- Budget limit $100,000
- Television time for four commercials
- Radio time for 10 commercials
- Newspaper space for 7 ads
- Resources for no more than 15 commercials and/or ads.
Transportation Example
Problem Definition and Data
Warehouse supply of televisions sets: Retail store demand for television sets:
1- Cinncinnati 300 A. - New York 150
2- Atlanta 200 B. - Dallas 250
3- Pittsburgh 200 C. - Detroit 200
total 700 total 600
From To Store
Warehouse
A B C
1 $16 $18 $11
2 14 12 13
3 13 15 17
A Blend Example
Problem Definition and Data
Determine the optimal mix of the three components in each grade of motor oil that will maximize
profit. Company wants to produce at least 3,000 barrels of each grade of motor oil.
Maximum Barrels
Component Cost/barrel
Available/day
1 4,500 $12
2 2,700 10
3 3,500 14
Grade Component Specifications Selling Price ($/bbl)
Super At least 50% of 1 $23
Not more than 30% of 2
Premium At least 40% of 1 20
Not more than 25% of 3
Extra At least 60% of 1 18
At least 10% of 2
A Blend Example
Decision Variables and Model Summary
Decision variables: The quantity of each of the three components used in each grade of
gasoline (9 decision variables); xij = barrels of component i used in motor oil grade j per day,
where i = 1, 2, 3 and j = s (super), p(premium), and e(extra).
Model Summary: maximize Z = 11x1s + 13x2s + 9x3s + 8x1p + 10x2p + 6x3p + 6x1e + 8x2e + 4x3e
subject to
x1s + x1p + x1e 4,500
x2s + x2p + x2e 2,700
x3s + x3p + x3e 3,500
0.50x1s - 0.50x2s - 0.50x3s 0
0.70x2s - 0.30x1s - 0.30x3s 0
0.60x1p - 0.40x2p - 0.40x3p 0
0.75x3p - 0.25x1p - 0.25x2p 0
0.40x1e- 0.60x2e- - 0.60x3e 0
0.90x2e - 0.10x1e - 0.10x3e 0
x1s + x2s + x3s 3,000
x1p+ x2p + x3p 3,000
x1e+ x2e + x3e 3,000
xij 0
A Multiperiod Scheduling Example
Problem Definition and Data
Production capacity : 160 computers per week
Additional 50 computers with overtime
Assembly costs: $190/comp. regular time; $260/comp. overtime
Inventory cost: $10/comp. per week
Order schedule: Week Computer Orders
1 105
2 170
3 230
4 180
5 150
6 250
A Multiperiod Scheduling Example
Decision Variables and Model Summary
Decision variables:
rj = regular production of computers per week j (j = 1, 2, 3, 4, 5, 6)
oj = overtime production of computers per week j (j = 1, 2, 3, 4, 5, 6)
ij = extra computers carried over as inventory in week j (j = 1, 2, 3, 4, 5)
Model summary:
minimize Z = $190(r1 + r2 + r3 + r4 + r5 + r6) + $260(o1 + o2 + o3 + o4 + o5 +o6) + 10(i1, + i2 + i3 + i4 + i5)
subject to rj 160 (j = 1, 2, 3, 4, 5, 6)
oj 150 (j = 1, 2, 3, 4, 5, 6)
r1 + o1 - i1 105
r2 + o2 + i1 - i2 170
r3 + o3 + i2 - i3 230
r4 + o4 + i3 - i4 180
r5 + o5 + i4 - i5 150
r6 + o6 + i5 250
rj, oj, ij 0
A Data Envelopment Analysis (DEA) Example
Problem Definition and Data
DEA compares a number of service units of the same type based on their inputs (resources) and
outputs. The result indicates if a particular unit is less productive, or efficient, than other units.
Elementary school comparison:
input 1 = teacher to student ratio output 1 = average reading SOL score
input 2 = supplementary $/student output 2 = average math SOL score
input 3 = parent education level output 3 = average history SOL score
Inputs Outputs
School 1 2 3 1 2 3
Alton .06 $260 11.3 86 75 71
Beeks .05 320 10.5 82 72 67
Carey .08 340 12.0 81 79 80
Delancey .06 460 13.1 81 73 69
A Data Envelopment Analysis (DEA) Example
Decision Variables and Model Summary
Decision variables:
xi = a price per unit of each output where i = 1, 2, 3
yi = a price per unit of each input where i = 1, 2, 3
Model summary:
maximize Z = 81x1 + 73x2 + 69x3
subject to
.06 y1 + 460y2 + 13.1y3 = 1
86x1 + 75x2 + 71x3 .06y1 + 260y2 + 11.3y3
82x1 + 72x2 + 67x3 .05y1 + 320y2 + 10.5y3
81x1 + 79x2 + 80x3 .08y1 + 340y2 + 12.0y3
81x1 + 73x2 + 69x3 .06y1 + 460y2 + 13.1y3
xi, y i 0
Example Problem Solution
Problem Statement and Data
• Canned catfood, Meow Chow; dogfood, Bow Chow.
• Ingredients/week: 600lb horse meat; 800 lb fish; 1000 lb cereal.
• Recipe requirement: Meow Chow at least half fish; Bow Chow
at least half horse meat.
• 2,250 sixteen-ounce cans available each week.
• Profit /can: Meow Chow $0.80; Bow Chow$0.96.
• How many cans of Bow Chow and Meow Chow should be
produced each week in order to maximize profit?
Example Problem Solution
Model Formulation
Step 1: Define the Decision Variables
xij = ounces of ingredient i in pet food j per week, where i = h (horse meat), f (fish) and
c (cereal), and j = m (Meow chow) and b (Bow Chow).
Step 2: Formulate the Objective Function
maximize Z = $0.05(xhm + xfm + xcm) + 0.06(xhb + xfb + xcb)
Step 3: Formulate the Model Constraints
Amount of each ingredient available each week:
xhm + xhb 9,600 ounces of horse meat
xfm + xfb 12,800 ounces of fish
xcm + xcb 16,000 ounces of cereal additive
Recipe requirements:
Meow Chow xfm/(xhm + xfm + xcm) 1/2, or, - xhm + xfm- xcm 0
Bow Chow xhb/(xhb + xfb + xcb) 1/2, or, xhb- xfb - xcb 0
Can content constraint: xhm + xfm + xcm + xhb + xfb+ xcb 36,000 ounces
Example Problem Solution
Model Summary and Solution with QM for Windows
Step 4: Model Summary
maximize Z = $0.05 xhm + 0.05 xfm + 0.05 xcm + 0.06 xhb + 0.06 xfb + 0.06 x
subject to xhm + xhb 9,600 ounces of horse meat
xfm + xfb 12,800 ounces of fish
xcm + xcb 16,000 ounces of cereal additive
- xhm + xfm- xcm 0
xhb- xfb - xcb 0
xhm + xfm + xcm + xhb + xfb+ xcb 36,000 ounces
xij 0