Sunteți pe pagina 1din 23

CHAPTER 4

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.

4.1 Formation of linear programming problems


Suppose a manufacturer of printed circuits has a stock of
200 resistors, 120 transistors and 150 capacitors
and is required to produce two types of circuits.
Type A requires 20 resistors, 10 transistors and 10 capacitors.
Type B requires 10 resistors, 20 transistors and 30 capacitors.

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

a) What are the unknowns?

b) What are the constraints?

c) What is the profit/cost to be maximized/minimized?

For this problem,

a) What are the unknowns?

Clearly the number of type A and type B circuits produced; so we define

x = number of type A circuits produced

y = number of type B circuits produced

b) What are the constraints?

1|Page
There are constraints associated with the total number of resistors, transistors and
capacitors available.

Resistors Since each type A requires 20 resistors,

and each type B requires 10 resistors,

then 20 x+10 y ≤200 ,

as there is a total of 200 resistors 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 .

c) What is the profit?


Since each type A gives RM5 profit and each type B gives RM12 profit, the total
profit if RM P , where
P=5 x +12 y .
You can now summarize the problem as:
maximize P=5 x +12 y
subject to 20 x+10 y ≤200
10 x+20 y ≤120
10 x+30 y ≤150
x≥0
y≥0 .
This is called a linear programming problem since both the objective function P and the
constraints are all linear in x and y .
In this particular example you should beware that x and y can only be integers since it
is not sensible to consider fractions of a printed circuit. In all linear programming problems
you need to consider if the variables are integers.

Activity: Show that x=5, y=3 satisfies all the constraints.


Find the associated profit for this solution, and compare this profit with other
possible solutions.

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.

4.2 Linear inequalities in two variables


A linear inequality in two variables can be written as
Ax +By<C , Ax+By≤C , Ax+By >C , or Ax+By≥C where A, B and C are real numbers
and A and B are not zero.

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

(1,3) is a solution to x+2 y≤8 since


1+2(3)≤8
7≤8
The solution set (feasible set) of a linear inequality in two variables is the set of all solutions.
Example 2

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

From x+2 y≤8 , when x=0, y=4 . When y=0, x=8 .

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

Graph the boundary line for 2x−3 y≤18 .


Solution

4|Page
Method 1
Step 1: Graph the boundary line.
Step 2: Choose test point, (0, 0). We can proof that

2(0 )−3(0 )≤18


0≤18  TRUE
Step 3: Since it is true, hence shade above the boundary line and to the left of the line.
Method 2
Step 1: Graph the boundary line

Step 2: Rearrange equation in form of y=mx +c

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

Graph the solution set for x− y>2 .


We defined the union of two sets A and B as the set containing all elements that are in set A or
set B, and we defined the intersection of two sets A and B as the set containing all elements
that are in both A and B.

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:

(a) 5 x−2 y <10 and y≤x

(b) x+ y<4 or x≥4

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”.

(b) Repeat Step 1 and 2 from (a).


Step 3: take all the shaded region since the two inequalities are joined by the word
“or”.

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

A linear programming (LP) is an optimization process for which:


(a) we attempt to maximize (or minimize) a linear function of the decision variables 
objective function.
(b) the values of the decision variables must satisfy a set of constraints, each of which must
be a linear equality or linear inequality.
(c) a sign restriction on each variable. For each variable
xi the sign restriction can either
say
(i)
x i≥0
(ii)
x i≤0
(iii)
x i unrestricted, urs

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)

The feasible region for the set of inequalities is as shown below.

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 ∞ .

The feasible region for Exercise 2 is shown below. See Figure 3.

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.

From Figure 3, we do the obvious ones first,

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

Example 6: Maximization problem


Maximize
z=3 x 1 +2 x 2
subject to
x 1−x 2 ≥8

2 x 1 +x 2 ≤20

Now, we add two additional constraints, x≥0, y≥0


To solve the linear programming problem, we apply the following steps:
Step 1
Plot the feasible region for the given constraints.
Step 2
Find the corner points of the feasible region.
Step 3
Evaluate (or find the value of ) the objective function at each of the corner point.
Step 4
For maximization, the solution to the linear programming problem is the one that gives the
highest value for the objective function.
For minimization, the solution to the linear programming problem is the one that gives the
lowest value for the objective function.
Solution
Step 1
The constraints are
x 1−x 2 ≥8

11 | P a g e
2 x 1 +x 2 ≤20
x≥0
y≥0

The feasible region is given as

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.

Example 7: Minimization problem


Minimize

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:

(a) an objective function that needs to be maximized or minimized,


(b) decision variables of which the values need to be determined,
(c) a set of constraints.

Step 1: Develop an objective function.


Since the company wishes to maximize the total profit, therefore total profit function is the
objective function.

Step 2: Determine the decision variables.


Decision variables are the number of items of product X and Y. Let x be the number of
items of product X and y be the number of items of product Y.

Set up the objective function,

14 | P a g e
Total profit, π =200 x+ 160 y

Step 3: Formulate constraints.

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

Now, we can solve the linear programming problem.

Step 5: Plot the feasible region for the constraints.

Step 6: Find the corner points.


Point A (0, 17.5)
Point B (x,y)
Point C (21, 0)
Point D (0, 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.

Thus, point B is (15, 10).

Step 7: Substitute the corner points into objective function to find the value of total profit.

Corner points Total profit


A (0, 17.5) 2800
B (15, 10) 4600
C (21, 10) 4200
D (0, 0) 0

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, π .

4.5 The simplex method


For a linear programming problems involving two variables, the graphical solution method is
convenient. However, for problems involving more than two variables or problems involving
a larger number of constraints, it is better to use the simplex method. It provides a systematic
way of examining vertices of the feasible region to determine the optimal value of the
objective function.
The simplex method is carried out by performing elementary row operations on a matrix that
we call the simplex tableau. This tableau consist of the augmented matrix corresponding to
the constraint equations together with the coefficients of the objective functions written in the
form

−c1 x 1 −c 2 x 2−c3 x3 . . .−c n x n +(0 )s1 +(0 )s 2 +(0 )s 3 +. ..+(0) sm +z=0


To solve a linear programming problem in simplex form, use the following steps:
1. Convert each inequality in the set of constraints to an equation by adding slack
variables. Note: If you have 2 variables, for example x 1 and x 2 , you will add two

slack variables which are denoted as s 1 and s 1 .


2. Create the initial simplex tableau.
3. Locate the most negative entry in the bottom row. The column for this entry is called
the entering column. Note: If ties occur, any of the tied entries can be used to determine
the entering column.

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.

Note that: the basic feasible solution of an initial simplex tableau is

( 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

subject to the constraints


−x 1 +x 2 ≤11
x 1 + x 2≤27
2 x 1 +5 x 2 ≤90

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

Rewrite the objective function:


−4 x 1−6 x 2 + z=0

Step 2: Create initial simplex tableau,

Col 1 Col 2 Col 3 Col 4 Col 5 Col 6 Col 7

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

The smallest positive ratio is 11, hence we choose


s 1 as the departing variable.

Step 5:

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, 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

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, 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

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 -4 -6 0 0 0 1 0

Perform ERO to Row 4: R¿4 =R 4 +6 R 1

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

We are done at step 5!

Step 6: Check if there any negative values in Row 4?


Yes. There is -10 in Column 1. Hence we need to repeat Step 3 again.

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

Pivot element is located at Row 3 Column 1 which is 7.

1
R¿3 = R3
Perform ERO to Row 3: 7

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, −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

Col 1 Col 2 Col 3 Col 4 Col 5 Col 6 Col 7


x1 x2 s1 s2 s3 z

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

Perform ERO to Row 4: R¿4 =R 4 +10 R 3

Col 1 Col 2 Col 3 Col 4 Col 5 Col 6 Col 7


x1 x2 s1 s2 s3 z

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

We are done at step 5 (repeated)!

Step 6: Check if there any negative values in Row 4?


8

Yes. There is 7
in Column 3. Hence we need to repeat Step 3 again.
.
.
.
The last simplex tableau will turn to be like:

Col 1 Col 2 Col 3 Col 4 Col 5 Col 6 Col 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 .

4.5 Minimization and Duality

For a minimization problem,


(a) The objective function is to be minimized.
(b) All variables ¿ 0
(c) All constraints are greater or equal to zero.

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

Step 2: Find the transpose of the matrix.

[ ]
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

S-ar putea să vă placă și