An Introduction To Linear Programming: Instructor: Dr. Mohamed Mostafa
An Introduction To Linear Programming: Instructor: Dr. Mohamed Mostafa
An Introduction to Linear
Programming
Instructor: Dr. Mohamed Mostafa
Overview
2
Linear Programming
2. 3√x1 - 2x2 ≥ 15
4. 4x1 + 7x3 = 12
6
Problem Formulation
9
Objective
Max 5x1 + 7x2 Function
s.t. x1 < 6
“Regular”
2x1 + 3x2 < 19 Constraints
x1 + x2 < 8
Non-negativity
x1 > 0 and x2 > 0 Constraints
Graphical Solution
• Prepare a graph of the feasible solutions for each of the constraints.
• Determine the feasible region that satisfies all the constraints
simultaneously.
Type of constraint Feasible region (usually) will be
– > above/to the right
– < below/to the left
– = the line
• Draw an objective function line.
• Move parallel objective function lines toward larger objective function
values without entirely leaving the feasible region.
• Any feasible solution on the objective function line with the largest
value is an optimal solution.
11
Starbucks: Graphical Solution
x2
8
7
6
5
4
3
2
1
x1
1 2 3 4 5 6 7 8 9 10
Starbucks: Graphical Solution
x2 First Constraint Graphed
8
7 x1 = 6
6
Shaded region
5 contains all
4 feasible points
for this constraint
3
2
(6, 0)
1
x1
1 2 3 4 5 6 7 8 9 10
Second Constraint Graphed
x2
8 (0, 6 )
7
6
5
2x1 + 3x2 = 19
4
Shaded
3
region contains
2 all feasible points (9 , 0)
1 for this constraint
x1
1 2 3 4 5 6 7 8 9 10
Third Constraint Graphed
x2
(0, 8)
8
7
6 x1 + x2 = 8
5
4
Shaded
3
region contains
2 all feasible points
1 for this constraint (8, 0)
x1
1 2 3 4 5 6 7 8 9 10
Combined-Constraint Graph
Showing Feasible Region
x2
8
x 1 + x2 = 8
7
6 x1 = 6
5
4
3
Feasible 2x1 + 3x2 = 19
2
Region
1
x1
1 2 3 4 5 6 7 8 9 10
Objective Function Line
x2
8
7
(0, 5)
6 Objective Function
5 5x1 + 7x2 = 35
4
3
2
(7, 0)
1
x1
1 2 3 4 5 6 7 8 9 10
Selected Objective Function Lines
x2
8
7
5x1 + 7x2 = 35
6
5 5x1 + 7x2 = 39
4
3 5x1 + 7x2 = 42
2
1
x1
1 2 3 4 5 6 7 8 9 10
Optimal Solution
x2
Maximum
Objective Function Line
8
5x1 + 7x2 = 46
7
6 Optimal Solution
(x1 = 5, x2 = 3)
5
4
3
2
1
x1
1 2 3 4 5 6 7 8 9 10
• Solve for the Extreme Point at the Intersection of the Two Binding
Constraints
2x1 + 3x2 = 19
x1+ x2 = 8
The two equations will give:
x2 = 3
8
7 5 (0, 6 )
6
5
4
4 (5, 3)
3
Feasible 3 (6, 2)
2 Region
1 1 (0, 0) 2 (6, 0)
x1
1 2 3 4 5 6 7 8 9 10
x2 Max Z = 5x1 + 7x2
(x1 , x2 ) Z
8
1 (0, 0) 0
7 5 2 (6, 0) 30
6
3 (6, 2) 44
5
4 (5, 3) 46
4
4 5 (6 1/3,0) 30 5/3
3
2
Feasible 3
Region
1
1 2
1 2 3 4 5 6 7 8 9 10 x1
23
Problem
• A woodcarvingلخشبTTحتاTT نagency manufactures two types of wooden toys:
soldiers and trains. A soldier sells for $27 and uses $10 worth of raw
materials. Each soldier that is manufactured increases his variable labor
and overhead costs (Examples include rent, gas, electricity, and wages)
by $14. A train sells for $21 and uses $9 worth of raw materials. Each
train built increases his variable labor and overhead costs by $10.
The manufacture of soldier and trains requires two types of skilled labor:
carpentry and finishing. A soldier requires 2 hours of finishing labor and
1 hour of carpentry labor. A train requires 1 hour of finishing and 1 hour
of carpentry labor. Each week he can obtain all the raw material he needs
but only 100 hours of finishing and 80 carpentry hours. Demand for
trains is unlimited, but at most 40 soldiers are bought every week.
Formulate the problem that may maximize the company’s weekly profit
and solve it graphically.
Problem
• The following table summarizes the key facts about two products,
A and B, and the resources Q, R, and S required to produce them.
Formulate a linear programming model for this problem. The
profit per unit is $3 for Product A and $2 for Product B.
Q 2 1 2
R 1 2 2
S 3 3 4
Assignment
• The Primo Insurance Company is introducing two new
product lines: special risk insurance and. MortgagesارىTرهنعق
The expected profit is $5 per unit on special risk insurance and
$2 per unit on mortgages. Management wishes to establish
sales quotasاتTلمبيعTT حصصاfor new product lines. The work req.
are as follows. Formulate the LP model and solve it
graphically.
Department Work-hours per unit Work hours
Special Risk Mortgage Available
Underwriting 3 2 2,400
االكتتاب-تعهد بالتمويل
Admin.
فTإلشراTTا 0 1 800
ClaimsشكاوىTT لا-باتTTمطا
لTTلا 2 0 1,200
Computer Solution: Windows QM
Demo version available at:
http://wps.prenhall.com/bp_weiss_software_1/0,6750,91664-,00.html
Solving Graphically: Minimization Problem
LP Formulation
x1, x2 > 0
Graphical Solution
x2 Constraints Graphed
6
Feasible Region
5
4x1 x2 > 12
4
x 1 + x2 > 4
3
x1
1 2 3 4 5 6
Objective Function Graphed
5
4x11 x22 > 12
4
x11 + x22 > 4
3
x11
1 2 3 4 5 6
• Solve for the Extreme Point at the Intersection of the Two Binding Constraints
4x1 - x2 = 12
x 1 + x2 = 4
Adding these two equations gives:
5x1 = 16 or x1 = 16/5
s.t. x1 + s1 = 6
2x1 + 3x2 + s2 = 19
x1 + x2 + s3 = 8
5
Second
4
Constraint:
3 2x1 + 3x2 = 19
Optimal
2 Solution s2 = 0
1 (x1 = 5, x2 = 3)
x1
1 2 3 4 5 6 7 8 9 10
Surplus Variables
s.t. x1 < 6
2x1 + 3x2 < 18
x1 + x2 < 7
x1, x2 > 0
• There are no points that satisfy both constraints, so there
is no feasible region (and no feasible solution).
x2
10
2x1 + x2 > 8
8
6
4x1 + 3x2 < 12
4
x1
2 4 6 8 10
Unbounded Problem
s.t. x1 + x2 > 5
3x1 + x2 > 8
x1, x2 > 0
The feasible region is unbounded and the objective
function line can be moved outward from the origin
without bound, infinitely increasing the objective function.
x2
10
3x1 + x2 > 8
8
M
6 ax
4x
1 +5
4 x2
x1 + x2 > 5
2
x1
2 4 6 8 10
Assignment
• The Sanders Garden Shop mixes two types of grass seed into a
blend. Each type of grass has been rated (per pound) according to its
shade tolerance, ability to stand up to traffic, and drought resistance,
as shown in the table. Type A seed costs $1 and Type B seed costs
$2. If the blend needs to score at least 300 points for shade
tolerance, 400 points for traffic resistance, and 750 points for
drought resistance, how many pounds of each seed should be in the
blend? How much will the blend cost?
Type A Type B
Shade Tolerance 1 1
Traffic Resistance 2 1
Drought Resistance 2 5