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 Procedurefor Maximization Problems
• Prepare a graph of the feasible solutions for each of the constraints.
• Determine the feasible region that satisfies all the constraints simultaneously.
• Draw an objective function line.
Feasible Region of a constraint
We always label the variables x1 and x2 and the coordinate axes the x1 and x2 axes.
Graphical Example:The shaded area in the
graph are the set of points satisfying the inequality: 2x1 + 3x2 ≤ 6
X1
1 2 3 4
1
2
3
4
X2
-1
-1
2x1 + 3x2 ≤ 6
Graphical Solution Procedurefor Maximization Problems
• 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.
Maximization Problem (Example 1)• LP Formulation
Max 5x1 + 7x2
such that x1 < 6
2x1 + 3x2 < 19
x1 + x2 < 8
x1, x2 > 0
88
77
66
55
44
33
22
11
1 2 3 4 5 6 7 8 9 101 2 3 4 5 6 7 8 9 10
Example 1: Graphical Solution
• Constraint #1 Graphed xx22
xx11
xx11 << 6 6
(6, 0)(6, 0)
88
77
66
55
44
33
22
11
1 2 3 4 5 6 7 8 9 101 2 3 4 5 6 7 8 9 10
Example 1: Graphical Solution
• Constraint #2 Graphed
22xx11 + 3 + 3xx22 << 19 19
xx22
xx11
(0, 6 (0, 6 1/31/3))
(9 (9 1/21/2, 0), 0)
Example 1: Graphical Solution
• Constraint #3 Graphed
88
77
66
55
44
33
22
11
1 2 3 4 5 6 7 8 9 101 2 3 4 5 6 7 8 9 10
xx22
xx11
xx11 + + xx22 << 8 8
(0, 8)(0, 8)
(8, 0)(8, 0)
Example 1: Graphical Solution
• Combined-Constraint Graph
88
77
66
55
44
33
22
11
1 2 3 4 5 6 7 8 9 101 2 3 4 5 6 7 8 9 10
22xx11 + 3 + 3xx22 << 19 19
xx22
xx11
xx11 + + xx22 << 8 8
xx11 << 6 6
Example 1: Graphical Solution
• Feasible Solution Region88
77
66
55
44
33
22
11
1 2 3 4 5 6 7 8 9 101 2 3 4 5 6 7 8 9 10 xx11
FeasibleFeasibleRegionRegion
xx22
88
77
66
55
44
33
22
11
1 2 3 4 5 6 7 8 9 101 2 3 4 5 6 7 8 9 10
Example 1: Graphical Solution
• Objective Function Line
xx11
xx22
(7, 0)(7, 0)
(0, 5)(0, 5)Objective FunctionObjective Function55xx11 + + 7x7x2 2 = 35= 35Objective FunctionObjective Function55xx11 + + 7x7x2 2 = 35= 35
88
77
66
55
44
33
22
11
1 2 3 4 5 6 7 8 9 101 2 3 4 5 6 7 8 9 10
Example 1: Graphical Solution
• Optimal Solution
xx11
xx22
Objective Function5x1 + 7x2 = 46Objective Function5x1 + 7x2 = 46
Optimal Solution(x1 = 5, x2 = 3)Optimal Solution(x1 = 5, x2 = 3)
Extreme Points and the Optimal Solution
• The corners or vertices of the feasible region are referred to as the extreme points.
• An optimal solution to an LP problem can be found at an extreme point of the feasible region.
Extreme Points and the Optimal Solution
• When looking for the optimal solution, you do not have to evaluate all feasible solution points.
• You have to consider only the extreme points of the feasible region.
Example 1: Graphical Solution
• The Five Extreme Points88
77
66
55
44
33
22
11
1 2 3 4 5 6 7 8 9 101 2 3 4 5 6 7 8 9 10 xx11
FeasibleFeasibleRegionRegion
1111 2222
3333
4444
5555
xx22
Maximization Problem: Example 2RESOURCE REQUIREMENTSRESOURCE REQUIREMENTS
Labor Clay RevenuePRODUCTPRODUCT (hr/unit) (kg/unit)(RM/unit)
BowlBowl 11 44 4040
MugMug 22 33 5050
There are 40 hours of labor and 120 kg of There are 40 hours of labor and 120 kg of clay available each day.clay available each day.
Decision variables:Decision variables:
xx11 = number of bowls to produce = number of bowls to produce
xx22 = number of mugs to produce = number of mugs to produce
Example 2
Maximize Maximize ZZ = RM40 = RM40xx11 + RM50 + RM50xx22
Subject toSubject to
xx11++22xx2 2 40 hr 40 hr (labor constraint)(labor constraint)
44xx11++33xx2 2 120 kg120 kg (clay constraint)(clay constraint)
xx1 1 , , xx2 2 00
Solution: Solution: xx11 = 24 bowls = 24 bowls
xx2 2 = 8 mugs= 8 mugs
Revenue = RM1,360Revenue = RM1,360
How to get these?How to get these?
Graphical Solution Method1.1. Plot model constraint on a set of Plot model constraint on a set of
coordinates in a plane.coordinates in a plane.
2.2. Identify the feasible solution space Identify the feasible solution space on the graph where all constraints on the graph where all constraints are satisfied simultaneously.are satisfied simultaneously.
3.3. Plot objective function to find the Plot objective function to find the point on boundary of this space point on boundary of this space that maximizes (or minimizes) that maximizes (or minimizes) value of objective function.value of objective function.
Example 2
4 x1 + 3 x2 120 kg
x1 + 2 x2 40 hr
area common toboth constraints
50 50 –
40 40 –
30 30 –
20 20 –
10 10 –
0 0 – |1010
|6060
|5050
|2020
|3030
|4040 xx11
xx22
Computing Optimal Values
x1+ 2x2 = 40
4x1+ 3x2 = 120
4x1+ 8x2 = 160
-4x1 - 3x2 =-120
5x2 = 40
x2 = 8
x1+2(8) = 40
x1 = 24
4 x1 + 3 x2 120 kg
x1 + 2 x2 40 hr
40 40 –
30 30 –
20 20 –
10 10 –
0 0 –|
1010|
2020|
3030|
4040
xx11
xx22
Z = 50(24) + 50(8) = 1,360
24
8
Extreme Corner Points
4x1 + 3x2 120 kg
x1 + 2x2 40 hr
40 40 –
30 30 –
20 20 –
10 10 –
0 0 –
BB
|1010
|2020
|3030
|4040 xx11
xx22
CC
AA
Z = 70x1 + 20x2Optimal point:x1 = 30 bowls
x2 = 0 mugs
Z = RM2,100
Objective Function
Minimization Problem: Example 1• LP Formulation
Min 5x1 + 2x2
s.t. 2x1 + 5x2 > 10
4x1 - x2 > 12
x1 + x2 > 4
x1, x2 > 0
Example 1
• Graph the Constraints Constraint 1:
When x1 = 0, then x2 = 2;
when x2 = 0, then x1 = 5. Connect (5,0) and (0,2).
The ">" side is above this line.
2x2x11 + 5x + 5x22 >> 10 10
Example 1Constraint 2:
When x2 = 0, then x1 = 3. But setting x1 to 0 will yield x2 = -12,
which is not on the graph.
Thus, to get a second point on this line, set x1 to any number larger than 3 and solve for x2: when x1 = 5, then x2 = 8. Connect (3,0) and (5,8). The ">" side is to the right.
4x4x11 - x - x22 >> 12 12
Example 1
Constraint 3:
When x1 = 0, then x2 = 4;
when x2 = 0, then x1 = 4. Connect (4,0) and (0,4).
The ">" side is above this line.
xx11 + x + x22 >> 4 4
Example 1
• Constraints Graphed
55
44
33
22
11
55
44
33
22
11
1 2 3 4 5 61 2 3 4 5 6 1 2 3 4 5 61 2 3 4 5 6
xx22xx22
44xx11 - - xx22 >> 12 12
xx11 + + xx22 >> 4 4
44xx11 - - xx22 >> 12 12
xx11 + + xx22 >> 4 4
22xx11 + 5 + 5xx22 >> 10 1022xx11 + 5 + 5xx22 >> 10 10
xx11xx11
Feasible RegionFeasible Region
Example 1
• Graph the Objective Function
Set the objective function equal to an arbitrary constant (say 20) and graph it. For 5x1 + 2x2 = 20, when x1 = 0, then x2 = 10; when x2= 0, then x1 = 4. Connect (4,0) and (0,10).
Example 1
• Move the Objective Function Line Toward Optimality
Move it in the direction which lowers its value (down), since we are minimizing, until it touches the last point of the feasible region, determined by the last two constraints.
Example 1
• Objective Function Graphed
5
4
3
2
1
5
4
3
2
1
1 2 3 4 5 6 1 2 3 4 5 6
xx22xx22Min Min zz = 5 = 5xx11 + 2 + 2xx22
44xx11 - - xx22 >> 12 12
xx11 + + xx22 >> 4 4
Min Min zz = 5 = 5xx11 + 2 + 2xx22
44xx11 - - xx22 >> 12 12
xx11 + + xx22 >> 4 4
22xx11 + 5 + 5xx22 >> 10 1022xx11 + 5 + 5xx22 >> 10 10
xx11xx11
Example 1
• Solve for the Extreme Point at the Intersection of the Two Binding Constraints
4x1 - x2 = 12
x1+ x2 = 4
Adding these two equations gives: 5x1 = 16 or x1 = 16/5.
Substituting this into x1 + x2 = 4 gives:
x2 = 4/5
Example 1• Solve for the Optimal Value of the
Objective FunctionSolve for z = 5x1 + 2x2
= 5(16/5) + 2(4/5) = 88/5. Thus the optimal solution is
x1 = 16/5; x2 = 4/5; z = 88/5
Example 1
• Optimal Solution
5
4
3
2
1
5
4
3
2
1
1 2 3 4 5 6 1 2 3 4 5 6
xx22xx22Min Min zz = 5 = 5xx11 + 2 + 2xx22
44xx11 - - xx22 >> 12 12
xx11 + + xx22 >> 4 4
Min Min zz = 5 = 5xx11 + 2 + 2xx22
44xx11 - - xx22 >> 12 12
xx11 + + xx22 >> 4 4
22xx11 + 5 + 5xx22 >> 10 10
Optimal: Optimal: xx11 = 16/5 = 16/5 xx22 = 4/5 = 4/5
22xx11 + 5 + 5xx22 >> 10 10
Optimal: Optimal: xx11 = 16/5 = 16/5 xx22 = 4/5 = 4/5xx11xx11
Feasible Region
• The feasible region for a two-variable linear programming problem can be nonexistent, a single point, a line, a polygon, or an unbounded area.
• Any linear program falls in one of three categories:– is infeasible – has a unique optimal solution or
alternate optimal solutions– has an objective function that can be
increased without bound
Feasible Region
• A feasible region may be unbounded and yet there may be optimal solutions. This is common in minimization problems and is possible in maximization problems.
Special Cases
• Alternative Optimal SolutionsIn the graphical method, if the objective function line is parallel to a boundary constraint in the direction of optimization, there are alternate optimal solutions, with all points on this line segment being optimal.
Alternate Optimal Solutions
max z = 3x1 + 2x2s.t.
1
40x1
1
60x2 1
1
50x1
1
50x2 1
x1 x2 0
Any point (solution) falling on line segment AE will yield an optimal solution of z =120.
Some LPs have an infinite number of solutions. Consider the following formulation:
X1
X2
10 20 30 40
1020
3040
50
Feasible Region
F50
60
z = 60
z = 100 z = 120
A
B
C
D
E
Special Cases
• Infeasibility A linear program which is overconstrained so that no point satisfies all the constraints is said to be infeasible.
• Unboundedness(See example on upcoming slide.)
Example: Infeasible Problem• Solve graphically for the optimal solution:
Max 2x1 + 6x2
s.t. 4x1 + 3x2 < 12
2x1 + x2 > 8
x1, x2 > 0
Example: Infeasible Problem• There are no points that satisfy both
constraints, hence this problem has no feasible region, and no optimal solution.
xx22
xx11
44xx11 + 3 + 3xx22 << 12 12
22xx11 + + xx22 >> 8 8
33 44
44
88
Example: Unbounded Problem• Solve graphically for the optimal
solution: Max 3x1 + 4x2
s.t. x1 + x2 > 5
3x1 + x2 > 8
x1, x2 > 0
Example: Unbounded Problem
• The feasible region is unbounded and the objective function line can be moved parallel to itself without bound so that z can be increased infinitely.
xx22
xx11
33xx11 + + xx22 >> 8 8
xx11 + + xx22 >> 5 5
Max 3Max 3xx11 + 4 + 4xx22
55
55
88
2.672.67
Exercise• Solve the following LP model graphically:
Minimize Z = 8x1 + 2x2
subject to 2x1- 6x2 < 12
5x1 + 4x2 > 40
x1 + 2x2 > 12
x2 < 6
x1, x2 > 0
Ans: x1 = 3.2, x2 = 6,
Z = 37.6
Food of thought…
The hardest arithmetic to master is that which enables us to count our blessings.