You are on page 1of 61

Introduction to

Linear Programming
Introduction to LP
• A mathematical technique applied to a business
problem to allocate scarce resources to achieve
the best-desired outcome
• Linear programming (LP)
• “Programming” is not computer coding
• It means using algorithms to mathematically solve a real-
world problem
• “Linear” requires that all mathematical expressions
be linear equations or inequalities
• Of the first degree, no squared, high power, or interaction
Introduction to LP
• George Dantzig developed the simplex
algorithm in 1947, after World War II.
• It remains the primary solution method for
LP problems.
Major Components
1. Decision variables
• Unknown values to be solved for that
inform decision
• Numerical values represent levels of activity
• Examples: units to produce, hours to work,
marketing impact by channel, investment options,
number of employees per shift
Major Components
2. Objective function
• Mathematical relationship using
decision variables
• Usually revenue, cost, or profit
• Other examples include number of employees,
marketing exposures, portfolio risk, return on
investment (ROI), etc.
• Goal to maximize or minimize
objective function
Major Components
3. Constraints
• Limitations on available resources or
restrictive guidelines
• Examples: 40 hours per week of labor, demand for
product, budget
Assumptions of LP
• Certainty: the number of objectives and constraints are
known and do not change during analysis
• Proportionality: if the production of one unit consumes
three hours, then the production of 10 units consumes
30 hours
• Additivity: the total of all individual activities equals the
sum of the individual activities
• Divisibility: solutions can have fractional solutions
• If whole numbers are required, use integer programming
• Non-negativity: negative quantities of physical
resources are not possible END
Linear Programming
Example
Example 1: Gasoline Production
An organization produces three different gasoline products in three
octane levels: super, high, and regular. It sells these products at prices
of $200, $150, and $120 per barrel, respectively. Additionally, there is
limited demand for each octane level, the facilities have a minimum
production requirement, and due to environmental regulations, a
pollutant called X2C4 released by a company during production must be
limited to a maximum average 400 ppm. Maximum demand is 1,000
barrels of super, 1,500 of high, and 2,500 of regular. Production
requires a minimum of 500 barrels of each octane. Each product
individually contributes 300 ppm of X2C4 for super, 380 for high, and
450 for regular. Finally, the cost to produce each level of octane are
$160 per barrel of super, $120 per barrel of high, and $100 per barrel
of regular. The company wishes to maximize profit in the production
and sale of gasoline.
Objective Function
An organization produces three different gasoline products in three
octane levels: super, high, and regular. It sells these products at prices
of $200, $150, and $120 per barrel, respectively. Additionally, there is
limited demand for each octane level, the facilities have a minimum
production requirement, and due to environmental regulations, a
pollutant called X2C4 released by a company during production must be
limited to a maximum average 400 ppm. Maximum demand is 1,000
barrels of super, 1,500 of high, and 2,500 of regular. Production
requires a minimum of 500 barrels of each octane. Each product
individually contributes 300 ppm of X2C4 for super, 380 for high, and
450 for regular. Finally, the cost to produce each level of octane are
$160 per barrel of super, $120 per barrel of high, and $100 per barrel
of regular. The company wishes to maximize profit in the
production and sale of gasoline.
Objective Function Revenue
An organization produces three different gasoline products in three
octane levels: super, high, and regular. It sells these products at
prices of $200, $150, and $120 per barrel, respectively. Additionally,
there is limited demand for each octane level, the facilities have a
minimum production requirement, and due to environmental
regulations, a pollutant called X2C4 released by a company during
production must be limited to a maximum average 400 ppm. Maximum
demand is 1,000 barrels of super, 1,500 of high, and 2,500 of regular.
Production requires a minimum of 500 barrels of each octane. Each
product individually contributes 300 ppm of X2C4 for super, 380 for high,
and 450 for regular. Finally, the cost to produce each level of
octane are $160 per barrel of super, $120 per barrel of high, and
$100 per barrel of regular. The company wishes to maximize profit in
the production and sale of gasoline.
Objective Function Cost
An organization produces three different gasoline products in three
octane levels: super, high, and regular. It sells these products at
prices of $200, $150, and $120 per barrel, respectively. Additionally,
there is limited demand for each octane level, the facilities have a
minimum production requirement, and due to environmental
regulations, a pollutant called X2C4 released by a company during
production must be limited to a maximum average 400 ppm. Maximum
demand is 1,000 barrels of super, 1,500 of high, and 2,500 of regular.
Production requires a minimum of 500 barrels of each octane. Each
product individually contributes 300 ppm of X2C4 for super, 380 for high,
and 450 for regular. Finally, the cost to produce each level of
octane are $160 per barrel of super, $120 per barrel of high, and
$100 per barrel of regular. The company wishes to maximize profit in
the production and sale of gasoline.
Constraint 1: Maximum Demand
An organization produces three different gasoline products in three
octane levels: super, high, and regular. It sells these products at prices
of $200, $150, and $120 per barrel, respectively. Additionally, there is
limited demand for each octane level, the facilities have a minimum
production requirement, and due to environmental regulations, a
pollutant called X2C4 released by a company during production must be
limited to a maximum average 400 ppm. Maximum demand is 1,000
barrels of super, 1,500 of high, and 2,500 of regular. Production
requires a minimum of 500 barrels of each octane. Each product
individually contributes 300 ppm of X2C4 for super, 380 for high, and
450 for regular. Finally, the cost to produce each level of octane are
$160 per barrel of super, $120 per barrel of high, and $100 per barrel
of regular. The company wishes to maximize profit in the production
and sale of gasoline.
Constraint 2: Minimum Production
An organization produces three different gasoline products in three
octane levels: super, high, and regular. It sells these products at prices
of $200, $150, and $120 per barrel, respectively. Additionally, there is
limited demand for each octane level, the facilities have a minimum
production requirement, and due to environmental regulations, a
pollutant called X2C4 released by a company during production must be
limited to a maximum average 400 ppm. Maximum demand is 1,000
barrels of super, 1,500 of high, and 2,500 of regular. Production
requires a minimum of 500 barrels of each octane. Each product
individually contributes 300 ppm of X2C4 for super, 380 for high, and
450 for regular. Finally, the cost to produce each level of octane are
$160 per barrel of super, $120 per barrel of high, and $100 per barrel
of regular. The company wishes to maximize profit in the production
and sale of gasoline.
Constraint 3: Pollution Limit
An organization produces three different gasoline products in three
octane levels: super, high, and regular. It sells these products at
prices of $200, $150, and $120 per barrel, respectively. Additionally,
there is limited demand for each octane level, the facilities have a
minimum production requirement, and due to environmental
regulations, a pollutant called X2C4 released by a company during
production must be limited to a maximum average 400 ppm.
Maximum demand is 1,000 barrels of super, 1,500 of high, and
2,500 of regular. Production requires a minimum of 500 barrels of
each octane. Each product individually contributes 300 ppm of
X2C4 for super, 380 for high, and 450 for regular. Finally, the
cost to produce each level of octane are $160 per barrel of super,
$120 per barrel of high, and $100 per barrel of regular. The
company wishes to maximize profit in the production and sale of
gasoline.
Major Components for Example 1

1. Decision variables
• X1 = barrels of super octane produced
• X2 = barrels of high octane produced
• X3 = barrels of regular octane produced
2. Objective function
• Maximize profit
• (200 – 160) * X1 + (150 – 120) * X2 +
(120 – 100) * X3
• Or, maximize
• 40X1 + 30X2 + 20X3
Major Components for Example 1

3. Constraints
• Limited demand
• Minimum production
• Restrictive environmental limit

END
Input Data Structure
Try problem on Sheet 1
Practice Problem Solution
1. Decision variables
• X1 = quantity of coats produced each week
• X2 = quantity of slacks produced each week
2. Objective function
• Maximize profit
• (280 – 4 * 10 – 10 * 20) * X1 + (170 – 5 * 10 – 4 * 20) * X2
• Completing the calculations in parentheses:
• Maximize: 40 * X1 + 40 * X2

3. Constraints
• Limited material
• Limited production hours
Example 1: Input Data
• Convenient to arrange in table form
Units Super High Regular Limit
Price $/barrel 200 150 120
Cost $/barrel 160 120 100
Max demand barrels 1,000 1,500 2,500
Min production barrels 500 500 500
X2C4 average released 300 380 450 400
Example 1: Input Data
• Convenient to arrange in table form
Units Super High Regular Limit
Price $/barrel 200 150 120
Cost $/barrel 160 120 100
Max demand barrels 1,000 1,500 2,500
Min production barrels 500 500 500
X2C4 average released 300 380 450 400

Variables X1 X2 X3
Amount
barrels
produced
END
Developing Constraints
Example 1: Defining Constraints

• There is a limit to the demand of each


octane.
• Facilities have a minimum
production requirement.
• Regulations limit the total X2C4 pollutant
released during production.
Structure of an LP Constraint
• Constraints are mathematical relationships that have a
specific structure.
Left-hand side Sign Right-hand side
𝑛

∑ 𝑎𝑖 𝑏𝑖 ≤ , =, ≥ 𝑁𝑢𝑚𝑒𝑟𝑖𝑐 𝐿𝑖𝑚𝑖𝑡
𝑖=1
• Example: A company has 40 hours each week to build
tables and chairs. It takes five hours of labor to build a
table and two hours of labor to build a chair.
5X1 + 2X2 ≤ 40
• Where X1 = number of tables built, and
X2 = number of chairs built each week.
Constraint 1: Limited Demand
The company would not produce more than the
potential demand for any given octane (why
produce excess?). Maximum demand is 1,000
barrels of super, 1,500 of high, and 2,500 of
regular.
• X1 ≤ 1,000 1X1 + 0X2 + 0X3 ≤ 1,000
• X2 ≤ 1,500 0X1 + 1X2 + 0X3 ≤ 1,500
• X3 ≤ 2,500 0X1 + 0X2 + 1X3 ≤ 2,500

Expanded form
Constraint 2: Minimum Production
Facilities require a minimum production of 500
barrels for each octane level.
• X1 ≥ 500 1X1 + 0X2 + 0X3 ≥ 500
• X2 ≥ 500 0X1 + 1X2 + 0X3 ≥ 500
• X3 ≥ 500 0X1 + 0X2 + 1X3 ≥ 500

Expanded form

END
Standard Form Constraints
Example 2 Constraints: Solution

1. Decision variables
• X1 = quantity of coats produced each week
• X2 = quantity of slacks produced each week
2. Constraints
1. Material: 4X1 + 5X2 ≤ 150
2. Labor: 10X1 + 4X2 ≤ 200
Constraint 3: Limited
Pollution Release
• Environmental regulations limit the total release of X2C4
by a company to a maximum average of 400 ppm.
• Since we know the amount contributed by each individual octane
level, we use a weighted average formula as follows:

Total PPM released


≤ Limit
Total gasoline produced

Not 300X1 + 350X2 + 450X3


standard ≤ 400
form X1 + X2 + X3
Standard Form
𝑛

∑ 𝑎𝑖 𝑏𝑖 𝑠𝑖𝑔𝑛 ( ≤ ,=, ≥ ) 𝑁𝑢𝑚𝑒𝑟𝑖𝑐 𝐿𝑖𝑚𝑖𝑡


𝑖=1
𝑛
Where, ∑ 𝑎𝑖 𝑏𝑖 =𝑎1 𝑏1+ 𝑎2 𝑏2 +𝑎3 𝑏3 +⋯ +𝑎𝑛 𝑏𝑛
𝑖=1

• In our case, if we have n x-variables:


• If the a-vector = numerical coefficients
• And the b-vector = decision variables
𝑛

∑ 𝐶𝑖 𝑥 𝑖=𝐶 1 𝑥1 +𝐶 2 𝑥 2 +𝐶 3 𝑥3 +⋯+𝐶𝑛 𝑥𝑛
𝑖=1
Restrictive Environmental Limit
Need to rearrange the left-hand side quotient to standard
form
300X1 + 350X2 + 450X3
≤ 400
X1 + X2 + X3
300X1 + 350X2 + 450X3 ≤ 400 * ( X1 + X2 + X3 )

300X1 + 350X2 + 450X3 ≤ 400 * X1 + 400 * X2 + 400 * X3

(300 – 400) * X1 + (350 – 400) * X2 + (450 – 400) * X3 ≤ 0

Standard form –100 * X1 – 50 * X2 + 50 * X3 ≤ 0


LP Setup of Example 1
• Variables • Constraints
• X1 = barrels of 1x1 + 0x2 + 0x3  1,000
super produced 0x1 + 1x2 + 0x3  1,500
• X2 = barrels of 0x1 + 0x2 + 1x3  2,500
high produced
1x1 + 0x2 + 0x3  500
• X3 = barrels of
regular produced 0x1 + 1x2 + 0x3  500

• Objective function 0x1 + 0x2 + 1x3  500


• Maximize profit –100x1 – 20x2 + 50x3  0
• 40X1 + 30X2 + 20X3
Final LP Setup of Example 1
• Variables • Constraints
• X1 = barrels of 1x1 + 0x2 + 0x3  1,000
super produced 0x1 + 1x2 + 0x3  1,500
• X2 = barrels of 0x1 + 0x2 + 1x3  2,500
high produced
1x1 + 0x2 + 0x3  500
• X3 = barrels of
regular produced 0x1 + 1x2 + 0x3  500

• Objective function 0x1 + 0x2 + 1x3  500


• Maximize profit –100x1 – 20x2 + 50x3  0
• 40X1 + 30X2 + 20X3 • 1x1 0
Non-negativity constraints • 1x2 0
• 1x3  0
Input Data for Example 2
Coats Slacks Available Cost
Material 4 5 150 10
Labor 10 4 200 20
Price 280 170    

Variables Coats Slacks


Amount
produced

Analyze the quantity of coats and slacks to produce that


maximizes profit subject to limited material and labor.

END
Revisiting Example 2
Practice Problem Solution
Graph the Constraints and Objective Function.
Identify the feasible region
1. Decision variables
• X1 = quantity of coats produced each week
• X2 = quantity of slacks produced each week
2. Objective function
• Maximize profit
• 40 * X1 + 40 * X2

3. Constraints
• Material 4 * X1+ 5 * X2 150
• Production 10 * X1+ 4 * X2 200
• Graph
Practice Problem Final LP Setup
• Maximize 40x1 + 40x2
• Subject to:
4x1 + 5x2  150 (material)
10x1 + 4x2  200 (labor)
1x1  0 (non-negativity)
1x2  0 (non-negativity)

• What values for x1 and x2 satisfy the constraints


and maximize the objective function? END
Monet Frames
Example
• Inputs
• Produce two types of frames labeled 1 and 2
• Data
Skilled Selling Maximum
Frame Metal Glass
labor price demand
1 2 4 6 $28.50 1,000
2 1 2 2 $12.50 2,000
4,000
Capacity 6,000 ounces 10,000 ounces
hours
Cost $8.00/hr $0.50/oz $0.75/oz

• Output
• Company wants to maximize weekly profits
Monet Decision Variables
• Objective function: maximize profit
• Profit is a function of revenue and cost
which are functions of the quantity of each
frame type produced, we set:
• X1 = quantity of type 1 frames produced
• X2 = quantity of type 2 frames produced
Monet Profit Coefficients
Skilled Selling Maximum
Frame Metal Glass
labor price demand
1 2 4 6 $28.50 1,000
2 1 2 2 $12.50 2,000
4,000
Capacity 6,000 ounces 10,000 ounces
hours
Cost $8.00/hr $0.50/oz $0.75/oz

Frame 1 unit profit: Frame 2 unit profit:


Revenue $28.50 Revenue $12.50
– Cost Labor 2 hours * $8/hr – Cost Labor 1 hours * $8/hr
Metal 4 oz * $0.50/oz Metal 2 oz * $0.50/oz
Glass 6 oz * $0.75/oz Glass 2 oz * $0.75/oz
= Profit/frame $6/frame = Profit/frame $2/frame
Objective function: maximize 6x1 + 2x2
Monet Frames Final Formulation

• Maximize 6x1 + 2x2


• Subject to:
2x1 + 1x2  4,000 (labor)
4x1 + 2x2  6,000 (metal)
6x1 + 2x2  10,000 (glass)
1x1  1,000 (demand frame 1)
1x2  2,000 (demand frame 2)
1x1  0 (non-negativity)
1x2  0 (non-negativity)
Graph Constraints
Graph each constraint as follows:
• Change the inequality to an equality
• Set X1 = 0, solve for X2 = ?
• Set X2 = 0, solve for X1 = ?
• Graph the two points and connect the dots
• Replace the equality with the inequality
again and shade the feasible region
Constraint 1: Graph Labor Constraint
2X1 + 1X2  4,000
Set X1 = 0, then
2(0) + 1X2 = 4,000
X2 = 4,000
6000

5000

4000 2X1 + 1X2  4,000


Set X2 = 0, then
2X1 + 1(0) = 4,000
3000
X2

2X1 = 4,000
X1 = 2,000
2000

1000

0
0 1000 2000 3000 4000 5000 6000
X1
Constraint 2: Graph Metal Constraint
4X1 + 2X2  6,000
Set X1 = 0, then
4(0) + 2X2 = 6,000
X2 = 3,000
6000

5000

4000 4X1 + 2X2  6,000


Set X2 = 0, then
4X1 + 2(0) = 6,000
3000
X2

4X1 = 6,000
X1 = 1,500
2000

1000

0
0 1000 2000 3000 4000 5000 6000
X1
Constraint 3: Graph Glass Constraint
6X1 + 2X2  10,000
Set X1 = 0, then
6(0) + 2X2 = 10,000
X2 = 5,000
6000

5000

4000 6X1 + 2X2  10,000


Set X2 = 0, then
6X1 + 2(0) = 10,000
3000
X2

6X1 = 10,000
X1 = 1,667
2000

1000

0
0 1000 2000 3000 4000 5000 6000
X1
Constraint 4: Graph Demand
Frame 1 Constraint
1X1  1,000
Therefore, X2 can
be any value as long as
X2 ≤ 1,000
6000

5000

4000

3000
X2

2000

1000

0
0 1000 2000 3000 4000 5000 6000
X1
Constraint 5: Graph Demand
Frame 2 Constraint

6000

5000

4000 X2  2,000
Therefore, X1 can be
3000 any value as long
X2

as X2 ≤ 2,000

2000

1000

0
0 1000 2000 3000 4000 5000 6000
X1
Objective Function
Maximize 6x1 + 2x2
6000
Setup isoprofit line:
Demand frame 1
5000
Glass Arbitrary value:
4000
Labor
Z = 12,000
3000
If X1 = 0, then X2 = 6,000
X2

Metal Demand frame 2


2000
If X2 = 0, then X1 = 2,000
1000

0
0 1000 2000 3000 4000 5000 6000
X1
Final Solution
Maximize 6x1 + 2x2
6000
Setup isoprofit line:
Demand frame 1
5000
Glass Arbitrary value: Z = 12,000
4000
Labor
If X1 = 0, then X2 = 6,000
3000
If X2 = 0, then X1 = 2,000
X2

Metal Demand frame 2


2000 Draw line
1000 Move to feasible region
0
0 1000 2000 3000 4000 5000 6000
X1

END
Practice Problem Solution
Identifying Optimal Solution
Observations
• The optimal point will always occur at a corner
point of the feasible region.
• There may be multiple optimal solutions if the
isoprofit line is parallel to one of the constraints which
identifies the optimal corner point.
• Constraints that limit the feasible region are
referred to as “binding” or “tight.” Constraints
that do not currently influence the feasible region
are “nonbinding” or “loose.”
Identify Corner Points
of the Feasible Region
• Calculate the x and y coordinates for the corner
points of the feasible region.

0,2000

1000,1000

0,0 1000,0
Identify Corner Points
of the Feasible Region
• Calculate the x and y coordinates for the corner
points of the feasible region.
• Calculate the profit for each corner point.
$4,000 $7,000
0,2000 500,2000

$8,000
1000,1000

0,0 1000,0 $6,000


$0
Identify Corner Points
of the Feasible Region
• Calculate the x and y coordinates for the corner
points of the feasible region.
• Calculate the profit for each corner point.

0,2000 500,2000

$8,000
1000,1000 Optimal value is to produce
1,000 of each frame and
0,0 1000,0
expect a profit of $8,000
In Class assignment
• Go to Assignment link InClass1
• Data for problem on next slide
• Download the Excel file
• Complete the Model
• Identify Variables
• Enter Constraints
• Enter Objective Function
• Run Solver
Example: Monet Frames
• Inputs
• Produce two types of frames labeled 1 and 2
• Data Frame Skilled Metal Glass Selling Maximum
Labor Price Demand
1 2 4 6 $28.50 1000
2 1 2 2 $12.50 2000
Capacity 4,000 hr 6,000 ounces 10,000 ounces
Cost $8.00/hr $0.50/ounce $0.75/ounce

• Output
• Company wants to maximize weekly profits
Spreadsheet Model
• Maximize 6x1 + 2x2
• Subject to:
2x1 + 1x2  4,000 (labor)
4x1 + 2x2  6,000 (metal)
6x1 + 2x2  10,000 (glass)
1x1  1,000 (demand frame 1)
1x2  2,000 (demand frame 2)
1x1  0 (non-negativity)
1x2  0 (non-negativity)
END

You might also like