Documente Academic
Documente Profesional
Documente Cultură
LINEAR PROGRAMMING
Objectives:
After studying this chapter, you should
- be able to formulate linear programming problems from contextual problems;
- be able to identify feasible regions for linear programming problems;
- be able to find solutions to linear programming problems using graphical means;
- be able to apply the simplex method using slack variables;
- understand the simplex tableau procedure.
If the profit on type A circuits is RM5 and on type B circuits is RM12, how many of each
circuit should be produced in order to maximize the profit?
You will not actually solve this problem yet, but show how it can be formulated as linear
programming problem. There are three vital stages in the formulation, namely
1|Page
There are constraints associated with the total number of resistors, transistors and
capacitors available.
Transistors Similarly
10 x+20 y ≤120
Capacitors Similarly
10 x+30 y ≤150
Finally you must state the obvious (but nevertheless important) inequalities
x ≥ 0, y ≥ 0 .
The key stage is the first one, namely that of identifying the unknowns; so you must carefully
read the problem through in order to identify the basic unknowns. Once you have done this
successfully, it should be straight forward to express both the constraints and the profit
2|Page
function in terms of the unknowns. A further condition to note in many of the problems is that
the unknowns must be positive integers.
Exercise:
A small firm builds two types of garden shed.
Type A requires 2 hours of machine time and 5 hours of craftsman time.
Type B requires 3 hours of machine time and 5 hours of craftsman time.
Each day there are 30 hours of machine time available and 60 hours of craftsman time. The
profit on each type A shed is RM60 and on each type B shed is RM84.
Formulate the appropriate linear programming problem.
Expressions of the type x+2 y≤8 and 3 x− y>8 are examples of linear inequalities in
two variables.
A solution of a linear equality in two variables is an ordered pair (x,y) which makes the
inequality true.
Example 1
The solution set for x+2 y≤8 is the shaded region (feasible region).
3|Page
The solution set is a half-plane. It consists of the line x+2 y≤8 and all points below and
to its left. The line is called the boundary line of the half plane.
Note: Recall back how to graph a linear equation. Students can use the following table:
x 0 8
y 4 0
If the inequality is ¿ or ≤ , the boundary line is solid; its point are solutions. See Figure 1.
Figure 1
¿ or <¿
If the inequality is ¿ , the boundary line is dotted; its point are not solutions. See
Figure 2.
Figure 2
A test point can be selected to determine which side of the half-plane to shade.
Example 3
4|Page
Method 1
Step 1: Graph the boundary line.
Step 2: Choose test point, (0, 0). We can proof that
2x−3 y≤18
−3 y≤18−2 x
2
y≥−6+ x
3
2
y≥ x−6
3 y=mx +c
Since the last equation is greater than, then we can shade the above line and to the left of the
line.
Exercise 1
5|Page
If we let A denote the portion of the plane that solves one inequality and B the portion of the
plane that solves for second inequality, then A∪B represents the solution set of two
inequalities joined by the word “or” and A∩B represents the solution set of two
inequalities joined by the word “and”.
Example 4
Graph the solution sets that satisfy the following inequalities:
Solution
(a) Step 1: Graph the boundaries for both lines.
Step 2: Shade both regions.
Step 3: Take the intersection of the regions since the two inequalities are joined by the
word “and”.
6|Page
4.3 Linear programming
A function f (x 1 , x 2 ,...x n ) of
x 1 ,x 2 ,..., x n is a linear function if and only if for some set of
constants
c 1 ,c 2 ,...,c n ,
f (x 1 , x 2 ,...x n ) = c 1 ,c 2 ,...,c n
Example 5
Find the feasible region for the following set of inequalities:
2x+ y≤20
x+ y≤12
7|Page
2x+5 y≤50
x≥0, y≥0
Solution
Find the y-intercept and x-intercept for all equations.
Two points on 2x + y=20 are (10,0) and (0,20 )
Two points on x+ y=12 are (12,0) and (0,12)
Two points on 2x+5 y=50 are (25 ,0) and (0,10)
Exercise 2
Find the feasible region for the following inequalities:
3 x+4 y≥20
10 x+5 y≤100
y≤10
x≥0, y≥0
Solution
8|Page
4.4 Multiple optimum solutions
A set of point S is a convex set if the line segment joining any 2 points in S is wholly
containing S. The set of feasible solutions to an LP forms a convex set.
A point, p of a convex set S is an extreme point if each line segments lies completely in S and
contains p has p as an endpoint. An extreme point is also called a corner point. Every linear
program has an extreme point that is an optimal solutions.
An optimal solutions to a linear program is a feasible solution with the largest objective
function value (for a maximization problem). The value of the objective function for the
optimal solution is said to be the value of the linear program. A linear program may have
multiple optimal solutions but only one optimal solution value.
A linear program is infeasible if it has no feasible solutions. For example the feasible region
is empty.
A linear program is unbounded if the optimal solution is unbounded. For example it is either
−∞ to ∞ .
9|Page
Figure 3
Also indicated on the graph now are the corner points (A, B, C, D, and E). Note that a corner
point of a feasible region is a point that is the intersection of two boundary lines.
To determine the coordinates of a corner points, we can find the intersection of two lines or
equations.
Point A is (0,3)
Point B is (4,0)
Point C is (10,0)
Point D is (x,y)
Point E is (0,10)
To find point D, it is the intersection of two lines, y = 10 and 10 x+5 y=100 . Solving the
two equations, we can obtain the corner point D.
y = 10 ………..(1)
10 x+5 y=100 ………..(2)
Substitute (1) into (2),
10 x+5 (10 )=100
10 x=50
x=5
10 | P a g e
Point D is (5,10).
Exercise 3
Determine the corner points for the feasible region:
6 x+4 y≥12
2 x− y≤18
y≥1
2 x 1 +x 2 ≤20
11 | P a g e
2 x 1 +x 2 ≤20
x≥0
y≥0
Step 2
There are 3 corner points.
Point A is (8,0)
Point B is (10,0)
Point C is (x,y). We can find point C by solving equations of the two lines x 1−x 2 =8 and
2 x 1 +x 2 =20 . Solving the two equations gives
28 4
,
Point C ( 3 3 ).
Step 3
Corner points z=3 x 1 +2 x 2
A (8,0) z=3(8 )+2(0 )=24
B (10,0) z=30
28 4
, z=30 .67
C( 3 3 )
12 | P a g e
Step 4
28 4
x 1= and x 2 =
The solution to the linear programming problem is 3 3 to give a
maximum z value of 30.67.
z=800 x+300 y
subject to
40 x +8 y≤400
30 x+10 y≥360
x≥0
y≥0
Solution
Step 1
We plot the feasible region for the constraints and obtained the following figure
Step 2
There are three corner points:
13 | P a g e
Point A (0,36)
Point B (0,50)
Point C is the intersection between lines 40 x +8 y=400 and 30 x+10 y=360 . When
we solve the two equations, we obtained Point C (7,15).
Step 3
Corner points z=800 x+300 y
Point A (0,36) 10800
Point B (0,50) 15000
Point C (7,15) 10100
Step 4
The solution to the linear programming problem is x = 7 and y = 15 to give minimum z value
of 10100.
Example 8
A company manufactures two products X and Y. Each of those products requires a certain
amount of time on the assembly line and a further amount of time in the finishing shop. Each
item of X needs 5 hours for assembly and 2 hours for finishing; each item of Y needs 3 hours
for assembly and 4 hours for finishing. In any week the firm has available 105 hours on the
assembly line and 70 hours in the finishing shop. The firm can sell all it can produce of each
item and makes a profit at RM200 on each item of X and RM160 on each item of Y. Find the
number of items of each type that should be manufactured per week to maximize the total
profit.
Solution
To solve this linear programming problem, recall that a linear programming problem has the
following structure:
14 | P a g e
Total profit, π =200 x+ 160 y
5 x+3 y ≤105
2 x + 4 y ≤ 70
x≥0
y≥0
Step 4:
We need to maximize
π =200 x+ 160 y
subject to
5 x+3 y ≤105
2 x + 4 y ≤ 70
x≥0
y≥0
15 | P a g e
Point B is the intersection between the lines 5 x+3 y =105 and 2 x + 4 y=70 . To find
point B, we need to solve the two equations.
** You can either use elimination or substitution method.
Step 7: Substitute the corner points into objective function to find the value of total profit.
Since we want to maximize profit, the solution for x=15 and y=10 . In other word, 15
items of product X and 10 items of product Y should be manufactured per week to maximize
the total profit, π .
16 | P a g e
4. Form the ratios of the entries in the column denoted as b with their corresponding
positive entries in the entering column. The departing row corresponds to the smallest
b
nonnegative ratio
aij . Note: If all entries in the entering column are 0 or negative,
then there is no maximum solution. For ties, choose either entry. The entry in the
departing row and the entering column is called pivot.
5. Use elementary row operations so that the pivot is 1, and all other entries in the entering
column are 0.
6. If all entries in the bottom row are zero or positive, this is the final tableau. If not, go
back to Step 3.
7. If you obtain a final tableau, then the linear programming has a maximum solution,
which is given by the entry in the lower right corner of the tableau.
( x1 , x 2 , .. . , x n , s1 , s2 ,. .. , s m )=(0,0, .. . , 0,b 1 , b2 , .. . , bm )
The solution is basic because at most m variables are nonzero (namely slack variable). It is
feasible because each variable is nonnegative.
Example 9:
Use the simplex method to find the maximum value of
z=4 x1 +6 x 2
where
x 1≥0, x 2 ≥0
Solution:
Step 1: Adding slack variables to constraints to form equations,
−x 1 + x 2 + s 1=11
x 1 + x 2 + s2 =27
2 x 1 +5 x 2 +s 3=90
17 | P a g e
x1 x2 s1 s2 s3 z
Row 1, -1 1 1 0 0 0 11
s1
Row 2, 1 1 0 1 0 0 27
s2
Row 3, 2 5 0 0 1 0 90
s3
Row 4 -4 -6 0 0 0 1 0
Step 3: Find entering variable by looking at the bottom row (Row 4). The smallest entry is -6.
Hence we choose Column 2 which is
x 2 as the entering variable.
Step 4: Determine the departing variable. Find the ratio by using values from Column 2 and
Column 7:
11 27 90
=11, =27 , =18
1 1 5
Step 5:
Row 1, -1 1 1 0 0 0 11
s1
Row 2, 1 1 0 1 0 0 27
s2
Row 3, 2 5 0 0 1 0 90
s3
Row 4 -4 -6 0 0 0 1 0
Pivot element is located at Row 1 Column 2. Since the pivot element is already 1, hence we
need to make other entries in Column 2 to become zero by using ERO.
¿
Perform ERO to Row 2: R2 =R2 −R1
Row 1, -1 1 1 0 0 0 11
s1
Row 2, 2 0 -1 1 0 0 16
s2
Row 3, 2 5 0 0 1 0 90
18 | P a g e
s3
Row 4 -4 -6 0 0 0 1 0
¿
Perform ERO to Row 3: R3 =R3 −5 R1
Row 1, -1 1 1 0 0 0 11
s1
Row 2, 2 0 -1 1 0 0 16
s2
Row 3, 7 0 -5 0 1 0 35
s3
Row 4 -4 -6 0 0 0 1 0
Row 1, -1 1 1 0 0 0 11
s1
Row 2, 2 0 -1 1 0 0 16
s2
Row 3, 7 0 -5 0 1 0 35
s3
Row 4 -10 0 6 0 0 1 66
Step 3 (repeated): The smallest value in Row 4 is -10. Hence we choose Column 1 which is
x 1 as the entering variable.
Step 4 (repeated): Determine the departing variable. Find the ratio by using values from
Column 1 and Column 7:
11 16 35
=−11 , =8, =5
−1 2 7
19 | P a g e
The smallest positive ratio is 5, hence we choose
s 3 as the departing variable.
Step 5 (repeated):
Col 1 Col 2 Col 3 Col 4 Col 5 Col 6 Col 7
x1 x2 s1 s2 s3 z
Row 1, -1 1 1 0 0 0 11
s1
Row 2, 2 0 -1 1 0 0 16
s2
Row 3, 7 0 -5 0 1 0 35
s3
Row 4 -10 0 6 0 0 1 66
1
R¿3 = R3
Perform ERO to Row 3: 7
Row 1, -1 1 1 0 0 0 11
s1
Row 2, 2 0 -1 1 0 0 16
s2
Row 3, −5 1
s3 1 0 0 0 5
7 7
Row 4 -10 0 6 0 0 1 66
¿
Perform ERO to Row 1: R1 =R1 +R3
Row 1, 2 1
s1 0 1 0 0 16
7 7
Row 2, 2 0 -1 1 0 0 16
s2
Row 3, −5 1
s3 1 0 0 0 5
7 7
Row 4 -10 0 6 0 0 1 66
¿
Perform ERO to Row 2: R2 =R2 −2 R 3
Col 1 Col 2 Col 3 Col 4 Col 5 Col 6 Col 7
x1 x2 s1 s2 s3 z
20 | P a g e
Row 1, 2 1
s1 0 1 0 0 16
7 7
Row 2, 0 0 3 1 −2 0 6
s2 7 7
Row 3, −5 1
s3 1 0 1 0 5
7 7
Row 4 -10 0 6 0 0 1 66
Row 1, 2 1
s1 0 1 0 0 16
7 7
Row 2, 0 0 3 1 −2 0 6
s2 7 7
Row 3, −5 1
s3 1 0 1 0 5
7 7
Row 4 0 0 −8 0 10 1 116
7 7
Row 1, −2 1
0 1 0 0 12
3 3
Row 2, 0 0 1 7 −2 0 14
3 3
Row 3, 5 −1
1 0 0 0 15
3 3
Row 4 0 0 0 8 2 1 132
3 3
Since there is no negative elements in Row 4, we have therefore determined the optimal
solution:
( x1 , x 2 , s1 , s2 , s 3 )=(12 , 14, 15 , 0, 0)
21 | P a g e
We can show that the maximum value of z=4 (12)+6 (14)=132 .
Note: Use ‘w’ instead of ‘z’ and ‘y’ instead of ‘x’ for minimization problem. This is just to
remind us that we are doing minimization problem.
Example 10:
Minimize
w=8 y 1 +16 y 2
subject to
y 1 +5 y 2 ≥9
2 y1 +25 y 2≥10
y 1 , y 2≥0
Solution:
Before we can apply simplex method, we there are few steps need to be done.
Step 1: Write the constraints and objective function as an augmented matrix.
[ ]
1 5 9
2 25 10
8 16 0
[ ]
1 2 8
5 25 16
9 10 0
Use the transpose matrix to rewrite as a maximization problem. This is called the “DUAL”.
Step 3: Rewrite as the maximization problem.
z=9 x 1 +10 x 2
subject to
x 1 +2 x 2 ≤8
5 x1 +25 x 2 ≤16
x 1 , x 2 ≥0
22 | P a g e
Step 4: Solve the equations using simplex method. At the end, you will get,
Col 1 Col 2 Col 3 Col 4 Col 5 Col 6
x1 x2 s1 s2 z
Row 1,
s1 0 2 5/4 −1 /4 0 6
Row 2, 1 0 −1 /4 1/4 0 2
s2
Row 3 0 0 4 1 1 48
As long as the coefficient for z in the last row of the matrix is 1, the solution to the
minimization problem is given by the coefficient of the slack variables in the last line of the
matrix.
Therefore,
y 1 =4, y 2 =1 and z =48
23 | P a g e