Unformatted Document Excerpt
Coursehero >>
California >>
East Los Angeles College >>
MS 221
Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
OPERATIONS MAT2009 RESEARCH AND OPTIMIZATION 1
Chapter 1
Linear Programming
1.1 Introduction
Mathematical models in business and economics often involve optimization, i.e. finding the optimal (best) value that a function can take. This objective function might represent profit (to be maximized) or expenditure (to be minimized). There may also be constraints such as limits on the amount of money, land and labour that are available. Operations Research (OR), otherwise known as Management Science, can be traced back to the early twentieth century. The most notable developments in this field took place during World War II when scientists were recruited by the military to help allocate scarce lot of interest in applying OR methods outside the military and the subject expanded greatly during this period. Nowadays, computers can solve very large scale OR problems of enormous complexity. Many of the techniques that we shall study in the first part of the course are of relatively recent origin. The Simplex algorithm for Linear Programming, which is the principal technique for solving many OR problems, was formulated by George Dantzig in 1947. This method has been applied to problems in a wide variety of disciplines including finance, production planning, timetabling and aircraft scheduling. Later in the course we consider optimization of non-linear functions. The methods here are based on calculus. Non-linear problems with equality constraints will be solved using the method of Lagrange Multipliers, named after Joseph Louis Lagrange (1736 - 1812). A similar method for inequality constraints, developed by Karush in 1939 and by Kuhn and Tucker in 1951, is beyond the scope of this course but will be covered in the Level 3 Mathematical Economics module. Books which may be useful for this course include: Introduction to Operations Research, by F Hillier and G Lieberman Operations Research: An Introduction, by H A Taha (Prentice Hall) Operations Research: Applications and Algorithms, by Wayne L Winston (Thomson) Operations Research: Principles and Practice, by Ravindran, Phillips and Solberg (Wiley) Schaum's Outline of Operations Research, by R Bronson (McGraw-Hill) (McGraw Hill) (McGraw-Hill)
Linear and Non-linear Programming by S Nash and A Sofer
1.2
The graphical method
In a Linear Programming (LP) problem, we aim to optimize an objective function which is a linear combination of some decision variables x1 , . . . , xn . These variables are restricted by a set of constraints, expressed as linear equations or inequalities. When there are just two decision variables, the constraints can be illustrated graphically in the (x1 , x2 ) plane. We represent x1 on the horizontal axis and x2 on the vertical axis. To find the region defined by ax1 + bx2 c, first draw the straight line with equation c c ax1 + bx2 = c. This line crosses the axes at x1 = and x2 = . a b If b > 0, then ax1 + bx2 c defines the region on and below the line and ax1 + bx2 c defines the region on and above the line. If b < 0 then this situation is reversed. It is usual to shade along the side of the line away from the region that is being defined. A strict inequality (< or > rather than or ) defines the same region, but the line itself is not included. x1 < c to the left of the vertical line x1 = c, and x1 > c to the right of this line. x2 < c below the horizontal line x2 = c, and x2 > c above this line. A simple way of deciding which side of a line satisfies a given inequality is to consider the origin (0, 0). For example, 2x1 - 3x2 5 defines that side of the line 2x1 - 3x2 = 5 which contains the origin, since 2(0) - 3(0) 5. If the origin lies on the line, consider a convenient point which is not on the line, e.g. (1, 1).
Example 1: Containers problem
To produce two types of container, A and B, a company uses two machines, M1 and M2 . Producing one of container A uses M1 for 2 minutes and M2 for 4 minutes. Producing one of container B uses M1 for 8 minutes and M2 for 4 minutes. The profit made on each container is 30 for type A and 45 for type B. Determine the production plan that maximizes the total profit per hour. Identify the decision variables. Let x1 type A and x2 type B containers be produced per hour. Formulate the objective function and state whether it is to be maximized or minimized. Let z be the profit generated per hour, so we must maximize z = 30x1 + 45x2 . List the constraints. The allowable values of the decision variables are restricted by 2x1 + 8x2 4x1 + 4x2 x1 x2 60, 60, 0, 0. (at most 60 minutes on M1 in an hour) (at most 60 minutes on M2 in an hour) (non-negativity) (non-negativity)
Different values of the objective function correspond to straight lines with equations of the form 30x1 + 45x2 = c for varying values of c. 2 These lines are all parallel, with gradient - . 3 2
Terminology
Ordered pairs (x1 , x2 ) which satisfy all the constraints are called feasible points. The set of all feasible points is called the feasible region or solution space. Points where at least one constraint fails to hold are called infeasible points. These points lie outside the feasible region. The optimum or optimal value of the objective function is the maximum or minimum value, whichever the problem requires. A feasible point at which the optimal value occurs is called an optimal point, and gives the optimal solution. The following diagram shows the feasible region for the Containers problem.
15
10 x2
5
0 0 5 10 15 x1 20 25 30
There are infinitely many feasible solutions. An optimal one can be found by considering the slope, and direction of increase, of the objective function z = 30x1 + 45x2 . All lines corresponding to fixed values of z are parallel to 2x1 +3x2 = 6 (for example), which crosses the axes at (3, 0) and (0, 2). To find the maximum profit we translate this `profit line' in the direction of increasing z, keeping it parallel, until moving it further would take it completely outside the feasible region. We see that the optimum occurs at a corner point (or extreme point) of the feasible region, at the intersection of the lines that correspond to the two machine constraints. Hence the optimal values of x1 and x2 are the solutions of the simultaneous equations 2x1 + 8x2 = 60 and 4x1 + 4x2 = 60, i.e. (x1 , x2 ) = (10, 5). The optimal value of the objective function is then z = 525. Thus the optimal production plan is to produce 10 type A containers and 5 type B containers per hour. This plan yields the maximum profit, which is 525 per hour. It can be shown (see Proposition 1.3) that if a LP problem has an optimal solution then there is an extreme point of the feasible region where this solution occurs. There can sometimes be optimal solutions which do not occur at extreme points. If two vertices P and Q of the feasible region give equal optimal values for the objective function then the same optimal value occurs at all points on the straight line segment P Q. 45 < p < 45 then the optimal Suppose the profit on container A is changed to p. If 4 45 solution still occurs at (10, 5). If p = or p = 45 there are multiple optimal points, all 4 45 yielding the same profit. If p > 45 then (15, 0) is optimal. If p < then (0, 7.5) is optimal, 4 but 7.5 containers cannot be made. The best integer solution can be found by inspection. 3
Example 2 : Rose-growing problem
A market gardener grows red and white rose bushes. The red and white bushes require an area of 5 dm2 and 4 dm2 per bush respectively. Each red bush costs 8 per year to grow and each white bush costs 2 per year. The labour needed per year for a red bush is 1 person-hour, whereas for a white bush it is 5 person-hours. The reds each yield a profit of 2, and the whites 3, per bush per year. The total land available is at most 6100 dm2 , and the total available finance is 8000. The labour available is at most 5000 person-hours per year. How many bushes of each type should be planted to maximize the profit? Step 1 Summarise the information (dm2 ) Red 5 8 1 2 White 4 2 5 3 Max. resource available 6100 8000 5000
Area Finance () Labour (person-hours) Profit
Step 2 Define the decision variables. Let x1 = number of red rose bushes and x2 = number of white rose bushes. Step 3 Specify the objective function. We aim to maximize the profit function. Thus the problem is to Maximize z = 2x1 + 3x2 Step 4 Identify the constraints and the non-negativity conditions. We must have 5x1 + 4x2 6100, 8x1 + 2x2 8000, x1 + 5x2 5000, x1 0, x2 0. Step 5 Sketch the feasible region.
2000
1500
x2 1000
500
0
500
1000 x1
1500
2000
Step 6 Method 1 Sketch a line of the form z = constant and translate this line, in the direction in which z increases, until it no longer intersects the feasible region. The dotted lines in the diagram are z = 2000 and z = 5000. The points on z = 2000 are feasible but not optimal, whereas those on z = 5000 are all infeasible. The optimal point lies between these lines at (500, 900), where z = 3700. 4
Method 2 Evaluate z at each of the extreme points and see where it is greatest. The extreme points of the feasible region (going clockwise) are (x1 , x2 ) = (0, 0), (0, 1000), (500, 900), (900, 400), and (1000, 0). These can be calculated by solving pairs of simultaneous equations. If you just read them off from the graph, you should check that they satisfy the equations of the lines on which they lie. The optimum occurs at (x1 , x2 ) = (500, 900), and the objective function is then z = 2 500 + 3 900 = 3700. Final answer: Growing 500 red and 900 white rose bushes is optimal, with profit 3700. Note that the original problem was stated in words: it did not mention the variables x1 and x2 or the objective function z. Your final answer should not use these symbols, as they have been introduced to formulate the mathematical model.
Example 3 : Cattle feed problem
During the winter, farmers feed cattle a combination of oats and hay. The following table shows the nutritional value of oats and hay, and gives the daily nutritional requirements of one cow: Units of protein Units of fat Units of calcium Units of phosphorus Cost per unit () per unit of hay 13.2 4.3 0.02 0.04 0.66 per unit of oats 34.0 5.9 0.09 0.09 2.08 daily requirement per cow 65.0 14.0 0.12 0.15
Find the optimal feeding plan and identify any redundant constraint(s). Decision variables Suppose the farmer mixes x1 units of hay with x2 units of oats. Objective function The aim is to make the feeding cost per cow as low as possible, so we must Minimize z = 0.66x1 + 2.08x2 .
Constraints and non-negativity conditions The following constraints must be satisfied in order that the cows are fed an adequate diet: 13.2x1 4.3x1 0.02x1 0.04x1 x1 + 34.0x2 + 5.9x2 + 0.09x2 + 0.09x2 x2 65.0 14.0 0.12 0.15 0 0 (protein) (fat) (calcium) (phosphorus) (non-negativity) (non-negativity)
Note that the inequalities here all have `' signs. 5
2.5
2
1.5 x2
1
0.5
0
1
2
3 x1
4
5
6
The feasible region is shown above note that it is unbounded. However an optimum does exist, as we are aiming to minimize the objective function. Extreme points (calculated to two decimal places where appropriate) A (x1 , x2 ) = (6, 0) C (x1 , x2 ) = (1.35, 1.39) z = 3.96 z = 3.78 B (x1 , x2 ) = (3.48, 0.56) D (x1 , x2 ) = (0, 2.37) z = 3.46 z = 4.96
Thus the minimum cost of feeding one cow is approximately 3.46. This is obtained with 3.48 units of hay and 0.56 units of oats. The phosphorus constraint is redundant, as we can see from the diagram. Any mixture containing enough protein will automatically contain enough phosphorus.
1.3
Convexity and extreme points
Definitions The feasible region for a LP problem is a subset of the Euclidean vector space Rn , whose elements we call points. The norm of x = (x1 , . . . , xn ) is |x| = x1 2 + + xn 2 . An equation of the form a1 x1 + + an xn = b, or at x = b, defines a hyperplane in Rn . A hyperplane in R2 is a straight line; in R3 it is a plane. Any hyperplane determines the half-spaces given by at x b and at x b. Consider the expression (1 - r)x + ry where 0 r 1. Geometrically, this weghted average of x and y represents a point on the straight line segment between x and y, and is called a convex linear combination of x and y. More generally, a convex linear combination of the points x1 , . . . , xm is an expression of the form r1 x1 + + rm xm , where r1 + + rm = 1 and ri 0 for i = 1, . . . , m. A convex set is a set S such that if x, y S then (1 - r)x + ry S for all r [0, 1]. It then follows that a convex linear combination of any number of elements of S is also in S. A convex set can be interpreted geometrically as a region S such that if A and B are any two points in S, every point on the straight line segment AB lies in S. Examples of convex sets include: Rn itself; any vector subspace of Rn ; any interval of the real line; any hyperplane; any half-space; the interior of a circle or sphere. 6
We can often use a graph to decide whether a subset of R2 is convex, e.g. {(x, y) : y x2 } is convex whereas {(x, y) : y x3 } is not convex. If S1 , . . . , Sn are convex sets, their intersection S1 Sn is also convex. An extreme point, corner point or vertex of a convex set S is a point z S such that there are no two distinct points x, y S with z = (1 - r)x + ry where r (0, 1). A neighbourhood of a point x Rn is a set of the form {y Rn : |y - x| < } for some > 0. This can also be called an -neighbourhood or an open ball of radius . Let S be a subset of Rn . A point x in S is an interior point of S if some neighbourhood of x is contained in S. If every point of S is an interior point then S is an open set. A point y, not necessarily in S, is a boundary point of S if every neighbourhood of y contains a point in S and a point not in S. The set of all boundary points of S is called the boundary of S. If every boundary point of S is in S then S is a closed set. Every point in S is either an interior point or a boundary point of S. Some sets are neither open nor closed. Others, such as Rn itself, are both open and closed. A set S Rn is bounded if there exists a real number M such that |x| < M for all x S. If S is bounded and closed then S is said to be a compact set. If S is not bounded it has a direction of unboundedness, i.e. a vector u such that for all x S and k 0, x + ku S. (In general there are infinitely many such directions.) The feasible region for a LP problem with n decision variables is the intersection of a finite number of half-spaces in Rn . Hence it is convex. The region is closed, since it includes the hyperplanes which form its boundary, and it has a finite number of extreme points. Proposition 1.1 (Weierstrass's Theorem, or the Extreme Value Theorem) Let f be a continuous real-valued function defined on a non-empty compact subset S of Rn . Then f(x) attains minimum and maximum values on S, i.e. there exist xm , xM S such that - < f(xm ) f(x) f(xM ) < for all x S. Example Consider the problem: x1 + x2 6, - x2 + 2x3 4, Maximize z = 4x1 + x2 + 3x3 , subject to 0 x2 4, x3 0.
0 x1 4,
7
The feasible set is a convex polyhedron or simplex with seven plane faces, as shown. As it is closed and bounded, and any linear function is continuous, Weierstrass's theorem tells us that z attains a greatest and least value over this region. Clearly the minimum occurs at (0, 0, 0). It turns out that z is maximum at (4, 2, 3). Considering other objective functions with the same feasible region, x1 +x2 +x3 is maximum at (2, 4, 4), while x1 - 3x2 - x3 is maximum at (4, 0, 0). Proposition 1.2 Let S be the intersection of a finite number of half-planes in Rn . Let v1 , . . . , vm be the extreme points of S. Then x S if and only if x = r1 v1 + + rm vm + u where r1 + + rm = 1, each ri 0, and u is 0 if S is bounded and a direction of unboundedness otherwise. The proof of the `if' part of the above result is in the Exercises. The `only if' part is more difficult to prove, but if we assume it we can show the following: Proposition 1.3 (The Extreme Point Theorem) Let S be the feasible region for a linear programming problem. 1. If S is non-empty and bounded then an optimal solution exists and there is an extreme point of S at which it occurs. 2. If S is non-empty and not bounded, and if an optimal solution to the LP problem exists, then an optimal solution occurs at an extreme point of S. Proof Let the objective function be z = c1 x1 + + cn xn = ct x. S is closed so in case 1 it is compact, hence by Weierstrass's theorem z attains its maximum and minimum values at some points in S. In case 2 we are assuming that the required optimum is attained. Suppose z is to be maximized, and takes its maximum value over S at x . Let the extreme points of S be v1 , . . . , vm . Suppose there is no extreme point where z is maximum, so ct vj < ct x for j = 1, . . . , m. By Proposition 1.2, x = r1 v1 + + rm vm + u where r1 + + rm = 1, each ri 0, and u is 0 in case 1 or a direction of unboundedness in case 2. Thus ct x = ct (r1 v1 + + rm vm + u) = r1 ct v1 + + rm ct vm + ct u < r1 ct x + + rm ct x + ct u = (r1 + + rm )ct x + ct u = ct x + ct u, since r1 + + rm = 1. If u = 0 we have ct x < ct x , giving a contradiction, so z is maximum at an extreme point. If u = 0 then we have ct x < ct x + ct u, so ct u > 0. Now x + ku S for any k > 0. ct (x + ku) = ct x + kct u, which tends to as k , so z is unbounded on S, contradicting the assumption that z takes its maximum value in S. Hence again z is maximum at an extreme point. If z is to be minimized, the same reasoning can be applied to -z. 8
Exercises 1
1. Solve the following Linear Programming problems graphically. (a) Maximize z = 2x1 + 3x2 subject to 2x1 + 5x2 10, x1 - 4x2 -1, x1 0, x2 0. (b) Minimize z = 4x2 - 5x1 subject to x1 + x2 10, -2x1 + 3x2 -6, 6x1 - 4x2 13. 2. The objective function z = px + qy, where p > 0, q > 0, is to be maximized subject to the constraints 3x + 2y 6, x 0, y 0. Find the maximum value of z in terms of p and q. (There are different cases, depending on the relative sizes of p and q.) 3. A company makes two products, A and B, using two components X and Y . To produce 1 unit of A requires 5 units of X and 2 units of Y . To produce 1 unit of B requires 6 units of X and 3 units of Y . At most 85 units of X and 40 units of Y are available per day. The company makes a profit of 12 on each unit of A and 15 on each unit of B. Assuming that all the units produced can be sold, find the number of units of each product that should be made per day to optimze the profit. If the profit on B is fixed, how low or high would the profit on A have to become before the optimal production schedule changed? 4. A brick company manufactures three types of brick in each of its two kilns. Kiln A can produce 2000 standard, 1000 oversize and 500 glazed bricks per day, whereas kiln B can produce 1000 standard, 1500 oversize and 2500 glazed bricks per day. The daily operating cost for kiln A is 400 and for kiln B is 320. The brickyard receives an order for 10000 standard, 9000 oversize and 7500 glazed bricks. Determine the production schedule (i.e. the number of days for which each kiln should be operated) which will meet the demand at minimum cost (assuming both kilns can be operated immediately) in each of the following separate cases. (Note: the kilns may be used for fractions of a day.) (a) there is no time limit, (b) kiln A must be used for at least 5 days, (c) there are at most 2 days available on kiln A and 9 days on kiln B. 5. A factory can assemble mobile phones and laptop computers. The maximum amount of the workforce's time that can be spent on this work is 10 hours per day. Before the phones and laptops can be assembled, the component parts must be purchased. The maximum value of the stock that can be held for a day's assembly work is 2200. In the factory, a mobile phone takes 10 minutes to assemble using 10 worth of components whereas a laptop takes 1 hour 40 minutes to assemble using 500 worth of components. The profit made on a mobile phone is 5 and the profit on a laptop is 100. (a) Summarise the above information in a table. 9
(b) Assuming that the factory can sell all the phones and laptops that it assembles, formulate the above information into a Linear Programming problem. (c) Determine the number of mobile phones and the number of laptops that should be made in a day to maximise profit. (d) The market for mobile phones is saturating. In response, retailers are dropping prices which means reduced profits. How low can the profit on a mobile phone go before the factory should switch to assembling only laptops? 6. In the Containers problem (Example 1), suppose we write the machine constraints as 2x1 + 8x2 + x3 = 60 and 4x1 + 4x2 + x4 = 60, where x3 and x4 are the number of minutes in an hour for which M1 and M2 are not used, so x3 0 and x4 0. Show that the objective function can be written as 1 1 z = 30 10 + x3 - x4 6 3 1 1 + 45 5 - x3 + x4 . 6 12
By simplifying this, deduce that that the maximum value of z occurs when x3 = x4 = 0 and state this maximum value. 7. By sketching graphs and using the fact that the straight line joining any two points of a convex set lies in the set, decide which of the following subsets of R2 are convex. (a) {(x, y) : xy 1, x 0, y 0}, (c) {(x, y) : y - x2 1}, (e) {(x, y) : x2 - y 2 = 1}, (b) {(x, y) : xy -1, x 0}, (d) {(x, y) : 2x2 + 3y 2 < 6}, (f) {(x, y) : y ln x, x > 0}.
8. Let a = (a1 , . . . , an ) be a fixed element of Rn and let b be a real constant. Let x1 and x2 lie in the half-space at x b, so that at x1 b and at x2 b. Prove that for all r [0, 1], at ((1 - r)x1 + rx2 ) b. Deduce that the half-space is a convex set. 9. Let S and T be convex sets. Show that their intersection S T is a convex set. (Hint : let x, y S T , so x, y S and x, y T . Why must (1 - r)x + ry be in S T for 0 r 1?) Generalise this to show that if S1 , . . . , Sn are convex sets then S = S1 . . . Sn is convex. Deduce that the feasible region for a linear programming problem is convex. 10. Let S be the feasible region for a Linear Programming problem. If an optimal solution to the problem does not exist, what can be deduced about S from Proposition 1.3? 11. Prove that every extreme point of a convex set S is a boundary point of S. (Method: suppose x is in S and is not a boundary point. Then some neighbourhood of x must be contained in S (why?) Deduce that x is a convex linear combination of two points in this neighbourhood and so x is not an extreme point.) 12. Prove the `if' part of Proposition 1.3 as follows. Let the half-planes defining S be a1 t x b1 , . . . , ak t x bk , so x = vi satisfies all these inequalities for i = 1, . . . , m. Show that x = r1 v1 + +rm vm also satisfies all the inequalities, where r1 + +rm = 1 and each ri 0. Deduce that if S is unbounded and u is a direction of unboundedness then r1 v1 + + rm vm + u S.
10
Chapter 2
The Simplex Method
2.1 Matrix formulation of Linear Programming problems
If a LP problem has more than two decision variables then a graphical solution is impracticable. We therefore develop an algebraic, rather than geometric, approach. We write x 0 to mean that every entry of the vector x is positive or zero. x is then called a non-negative vector. The set of non-negative vectors in Rn is denoted by Rn . + x y means that every entry of x is less than or equal to the corresponding entry of y. Thus x y is equivalent to y - x 0. If x and y are non-negative vectors then xt y 0, and if x + y = 0 then x = 0 and y = 0. If v 0 and x y then vt x vt y. Recall that for matrices A and B, (AB)t = Bt At . For vectors x and y, we have that xt y = yt x and xt Ay = yt At x (these are all scalars). We shall sometimes need to work with partitioned matrices. If two matrices can be split into blocks which are conformable for matrix multiplication, then A11 A12 A21 A22 B11 B12 B21 B22 = A11 B11 + A12 B21 A11 B12 + A12 B22 A21 B11 + A22 B21 A21 B12 + A22 B22 .
A typical LP problem seeks values of the decision variables x1 , x2 ,. . . , xn to optimize the objective function z = c1 x1 + c2 x2 + + cn xn subject to the constraints a11 x1 + a12 x2 + + a1n xn a21 x1 + a22 x2 + + a2n xn . . . b1 b2
am1 x1 + am2 x2 + + amn xn bm and the non-negativity conditions x1 0, x2 0, . . . , xn 0.
A maximization LP problem can be written in matrix-vector form as 11
Maximize z = ct x subject to Ax b and x0 where A is the m n matrix with (i, j) entry x1 . x = . , b = . xn
(LP1) aij and b1 . , c = . . bm
c1 . . . . cn
The problem (LP1) is said to be feasible if the constraints are consistent, i.e. there exists some x Rn such that Ax b. The vector x is then a feasible solution of (LP1). If it + maximizes z, it is the optimal solution. The problem is unbounded if there is no finite maximum over the feasible region, i.e. there exists a sequence of vectors {xk } satisfying the constraints such that ct xk as k . The standard form of a LP problem is defined as follows: 1. The objective function is to be maximized. 2. All constraints are equations with non-negative right-hand sides. 3. All the variables are non-negative. Any LP problem can be converted into standard form by the following methods: Minimizing f(x) is equivalent to maximizing -f(x). Thus, the problem Minimize c1 x1 + c2 x2 + + cn xn is equivalent to Maximize - c1 x1 - c2 x2 - - cn xn subject to the same constraints, and the optimum occurs at the same values of x1 , . . . , xn . Any equation with a negative right hand side can be multiplied through by -1 so that the right-hand side becomes positive. Remember that if an inequality is multiplied through by a negative number, the inequality sign must be reversed. A constraint of the form can be converted to an equation by adding a non-negative slack variable to the left-hand side of the constraint. A constraint of the form can be converted to an equation by subtracting a non-negative surplus variable from the left-hand side of the constraint.
2.1.1
Example
Suppose we start with the problem Minimize subject to and z = -3x1 + 4x2 - 5x3 3x1 + 2x2 - 3x3 4 2x1 - 3x2 + x3 -5 x1 0, x2 0, x3 0.
Rewrite the second constraint with a non-negative right-hand side: -2x1 + 3x2 - x3 5. 12
Then add a slack variable x4 in the first constraint and subtract a surplus variable x5 in the second one. In standard form the problem is Maximize subject to and z = 3x1 - 4x2 + 5x3 3x1 + 2x2 - 3x3 + x4 = 4 -2x1 + 3x2 - x3 - x5 = 5 xj 0 for j = 1, . . . , 5.
The slack and surplus variables represent the differences between the left and right hand sides of the inequalities. If a slack or surplus variable is zero at a point then the corresponding constraint is said to be active or binding or tight at that point. A variable is unrestricted if it is allowed to take both positive and negative values. An unrestricted variable xj can be expressed in terms of two non-negative variables by substituting xj = xj - xj where both xj and xj are non-negative. The substitution must be used throughout, i.e. in all the constraints and in the objective function.
2.1.2
Example
Suppose we have to maximize z = x1 - 2x2 subject to the constraints x1 + x2 4, 2x1 + 3x2 5, x1 0 and x2 unrestricted in sign. To express the problem in standard form, let x2 = x2 - x2 where x2 0, x2 0. Introducing a slack variable x3 and a surplus variable x4 , the problem in standard form is: Maximize z = x1 - 2x2 + 2x2 subject to x1 + x2 - x2 + x3 = 4, 2x + 3x2 - 3x2 - x4 = 5 and x1 , x2 , x2 , x3 , x4 0. If a LP problem contains n non-negative decision variables and m inequality constraints then we need m additional (slack or surplus) variables and so the total number of variables becomes n + m. In this case the problem (LP1) can be written in the form ~~ Maximize z = ct x ~x subject to A~ = b ~ and x0 (LP2) x1 . . . c1 . . . , c = cn . ~ 0 . . . 0
xn ~ ~ where A is the m (n + m) matrix (A | Im ), x = xn+1 . . . xn+m
The constraints are now expressed as m linearly independent equations in n + m unknowns, which represent m hyperplanes in Rn+m . Their general solution depends on n arbitrary parameters, which we can set equal to zero to get a particular solution. ~ A feasible solution of (LP2) is a vector v Rn+m such that Av = b.
+
~ If b 0 then (LP2) is in standard form and has an obvious feasible solution x =
0 b
.
13
2.1.3
Example
Suppose we have to maximize z = x1 + 2x2 + 3x3 subject to 2x1 + 4x2 + 3x3 10, 3x1 + 6x2 + 5x3 15 and x1 0, x2 0, x3 0. Introducing slack variables x4 , x5 0, this can be written as x1 x1 x2 x2 x3 subject to 2 4 3 1 0 x3 = Maximize z = 1 2 3 0 0 3 6 5 0 1 x4 x4 x5 x5 where x1 , . . . , x5 0.
10 15
,
Setting any 3 variables to zero, if the resulting equations are consistent we can solve for the other two, e.g. (1, 2, 0, 0, 0) and (0, 0, 0, 10, 15) are feasible solutions for (x1 , x2 , x3 , x4 , x5 ). Note that setting x3 = x4 = x5 = 0 gives 2x1 + 4x2 = 10, 3x1 + 6x2 = 15 which are the same equation and do not have unique solutions for x1 and x2 . A unique solution of (LP2) obtained by setting n variables to zero is called a basic solution. If it is also feasible, i.e. non-negative, it is a basic feasible solution (bfs). The n variables set to zero are called non-basic variables; the remaining m (some of which may be zero) are basic variables. The set of basic variables is called a basis. In the above example, (0, 0, 10/3, 0, -5/3) is a basic infeasible solution. (1, 2, 0, 0, 0) is a feasible solution but not a bfs. (0, 0, 3, 1, 0) is a basic feasible solution with basis {x3 , x4 }. ~ It can be proved that x is a basic feasible solution of (LP2) if and only if it is an extreme point of the feasible region in Rn+m . The vector x consisting of the first n components of ~ x is then an extreme point of the original feasible region in Rn . In any LP problem that has an optimal solution, we know by Proposition 1.3 that an optimal solution exists at an extreme point. Hence we are looking for the basic feasible solution which optimizes the objective function. Suppose we have a problem with n = 25 original variables and m = 15 constraints, giving rise to 15 slack (or surplus) variables. In each basic feasible solution, 25 variables are set 40 equal to zero. There are possible sets of 25 variables which could be equated to 25 zero, which is more than 4.0 1010 combinations. Clearly an efficient method for choosing the sets of variables to set to zero is required! Suppose that we are able to find an initial bfs, say x1 , we have a way of checking whether a bfs xi is optimal, and we have a way of moving from a non-optimal bfs xi to another, xi+1 , that yields a better value of the objective function. Combining these three separate steps will yield an algorithm for solving the LP problem. If x1 is optimal, then we are done. If it is not, then we move from x1 to x2 , which is better than x1 by definition. If x2 is not optimal then we move to x3 and so on. Since the number of extreme points is finite and we always move towards a better one, we must ultimately find the optimal one. The Simplex method is based on this principle. 14
2.2
The Simplex algorithm
Consider the Linear Programming problem: Maximize z = 12x1 + 15x2 subject to 5x1 + 6x2 85, 2x1 + 3x2 40 and x1 0, x2 0. To use the Simplex method we must first write the problem in standard form: Maximize subject to and z = 12x1 + 15x2 5x1 + 6x2 + x3 = 85 2x1 + 3x2 + x4 = 40 x1 0, x2 0. (1) (2)
The two equations in four unknowns have infinitely many solutions. Setting any two of x1 , x2 , x3 , x4 to zero gives a unique solution for the other two, hence a basic solution of the problem. If we take x1 = 0, x2 = 0, x3 = 85, x4 = 40 we certainly have a basic feasible solution; since it gives z = 0 it is clearly not optimal. z can be made larger by increasing x1 or x2 . 1 Equation (2) gives x2 = (40 - 2x1 - x4 ). 3 Now express z in terms of x1 and x4 only: z = 12x1 + 15x2 = 12x1 + 5(40 - 2x1 - x4 ) = 200 + 2x1 - 5x4 . If we let x1 = x4 = 0 we find z = 200. This is a great improvement on 0, and corresponds 40 to increasing x2 to so that the second constraint holds as an equation. We have moved 3 from the origin to another vertex of the feasible region. Now x3 = 5, so there are still 5 units of slack in the first constraint. All the xj are 0 so we still have a bfs. z can be improved further by increasing x1 . Eliminating x2 between the constraint equations: (1) - 2 (2) gives x1 = 5 - x3 + 2x4 . We then have z = 200 + 2x1 - 5x4 = 200 + 2(5 - x3 + 2x4 ) - 5x4 = 210 - 2x3 - x4 . As all the variables are non-negative, increasing x3 or x4 above zero would make z smaller than 210. Hence the maximum value of z is 210 and this occurs when x3 = x4 = 0, i.e. there is no slack in either constraint. Then x1 = 5, x2 = 10. We have moved round the feasible region to the vertex where the two constraint lines intersect. The above working can be set out in an abbreviated way. The objective function is written as z - 12x1 - 15x2 = 0. This and the constraints are three equations in five unknowns z, x1 , x2 , x3 , x4 . This system of linear equations holds at every feasible point. We can obtain an equivalent system of equations by combining these equations together, so long as the resulting equations remain linearly independent. This can be carried out most easily by writing the equations in the form of an augmented matrix and carrying out row operations, as in Gaussian elimination. This matrix is written in a way which helps us to identify the basic variables at each stage, called a simplex tableau. Eventually we should get an expression for the objective function of the form z = k- j xj where each j 0, such as z = 210 - 2x3 - x4 in the example above. Then increasing any of the xj will decrease z, so we have arrived at a maximum value of z. 15
A simplex tableau consists of a grid with headings for each of the variables and a row for each equation, including the objective function. Under the heading `Basic' are the variables which yield a basic feasible solution when they take the values in the `Solution' column and the others are all zero. The `=' sign comes immediately before the `Solution' column. You will find various forms of the tableau in different books. Some omit the z column and/or the `Basic' column. The objective function is often placed at the top. Some writers define the standard form to be a minimizing rather than a maximizing problem. For the problem on the previous page, the initial tableau is: Basic x3 x4 z z 0 0 1 x1 5 2 -12 x2 6 3 -15 x3 1 0 0 x4 0 1 0 Solution 85 40 0
This tableau represents the initial basic feasible solution x1 = x2 = 0, x3 = 85, x4 = 40 giving z = 0. Hence x3 and x4 are the basic variables at this stage. The negative values in the z row tell us that this solution is not optimal: z -12x1 -15x2 = 0 so z can be made larger by increasing x1 or x2 from 0. Increasing x2 is likely to give the best increase in z, as the largest coefficient in z is that of x2 . We carry out row operations on the tableau so as to make x2 basic. One of the entries in the x2 column must become 1 and the others must become 0. The right-hand sides must all remain non-negative. Thus we choose the entry `3' as the `pivot'. Divide Row 2 by 3 to make the pivot 1. Then combine multiples of this row (only) with each of the other rows so that all other entries in the pivot column become zero: Basic x3 x2 z z 0 0 1 x1 1 2/3 -2 x2 0 1 0 x3 1 0 0 x4 -2 1/3 5 Solution 5 40/3 200
R1 := R1 - 2R2 R2 := R2 /3 R3 := R3 + 5R2
40 , x3 = 5, x4 = 0. x4 has left the basis 3 (it is the `departing variable') and x2 has entered the basis (it is the `entering variable'). This represents the bfs z = 200 when x1 = 0, x2 = Now the bottom row says z - 2x1 + 5x4 = 200 so we can still increase z by increasing x1 . Thus x1 must enter the basis. The entry `1' in the top left of the tableau is the new pivot, and all other entries in its column must become 0. x3 leaves the basis. Basic x1 x2 z z 0 0 1 x1 1 0 0 x2 0 1 0 x3 1 -2/3 2 x4 -2 5/3 1 Solution 5 10 210
2 R2 := R2 - 3 R1 R3 := R3 + 2R1
Now there are no negative numbers in the z row, which says z + 2x3 + x4 = 210. Increasing a non-basic variable from 0 cannot now increase z, so we have the optimal value z = 210 when x3 = x4 = 0. The tableau shows that x1 = 5, x2 = 10 are the values at which the maximum occurs. 16
The rose-growing problem revisited
Consider the rose-growing problem from Chapter 1. Step 1 Write the problem in standard form. Maximise z = 2x1 + 3x2
= 6100 5x1 + 4x2 + x3 8x1 + 2x2 + x4 = 8000 subject to x1 + 5x2 + x5 = 5000 and xj 0 for j = 1, . . . , 5.
The slack variables x3 , x4 , x5 represent the amount of spare area, finance and labour that are available. The extreme points of the feasible region are: Extreme point O A B C D x1 0 0 500 900 1000 x2 0 1000 900 400 0 x3 6100 2100 0 0 1100 x4 8000 6000 2200 0 0 x5 5000 0 0 2100 4000 Objective function z 0 3000 3700 3000 2000
The boundary lines each have one of x1 , . . . , x5 equal to zero. Hence the vertices of the feasible region, which occur where two boundary lines intersect, correspond to solutions in which two of the five variables in (LP2) are zero.
1200
1000
800
x2 600
400
200
0
200
400
600 x1
800
1000
1200
The simplex method systematically moves around the boundary of this feasible region, starting at the origin and improving the objective function at every stage. Step 2 Form the initial tableau. Basic x3 x4 x5 z z 0 0 0 1 x1 5 8 1 -2 x2 4 2 5 -3 x3 1 0 0 0 x4 0 1 0 0 x5 0 0 1 0 Solution 6100 8000 5000 0
Notice that the bottiom row comes from writing the objective function as z - 2x1 - 3x2 = 0. 17
The tableau represents a set of equations which hold simultaneously at every feasible solution. The `=' sign in the equations occurs immediately before the solution column. There are 5 - 3 = 2 basic variables. Each column headed by a basic variable has entry 1 in just one row and 0 in all the other rows. In the above tableau, x1 and x2 are non-basic; if they are set equal to zero, an initial basic feasible solution can be read directly from the tableau: x3 = 6100, x4 = 8000 and x5 = 5000, giving z = 0. Step 3 Test for optimality. Are all the coefficients in the z-row non-negative? 1. If yes, then stop the optimal solution has been reached. 2. If no, then go to Step 4. The bottom row of the above tableau says z - 2x1 - 3x2 = 0, so clearly z can be increased by increasing x1 or x2 . Step 4 Choose the variable to enter the basis: the entering variable. This will be increased from its current value of 0. z = 2x1 + 3x2 , so we should be able to increase z the most if we increase x2 from 0. (The rate of change of z is greater with respect to x2 ; this is called a steepest ascent method.) Thus we choose the column with the most negative entry in the z-row. Suppose this is in the column headed xj . Then xj is the entering variable. Here the entering variable is x2 , as this has the most negative entry (-3) in the z-row. Step 5 Choose the variable to leave the basis: the departing variable. This will be decreased to 0 from its current value. Column j now needs to become `basic', so that it has 1 in some row i and 0 in every other row. To avoid making the right-hand side negative, we need aij > 0. If there are no positive entries in column j then stop the problem is unbounded and has no solution. Otherwise a multiple of row i must be added to every other row k so as to make the entries in column j zero. The operations on rows i and k must be: bi Ri := a1 Ri 1 aij bi aij ij - a a Rk := Rk - akj Ri for all k = i akj bk 0 bk - akj bi ij ij To keep all the right-hand sides non-negative requires bk - this certainly holds if akj 0. If akj > 0 then the condition gives akj bi 0 for all k. Since aij > 0, aij
bi bk for all k, so row i has to be the row in which aij akj bi aij > 0 and the row quotient i = is minimum. This row is the pivot row. aij The element aij in the selected row and column is called the pivot element. The basic variable corresponding to this row is the departing variable. It becomes 0 at this iteration. Step 6 Form a new tableau. Divide the entire pivot row by the pivot element, to obtain a 1 in the pivot position. Make every other entry in the pivot column zero, including the entry in the z-row, by carrying out row operations in which multiples of the pivot row (only) are added to or subtracted from the other rows. Then go to Step 3. 18
Applying this procedure to the rose-growing problem, we have: Initial tableau Basic x3 x4 x5 z
z 0 0 0 1
x1 5 8 1 -2
x2 4 2 5 -3
x3 1 0 0 0
x4 0 1 0 0
x5 0 0 1 0
Solution 6100 8000 5000 0
i 6100 4 = 1525 8000 2 = 4000 5000 5 = 1000 (smallest)
The entering variable is x2 , as this has the most negative coefficient in the z-row. Calculating the associated row quotients i shows that x5 is the departing variable, i.e. the x5 row is the pivot row for the row operations. The pivot element is 5. Fill in the next two tableaux: Second tableau Basic z 0 0 0 1 z 0 0 0 1 x1 x2 x3 x4 x5 Solution i
z Final tableau Basic
x1
x2
x3
x4
x5
Solution
z
The coefficients of the non-basic variables in the z-row are both positive. This shows that we have reached the optimum make sure you can explain why! The algorithm now stops and the optimal values can be read off from the final tableau. zmax = 3700 when (x1 , x2 , x3 , x4 , x5 ) = (500, 900, 0, 2200, 0).
Summary
We move from one bfs to the next by taking one variable out of the basis and bringing one variable into the basis. The entering variable is chosen by looking at the numbers in the z-row of the current tableau. If they are all non-negative then we already have the optimum value. Otherwise we choose the non-basic column with the most negative number in the z-row of the current tableau. The departing variable is determined (usually uniquely) by finding the basic variable which will be the first to reach zero as the entering variable increases. This is identified by finding the row with a positive entry in the pivot column such that the row quotient i is minimum. The version of the algorithm described here can be used only on problems which are in standard form. It relies on having an initial basic feasible solution. This is easy to find when all the constraints are of the `' type. However, in some cases such as the cattle feed problem this is not the case and a modification of the method is needed.
19
2.2.1
1.
Further examples
Minimize -2x1 - 4x2 + 5x3 , subject to
x1 + 2x2 + x3 5, 2x1 + x2 - 4x3 6, 3x1 - 2x2 -3, xj 0 for j = 1, 2, 3. In standard form, the problem is: Maximize z = 2x1 + 4x2 - 5x3 , subject to x1 + 2x2 + x3 + x4 = 5, 2x1 + x2 - 4x3 + x5 = 6, Basic z 0 0 0 1 z 0 0 0 1 z 0 0 0 1 x1 x2 x3 x4 - 3x1 + 2x2 + x6 = 3, all xj 0. x5 x6 Solution
z Basic
x1
x2
x3
x4
x5
x6
Solution
z Basic
x1
x2
x3
x4
x5
x6
Solution
z
From the last tableau z = 10 - 7x3 - 2x4 - 0x6 , so any increase in a non-basic variable (x3 , x4 or x6 ) would decrease z. Hence this tableau is optimal. z has a maximum value of 10, so the minimum of the given function is -10 when x1 = 0.5, x2 = 2.25, x3 = 0. x5 = 2.75 shows that strict inequality holds in the second constraint: 2x1 + x2 - 4x3 falls short of 6 by 2.75. The other constraints are active at the optimum. 2. Maximize z = 4x1 + x2 + 3x3 , subject to - x2 + 2x3 4, x1 4, x2 4, xj 0 for j = 1, 2, 3. - x2 + 2x3 + x5 = 4, x1 + x6 = 4, x2 + x7 = 4. Basic z 0 0 0 0 1 z 0 0 0 0 1 x1 x2 x3 x4 x5 x6 x7 Solution
x1 + x2 6,
In standard form, the constraints become: x1 + x2 + x4 = 6,
z Basic
x1
x2
x3
x4
x5
x6
x7
Solution
z
20
Basic
z Basic
z 0 0 0 0 1 z 0 0 0 0 1
x1
x2
x3
x4
x5
x6
x7
Solution
x1
x2
x3
x4
x5
x6
x7
Solution
z
5 3 3 The entries in the objective row are all positive; this row reads z + x4 + x5 + x6 = 27. 2 2 2 (Note that z is always expressed in terms of the non-basic variables in each tableau.) Thus z has a maximum value of 27 when x4 = x5 = x6 = 0 and x1 = 4, x2 = 2, x3 = 3, x7 = 2. Only one slack variable is basic in the optimal solution, so the at this optimal point the first three constraints are active they hold as equalities while the fourth inequality x2 4 is inactive. Indeed, x2 is strictly less than 4, by precisely 2 which is the amount of slack in this constraint. From the final tableau, each basic variable can be expressed in terms of the non-basic 1 1 1 1 1 1 variables, e.g. the x3 row says x3 + x4 + x5 - x6 = 3, so x3 = 3 - x4 - x5 + x6 . 2 2 2 2 2 2
2.3
Degeneracy
When one (or more) of the basic variables in a basic feasible solution is zero, both the problem and that bfs are said to be degenerate. In a degenerate problem, the same bfs may correspond to more than one basis. This will occur when two rows have the same minimum quotient i . Selecting either of the associated variables to become non-basic results in the one not chosen, which therefore remains basic, becoming equal to zero in the next basic feasible solution. Degeneracy reveals that the LP problem has at least one redundant constraint. The problem of degeneracy is easily dealt with in practice; just keep going! If two or more of the row quotients i are equal, pick any one of them and proceed to the next tableau. There will then be a 0 in the `Solution' column. Follow the usual rules: the minimum i may be 0, so long as aij > 0. Even if the value of z does not increase, a new basis has been found and we should eventually get to the optimum. Example: Consider the following problem: Maximize z = 3x1 - x2 2x1 - x2 4 x1 - 2x2 2 subject to x1 + x2 5 and xj 0, j = 1, 2. 21
Degeneracy
Graphically, we see that the optimum occurs when x1 = 3, x2 = 2. The vertex (2, 0) has three lines passing through it. Since, in 2-dimensions, only two lines are needed to define an extreme point, this point is overdetermined and one of the constraints is redundant. In standard form, the problem is:
x2
0 0
1
2
3
4
5
6
1
2
3 x1
4
5
6
Maximize z = 3x1 - x2 2x1 - x2 + x3 = 4 x1 - 2x2 + x4 = 2 subject to x1 + x2 + x5 = 5 and xj 0 for j = 1, . . . , 5. Basic x3 x4 x5 z z 0 0 0 1 x1 2 1 1 -3 x2 -1 -2 1 1 x3 1 0 0 0 x4 0 1 0 0 x5 0 0 1 0 Solution 4 2 5 0 i 2 2 5
The entering variable must be x1 . The departing variable could be either of x3 or x4 . We will arbitrarily choose x4 to depart. The next tableau is: Basic x3 x1 x5 z z 0 0 0 1 x1 0 1 0 0 x2 3 -2 3 -5 x3 1 0 0 0 x4 -2 1 -1 3 x5 0 0 1 0 Solution 0 2 3 6 i 0 1
Now x3 is basic but takes the value x3 = 0, so we are at a degenerate bfs. The algorithm has not finished as there is a negative entry in the z-row. The next iteration gives: Basic x2 x1 x5 z z 0 0 0 1 x1 0 1 0 0 x2 1 0 0 0 x3 1/3 2/3 -1 5/3 x4 -2/3 -1/3 1 -1/3 x5 0 0 1 0 Solution 0 2 3 6 i
3
This solution is degenerate again, and the objective function has not increased. There is still a negative entry in the z-row. Pivoting on the x5 row gives: Basic x2 x1 x4 z z 0 0 0 1 x1 0 1 0 0 x2 1 0 0 0 x3 -1/3 1/3 -1 4/3 x4 0 0 1 0 x5 2/3 1/3 1 1/3 Solution 2 3 3 7
The algorithm has now terminated. zmax = 7 when x1 = 3, x2 = 2. 22
Both the second and third tableaux represent the point (2, 0, 0, 0, 3). The only difference is that the decision variables are classified differently as basic and nonbasic at the two stages. In a degenerate problem, it is possible (though unlikely) that the Simplex algorithm could return at some iteration to a previous tableau. Once caught in this cycle, it will go round and round without improving z. Several methods have been proposed for preventing cycling. One of the simplest is the `smallest subscript rule' or `Bland's rule', which states that the simplex method will not cycle provided that whenever there is more than one candidate for the entering or leaving variable, the variable with the smallest subscript is chosen (e.g. x3 in preference to x4 ).
2.4
Theory of the Simplex method
We now make some observations which provide more insight into how and why the Simplex algorithm works. In the rose growing problem we had the initial and final tableaux: Initial tableau Basic x3 x4 x5 z Final tableau Basic x1 x4 x2 z z 0 0 0 1 x1 1 0 0 0 x2 0 0 1 0 x3 5/21 -38/21 -1/21 1/3 x4 0 1 0 0 x5 -4/21 22/21 5/21 1/3 Solution 500 2200 900 3700 z 0 0 0 1 x1 5 8 1 -2 x2 4 2 5 -3 x3 1 0 0 0 x4 0 1 0 0 x5 0 0 1 0 Solution 6100 8000 5000 0
In the initial tableau, the 3 3 identity matrix appears below the slack variables. In 5/21 0 -4/21 the final tableau another 3 3 matrix M = -38/21 1 22/21 appears in this -1/21 0 5/21 position. The middle three rows of the initial tableau have been pre-multiplied by M to give these rows in the final tableau. M tells us the row operations that would convert the middle rows of the initial tableau 38 22 directly to those in the final tableau, e.g. R2 := - R1 + R2 + R3 . This applies 21 21 500 6100 to all columns including the `solution' column, where M 8000 = 2200 . 900 5000 In the final tableau, the columns of the identity matrix occur under x1 , x4 , x2 respectively. If we the corresponding columns of the initial tableau together to form a put 5 0 4 matrix B = 8 1 2 then MB = I so M = B-1 . 1 0 5 23
In the bottom row of the tableau, the initial row of zeros under the slack variables has 1 1 become 0 in the final tableau. This row vector multiplies each column in 3 3 the middle section of the initial tableau to give the values that have been added to 4 1 1 2 the bottom row of the final tableau, e.g. 0 + (-3) = 0. 3 3 5 5/21 0 -4/21 0 -38/21 1 22/21 0 The entire initial tableau is pre-multiplied by the matrix P = -1/21 0 5/21 0 1/3 0 1/3 1 to give the final tableau. To generalize this, suppose we are maximizing z = ct x subject to Ax b (where b 0) and x 0. The initial tableau has the following form, where Im is the m m identity matrix. Main variables x1 xn A -c1 -cn Slack variables xn+1 xn+m Im 0 0
Basic xn+1 . . . xn+m z
z 0 . . . 0 1
Solution b1 . . . bm 0
Any subsequent tableau may be represented as follows, for a suitable matrix B: Main variables x1 xn B-1 A d1 dn Slack variables xn+1 xn+m B-1 y1 ym
Basic
z 0 . . . 0 1
Solution B-1 b z
z
When this tableau is optimal, z = zmax and d1 , . . . , dn , y1 , . . . , ym are all 0. If we put the `z' column immediately before the solution column then, where the (m 1) + 0 . . B-1 . . (m + 1) identity matrix was initially, there would now be P = 0 y1 ym 1 Let yt = (y1 ym ). The entire initial tableau is pre-multiplied by P to give the new tableau: B-1 yt 0 1 A -ct I 0t b = 0 B-1 A yt A - ct B-1 yt B-1 b . tb y
We see that z = yt b, which can also be written as bt y. 24
For optimality we must have y 0 and yt A - ct 0, i.e. At y c. We shall meet these conditions again when we study the dual of a LP problem. Now suppose that at a particular stage k of the Simplex algorithm the basic variables, reading down the list in the `Basic' column, are xB1 , . . . , xBm and the non-basic variables are xN 1 , . . . , xN n . The initial tableau can be rearranged as follows: Stage k basic variables xB1 xBm B -cB1 -cBm Stage k non-basic variables xN 1 xN n N -cN 1 -cN n
Basic xn+1 . . . xn+m z
z 0 . . . 0 1
Solution b 0
Thus the objective function can be written as z = cB1 xB1 + + cBm xBm + cN 1 xN 1 + + cN n xN n . Let cB = (cB1 cBm )t , cN = (cN 1 cN n )t . With the columns arranged in this order, the process of transforming the initial tableau to the stage k tableau is: B-1 yt 0 1 B -cB t N -cN t b = 0 I y t B - cB t B-1 N yt N - cN t
B-1 b tb y
We must have zeros at the bottom of the basic columns, so yt B - cB t = 0. As B is non-singular, we can rewrite this equation as yt = cB t B-1 . Every entry in the z-row is positive at the optimum, so yt N - cN t 0, i.e. cB t B-1 N - cN t 0. Then zmax = yt b = cB t B-1 b.
2.4.1
Example
Consider the LP problem: Maximize z = 2x1 + 4x2 - 5x3 , subject to x1 + 2x2 + x3 5, 2x1 + x2 - 4x3 6, The initial tableau is Basic x4 x5 x6 z The optimal tableau is Basic x1 x5 x2 z z 0 0 0 1 x1 x2 x3 x4 x5 x6 1 0 1/4 1/4 0 -1/4 0 0 -39/8 -7/8 1 3/8 0 1 3/8 3/8 0 1/8 0 0 7 2 0 0 25 Solution 1/2 11/4 9/4 10 z 0 0 0 1 x1 x2 x3 x4 x5 x6 1 2 1 1 0 0 2 1 -4 0 1 0 -3 2 0 0 0 1 -2 -4 5 0 0 0 Solution 5 6 3 0 - 3x1 + 2x2 3.
The basic variables reading down the `Basic' column are x1 , x5x2 , so B is formed from , 1 0 2 columns 1, 5, 2 respectively of (A | I3 ). Thus B = 2 1 1 . -3 0 2 2 0 -2 x1 1/2 1 3 . At the optimal point x5 = B-1 b = 11/4 . B-1 = -7 8 8 x2 3 0 1 9/4 2 1/2 cB = 0 , so zmax = cB t B-1 b = 2 0 4 11/4 = 10. 4 9/4 1 1 0 -4 0 0 , from columns 3, 4, 6 of (A | I3 ), and cN = (-5 0 0). We can take N = 0 0 1 t B-1 N - c t = (7 2 0), the z-row entries in the non-basic columns. Then cB N 1 9 11 The maximum value of z is 10, when x1 = , x2 = , x3 = 0, x4 = 0, x5 = . 2 4 4 We have been assuming that only extreme points of the feasible region need to be considered as possible solutions. The proof of this is now given; you are not expected to learn it. Proposition 2.1 v is a basic feasible solution of (LP2) if and only if v is an extreme point ~x ~ of the set of feasible solutions S = {~ : A~ = b, x 0} in Rn+m . x Proof () Suppose v is a bfs of (LP2) and is distinct feasible solutions u, w S such that, for ~ We can permute the columns of A, as described vB entries of v, u, w correspondingly so that 0 not an extreme point of S, so there are some r (0, 1), v = (1 - r)u + rw. earlier, to get (B | N) and permute the uB wB = (1 - r) +r uN wN
As 0 < r < 1 and u, w are non-negative, it follows that uN = wN = 0. ~ ~ ~ As v, u, w are feasible, Av = Au = Aw = b, so (B | N) vB 0 = (B | N) uB uN = (B | N) wB wN = b.
Thus BvB = BuB = BwB = b.
As B is non-singular, vB = uB = wB = B-1 b.
Hence v = u = w, contradicting the assumption that these points are distinct, so v is an extreme point. () Suppose v is in S, so is feasible, but is not a bfs of (LP2). ~ Av = b, so we can write (B | N ) v = b, where v contains all the non-zero entries of 0 v. If v = v then B is not unique, but the following reasoning applies to any choice of B . If B were non-singular then v = B-1 b, in which case v would be a bfs. Hence B is singular, so there is a vector p such that B p = 0. As the entries of v are strictly positive, we can find > 0 so that v - p 0 and v p v + p 0. Then B (v p) = B v A p = B v 0 = b, so (B | N ) = b. 0 26
v v p are permuted feasible solution vectors. But is their 0 0 mean, so v is a convex linear combination of two points in S, hence v is not an extreme point of S. It follows that any extreme point of S is a bfs of (LP2). Thus both of
2.5
Complexity of algorithms
Although we are doing calculations manually in order to understand the method, in practice the simplex algorithm is designed to be implmented on a computer. The development of more efficient algorithms is a key feature of research in OR. Suppose an algorithm is used on a problem in which there are n of some feature (e.g. variables, constraints). We say the algorithm is O(f(n)), and call f(n) the complexity or order of the algorithm, if the number of arithmetic operations required in finding an optimal solution is bounded above by some multiple of f(n). For example, if an algorithm requires up to 3n3 + 2n2 + 5 operations then we say it is O(n3 ), as for large enough n we have 3n3 + 2n2 + 5 4n3 . Such an algorithm has cubic complexity. If an algorithm is O(na ) for some a, we say it has polynomial complexity, or the problem can be solved in polynomial time. If it is O(an ) for some a then it has exponential complexity. The complexity can be thought of as a measure of the cost involved in implementing an algorithm (e.g. the cost of computer time). Clearly polynomial is preferable to exponential complexity, because the latter increases far more steeply as n increases. In practice, the simplex algorithm typically requires about 2m iterations to solve a problem with m constraints. Taking the number of variables, n, into account, the number of operations per iteration is polynomial in m and n; in fact, it can be shown that it is O(m3 + mn). The algorithm is more sensitive to the number of constraints than the number of variables, so it is best to keep the number of constraints as small as possible by eliminating any redundant ones. However, in the worst case a problem with n variables and n constraints can require 2n - 1 iterations. This is proved by constructing a problem with 2n possible basic feasible solutions and showing that the simplex algorithm, implemented according to the standard rules, works through every bfs before reaching the optimum. Thus the algorithm actually has exponential order. This result is due to Klee and Minty (1972). A version of their problem is given in the exercises. Problems that require this maximum number of operations are rare, but the fact that they exist has prompted research into other ways of solving LP problems. One such is Karmarkar's interior point algorithm. Instead of starting at an extreme point, this starts at a point inside the feasible region and works out towards the optimal vertex. This algorithm has polynomial complexity and can be more efficient for problems with a very large number of variables.
27
Exercises 2
1. Use the Simplex method to solve Maximize subject to and z = 4x1 + 8x2 5x1 + x2 8 3x1 + 2x2 4 x1 0, x2 0.
Express objective the function in terms of the non-basic variables in the final tableau, and hence explain how you know that the solution is optimal. 2. Use the Simplex method to solve Maximize z = 5x1 + 4x2 + 3x3
2x1 + 3x2 + x3 5 4x1 + x2 + 2x3 11 subject to 3x1 + 4x2 + 2x3 8 and xj 0 for j = 1, 2, 3.
Write down a matrix P that pre-multiplies the whole initial tableau to give the final tableau. After you have studied Section 2.4 in the notes: write down, from the optimal tableau of this problem, the matrices B, B-1 and N and the vectors y, cB , cN as defined on pages 24 - 25. Verify that the optimal solution is B-1 b and that zmax = cB t B-1 b. 3. Express the following LP problem in standard form. (Do not solve it.) Minimize z = 2x1 + 3x2 x1 + x2 -1 2x1 + 3x2 5 3x1 - 2x2 3
subject to
and x1 unrestricted in sign, x2 0. 4. The following tableau arose in the solution of a LP problem: Basic z x1 x2 x3 x4 x5 x6 x7 0 0 4/3 2/3 0 1 0 -1/3 0 0 1/3 2/3 1 0 1 -1/3 0 1 -1/3 1/6 1/2 0 0 1/6 z 1 0 -5/3 -4/3 -1 0 0 5/3 Solution 4 10 4 12
(a) Which variables are basic? What basic feasible solution does the tableau represent? Is it optimal? Explain your answer by writing the z-row as an equation. (b) Starting from the given tableau, proceed to find an optimal solution. (c) From the optimal tableau, express the objective function and each of the basic variables in terms of the non-basic variables. 28
5. A furniture manufacturer makes chairs and settees, producing up to 80 chairs and 48 settees per week. The items are sold in suites: Mini - two chairs, Family - three chairs and one settee, Grand - three chairs and two settees. The profits are 20, 30 and 70 per suite, respectively. The total profit is to be maximized. Use the Simplex algorithm to find the maximum profit that can be made in one week. State the profit and the number of each type of suite that should be made. 6. Suppose one of the constraints in a LP problem is an equation rather than an inequality, as in Minimize 3x1 + 2x2 + 4x3 3x1 + 4x2 + 2x3 6 3x1 + 5x2 + 7x3 10 subject to x1 + x2 + x3 = 1 and x1 0, x2 0. Use the third constraint to express x3 in terms of x1 and x2 . Hence eliminate x3 from the objective function and the other two constraints. Introduce two slack variables x4 and x5 , and solve the problem by the Simplex algorithm. Check that your solution satisfies all the constraints. How must this approach be modified if also x3 0? 7. Solve the following problem using the simplex tableau method, making your decision variable for I1 basic at the first iteration. Identify any degenerate basic feasible solutions your calculations produce. Sketch the solution space and explain why degeneracy occurs. A foundry produces two kinds of iron, I1 and I2 , by using three raw materials R1 , R2 and R3 . Maximise the daily profit. Raw material R1 R2 R3 Profit per tonne Amount required per tonne of I1 of I2 2 1 1 1 0 1 150 300 Daily raw material availability (tonnes) 16 8 3.5
8. Prove that v is an extreme point of the feasible region R for (LP1) if and only if v is an extreme point of the feasible region S for (LP2). b - Av 9. (Klee-Minty problem) Solve the following by the simplex algorithm, showing that every possible basic feasible solution occurs in the iterations. Maximize subject to z = 100x1 + 10x2 + x3 x1 1 20x1 + x2 100 200x1 + 20x2 + x3 10000 x1 0, x2 0, x3 0.
and
29
Chapter 3
Further Simplex Methodology
3.1 Sensitivity analysis
Suppose some feature of a LP problem changes after we have found the optimal solution. Do we have to solve the problem again from scratch or can the optimum of the original problem be used as an aid to solving the new problem? These questions are addressed by sensitivity analysis, also called post-optimal analysis. If a resource is used up completely then the slack variable in the constraint representing this resource is zero, i.e. the constraint is active at the optimal solution. This type of resource is called scarce. In contrast, if the slack variable is non-zero (i.e. the constraint is not active) then this resource is not used up totally in the optimal solution. Resources of this kind are called abundant. Increasing the availability of an abundant resource will not in itself yield an improvement in the optimal solution. However, increasing a scarce resource will improve the optimal solution. With the notation of Chapter 2, zmax = yt b. Suppose bi is increased by a small amount bi . We say that the ith constraint has been relaxed by bi . Then as long as the same variables remain basic at the optimal solution, zmax = y1 b1 + + yi (bi + bi ) + + ym bm , i.e. zmax has increased by yi bi . yi is thus the approximate increase in the optimum value of z that results from allowing an extra 1 unit of the ith resource. yi is called the shadow price of the ith resource. It does not tell us by how much the resource can be increased while maintaining the same rate of improvement. If the set of constraints which are active at the optimal solution changes, then the shadow price is no longer applicable. The shadow prices yi can be read directly from the optimal tableau: they are the numbers in the z-row at the bottom of the slack variable columns.
3.1.1
Example: the rose-growing problem modified
To illustrate these concepts we again consider the rose-growing problem, with the initial and final tableaux as obtained in Chapter 2. The optimal solution is (500, 900, 0, 2200, 0). The slack variables x3 , x4 and x5 were introduced in the land, finance and labour resource constraints respectively. Thus land and labour are scarce resources, and finance is an abundant resource. We now consider various modifications to the problem and its solution.
30
1. Shadow prices x3 x4 and x5 have coefficients 1/3, 0 and 1/3 in the z-row of the final tableau, so these are the shadow prices of land, finance and labour respectively. The shadow prices give the rate of improvement of z with each resource, within certain bounds.
1 The maximum profit z increases at the rate of 3 per extra unit of land or labour. The shadow price of finance is zero it is an abundant resource at the optimum.
Labour is a scarce resource so making extra labour available will increase profit. The shadow price of labour is 1 , which means that 1 extra person-hour of labour would 3 result in the profit increasing by 0.33. Hence if more than 0.33 per hour is paid in wages, the grower will be worse off. They would certainly have to pay more than this so it is not economical to hire extra labour. 2. Changing the resources The rose grower has the option to buy some more land. What is the maximum area that should be purchased if the other constraints remain the same? Suppose extra land of area k dm2 was purchased. Then the initial tableau would be the same as before except that b1 = 6100 + k in the `solution' column. Thus the `solution' column in the 5/21 0 -4/21 -38/21 1 22/21 -1/21 0 5/21 1/3 0 1/3 optimal tableau becomes 5 0 6100 + k 500 + 21 k 38 0 8000 2200 - 21 k = 1 0 5000 900 - 21 k 1 1 0 3700 + 3 k .
Keeping keeping the `solution' column non-negative requires x1 0, x2 0, x4 0, so k 2200 21/38 1215.8. Thus the maximum area the grower should consider buying is 1215.8 dm2 . At this point all the finance is used up as well as all the land and labour, and any extra increase in land will not improve the optimal profit. We have seen that the shadow price of land is 1 . Thus the maximum profit when this 3 extra land is added will be 3700 + 1 1215.8 4105.27. 3 3. Changing a coefficient in the objective function The profit margin alters on one of the roses. Is the same solution still optimal? Changing the objective function does not alter the solution space, so cannot affect feasibility. However, it may affect whether the solution is still optimal. Suppose the profit on a red rose changes by t. The new objective function is z = (2 + t)x1 + 3x2 = z + tx1 . Thus the bottom row of the final tableau has -t in the x1 column. To get zero there we must add t times the top row to the z row, which becomes 1 | 0 0 5t 1 + 3 21 0 1 4t - 3 21 || 3700 + 500t .
The solution remains optimal at x3 = x5 = 0 if none of these z-row entries is negative. Therefore the original solution is still optimal, with zmax = 3700 + 500t, provided 1 5t 1 4t 7 7 + 0 and - 0, i.e. - t . 3 21 3 21 5 4 3 15 Thus the profit 2 + t can vary between and . 5 4 31
4. Adding an extra variable. Suppose the grower has the option of growing an extra variety, pink roses, with the following requirements per bush: 7 dm2 area, 6 finance, and 3.5 hours labour. Let the profit per pink bush be t, and suppose that x6 pink rose bushes are grown.
Original problem Maximize z = 2x1 + 3x2 5x1 + 4x2 + x3 8x1 + 2x2 + x4 x1 + 5x2 + x5 = = = 6100 8000 5000 Maximize New problem z = 2x1 + 3x2 + tx6 = 6100 = 8000 = 5000
subject to
5x1 + 4x2 + 7x6 + x3 8x1 + 2x2 + 6x6 + x4 subject to 7 x1 + 5x2 + 2 x6 + x5 and
and
xj 0, j = 1, . . . , 5.
xj , xk 0, j = 1, 2, 6; k = 3, 4, 5.
The initial tableau for the new problem is: Basic x3 x4 x5 z z 0 0 0 1 x1 5 8 1 -2 x2 4 2 5 -3 x3 1 0 0 0 x4 0 1 0 0 x5 0 0 1 0 x6 7 6 7/2 -t Solution 6100 8000 5000 0
The x6 column of the final tableau becomes: 5/21 0 -4/21 0 -38/21 1 22/21 0 -1/21 0 5/21 0 1/3 0 1/3 1
7 1 6 -3 = 7/2 1/2 -t 7/2 - t
.
Hence the current solution, which involves growing no pink roses at all, is optimal provided 7 - t 0, i.e. t 7 . 2 2 However, if t > 7 then this solution is no longer optimal. For example if t = 2 the original final tableau, with the x6 column added, is Basic x1 x4 x2 z z 0 0 0 1 x1 1 0 0 0 x2 0 0 1 0 x3 5/21 -38/21 -1/21 1/3 x4 0 1 0 0 x5 -4/21 22/21 5/21 1/3 x6 1 -3 1/2 -1 Solution 500 2200 900 3700
9 2
then
This is not optimal, but the optimum is obtained after one more Simplex iteration. 5. Adding an extra constraint. Suppose the maximum number of roses that can be sold is 1340, so the constraint x1 + x2 1340 is added to the system. The current optimum is not feasible as x1 + x2 = 500 + 900 > 1340. Adding a slack variable x6 gives x1 + x2 + x6 = 1340. Re-write the new constraint in terms of the current non-basic variables x3 and x5 , 500 - 5 4 x3 + x5 21 21 + 900 + 32 1 5 x3 - x5 21 21 + x6 = 1340
4 1 x3 - x5 + x6 = -60. In fact, this calculation can be done within the tableau: 21 21 if we add a row for x1 + x2 + x6 = 1340 into the previously optimal tableau we get: so - Basic x1 x4 x2 x6 z z 0 0 0 0 1 x1 1 0 0 1 0 x2 0 0 1 1 0 x3 5/21 -38/21 -1/21 0 1/3 x4 0 1 0 0 0 x5 -4/21 22/21 5/21 0 1/3 x6 0 0 0 1 0 Solution 500 2200 900 1340 3700
This is not a good simplex tableau as it does not have four basic variable columns. However, subtracting rows 1 and 3 from row 4 gives: Basic x1 x4 x2 x6 z z 0 0 0 0 1 x1 1 0 0 0 0 x2 0 0 1 0 0 x3 5/21 -38/21 -1/21 -4/21 1/3 x4 0 1 0 0 0 x5 -4/21 22/21 5/21 -1/21 1/3 x6 0 0 0 1 0 Solution 500 2200 900 -60 3700
Notice that the x6 row now contains the equation that we derived previously. This tableau would be optimal if the negative entry in the solution column were not there. We perform row operations keeping the z-row entries non-negative until all the numbers in the `Solution' column are non-negative. In the above, the basic variable x6 = -60, so we need x6 to leave the basis. How do we choose the entering variable? Our choice is restricted to the nonbasic variables that have negative coefficients in the pivot row, since we want to add a positive multiple of the pivot row to the z-row without creating any negative entries. To ensure this, choose the variable that yields the minimum absolute value (modulus) of the z-row coefficient divided by the pivot row entry aij .
4 1 In this case 3 - 21 < give the tableau 1 3 1 - 21 , so x3 is the entering variable. Row operations
Basic x1 x4 x2 x3 z
z 0 0 0 0 1
x1 1 0 0 0 0
x2 0 0 1 0 0
x3 0 0 0 1 0
x4 0 1 0 0 0
x5 -1/4 3/2 1/4 1/4 1/4
x6 5/4 -19/2 -1/4 -21/4 7/4
Solution 425 2770 915 315 3595
This solution is now optimal, as the z-row entries are non-negative and each bj 0. Introducing the new constraint reduces the optimum value of the objective function to 3595. This occurs when x1 = 425 and x2 = 915. The above procedure, keeping the z-row coefficients positive and carrying out row operations until the basic variables are non-negative, is called the dual simplex method . It can be used, on its own or in combination with the normal simplex method, on problems which are not quite in standard form because some of the right-hand sides are negative. The dual simplex method provides one way of solving problems for which no initial basic feasible solution is apparent. There are other variations on the simplex method which can be used for such purposes, such as the Two-Phase method (see a textbook). 33
3.1.2
Example: the garments problem
A company makes three types of garment. The constraints are given by: Type A B C No. of units x1 x2 x3 Amount available Labour (hours) per unit 1 2 3 55 hours 2 ) per unit Material (m 3 1 4 80 m2 Profit () per unit 7 6 9 The company wants to make the largest possible profit subject to the constraints on labour and materials, so they must ................................. z = subject to
and x1 0, x2 0, x3 0. Adding slack variables, the constraints become:
Solve by the Simplex algorithm: Basic z x1 x2 x3 x4 x5 Solution
z Basic z x1 x2 x3 x4 x5 Solution
z Basic z x1 x2 x3 x4 x5 Solution
z Basic z x1 x2 x3 x4 x5 Solution
z so the maximum profit is when of type A,
of type B and
of type C are made.
From the initial to the final tableau, the middle two rows are multiplied by B-1 = (using the columns for . This is the inverse of B = , respectively in the initial tableau.) 34
Taking cB = cB t B-1 b =
, b= =
, = zmax .
We now consider the effect of changing some features of the problem. 1. Shadow prices The shadow prices of labour and material are Both resources are .................... The maximum profit increases at the rate of per extra hour of labour and per extra m2 of material, within certain limits. 2. Changing the resources Suppose p hours of labour and q m2 of material are available. The `solution' column in the initial tableau is . so in the final tableau it is and respectively.
=
For the solution to remain optimal when x1 > 0, x2 > 0, x3 = 0 we need 0 and q and p . Thus q , x2 = then zmax = , x3 = If p is kept at 55, this gives when x1 = When q = 0, so q
Provided the amount of material is within this range, zmax =
3. Changing a coefficient in the objective function Suppose the profit on type A changes by t per unit. This does not alter the feasible region, but it may affect the optimal solution. The new objective function is z = ( )x1 + 6x2 + 9x3 . Thus the bottom row of the initial tableau is (1 | ................ - 6 - 9 0 0 || 0), so in the final tableau it is (1 | .............. 0 4 11/5 8/5 || 249). For x1 to remain basic we must have 0 at the bottom of the x1 column, so add ........ times Row ....... to Row ....... to get (1 | .......... .......... .......... .............. .............. || ......................). , provided t without affecting the optimal The original solution (21, 17, 0, 0, 0) is still optimal if no z-row entry is negative. Therefore the original solution is optimal, with zmax = 0, 0, 0, i.e. to The profit on type A can vary from quantities to produce.
35
4. Adding an extra variable. Suppose the company can produce a fourth garment, type D, requiring 4 hours of labour and 2 m2 of material and yielding k profit per unit. Let x0 units of type D be produced. The new problem is to maximize z = subject to = 55, where xj 0 for j = 0, . . . , 5. x0 The initial tableau is as before with the addition of a column 3/5 -1/5 0 -1/5 2/5 0 11/5 8/5 1 , so we have = 80,
x0 in the final tableau.
=
Thus if k , the z-row remains non-negative and the current solution is optimal; D should not be made. Suppose we take k = 13. Then the previously optimal tableau becomes Basic x2 x1 z z 0 0 1 x0 x1 0 1 0 x2 1 0 0 x3 1 1 4 x4 3/5 -1/5 11/5 x5 -1/5 2/5 8/5 Solution 17 21 249
After one more iteration this becomes optimal: Basic z 0 0 1 units of D should be made. x0 x1 x2 x3 x4 x5 Solution
z so
units of A and
(If half-units are not possible, Integer Programming is needed.) 5. Adding an extra constraint. Suppose that in the original 3-product problem there is a further restriction: 3x1 + x2 + 2x3 50, i.e. 3x1 + x2 + 2x3 + x6 = 50 where x6 0 is a slack variable. 3(21) + 17 + 2(0) > 50, so the previous optimal point (21, 17, 0) is not feasible. Adding the new constraint as a row in the original optimal tableau gives: Basic z 0 0 0 1 x1 0 1 0 x2 1 0 0 x3 1 1 4 36 x4 3/5 -1/5 11/5 x5 -1/5 2/5 8/5 x6 0 0 0 Solution 17 21 249
x6 z
This does not represent a valid Simplex iteration because there is only one basic column. Subtracting Row 1 and 3 times Row 2 from Row 3 gives: Basic x2 x1 x6 z z 0 0 0 1 x1 0 1 0 x2 1 0 0 x3 1 1 4 x4 3/5 -1/5 11/5 x5 -1/5 2/5 8/5 x6 0 0 0 Solution 17 21 249
This represents a basic but infeasible solution. It would be optimal if the negative entry in the solution column were not there. In this situation we use the dual simplex method, as described on page 33. x6 = , so x6 must leave leave the basis. To keep the z-row entries non-negative, choose the entering variable as follows: Where there is a negative number in the pivot row, divide the z-row entry by this and choose the variable for which the modulus of this quotient is smallest. Here | | < | | so the entering variable is Basic x2 x1 z Making z 0 0 0 1 x1 x2 x3 x4 x5 x6 Solution
of type A and
of type B is now optimal, giving profit
3.1.3
The dual simplex method
The differences between the original simplex method and the dual simplex method can be summarised as follows: Original (primal) simplex Starts from a basic feasible solution. All bj 0. At least one z-row entry is negative. Seek to make all z-row entries 0 Consider the problem: Minimize 5x1 + 4x2 subject to 3x1 + 2x2 6, x1 + 2x2 4, x1 0, x2 0. In standard form the problem would contain surplus variables, whose columns in the simplex tableau would contain -1. To use the dual simpled method we write the problem so that there are correct basic columns, even though the right-hand sides are negative: Maximize subject to and z = -5x1 - 4x2 -3x1 - 2x2 + x3 = -6 -x1 - 2x2 + x4 = -4 xj 0, j = 1, . . . , 4. 37 Dual simplex Starts from a basic infeasible solution. At least one bj < 0. All z-row entries 0. Seeks to make all bj 0 keeping the z-row 0.
We start with a basic infeasible solution: Basic x3 x4 z z 0 0 1 x1 -3 -1 5 x2 -2 -2 4 x3 1 0 0 x4 0 1 0 Dual simplex algorithm: Solution Find the most negative number in the `solution' column. -6 cj For this row i find the smallest absolute value . -4 aij 0 Use aij as the pivot in the usual way. x4 0 1 0 Solution 2 -2 -10 Second Iteration Basic z x1 x2 x3 x4 Solution x1 0 1 0 -1/2 1/2 1 x2 0 0 1 1/4 -3/4 3/2 z 1 0 0 3/2 1/2 -11 This is an optimal, feasible tableau.
First Iteration Basic z x1 x2 x1 0 1 2/3 x4 0 0 -4/3 z 1 0 2/3 This is still infeasible.
x3 -1/3 -1/3 5/3
z = -5x1 - 4x2 has maximum value -11, so 5x1 + 4x2 has minimum value 11, when x1 = 1, x2 = 3/2.
3.2
The dual of a Linear Programming problem
Recall the Containers problem from Chapter 1. Suppose now that the company delegates its production to a contractor who pays them y1 and y2 per minute for the use of machines M1 and M2 respectively. Let w be the total hourly charge for using the two machines. The contractor wants to make this hourly charge as small as possible, but must ensure that the company is paid at least as much as it originally made in profit for each container produced: 30 per Type A and 45 per Type B. Thus the contractor's problem is to minimize w = 60y1 + 60y2 subject to the constraints 2y1 + 4y2 30, 8y1 + 4y2 45, where y1 0, y2 0. The feasible region lies in the first quadrant above the boundary lines, as illustrated:
14 12 10 y2 8 6 4 2 0 2 4 6 8 10 y1 12 14 16 18
w is minimum where the lines cross, at (2.5, 6.25). Here w = 60 2.5 + 60 6.25 = 525. Thus the contractor should pay 2.50 per minute for M1 and 6.25 per minute for M2 , so that the company gets 525 per hour the same as the profit when it made the containers itself! We have solved the dual of the original problem. Every linear programming problem has an associated problem called its dual. For now we will restrict attention to pairs of problems of the following form: Primal: maximize z = ct x subject to Ax b and x 0 Dual: minimize w = bt y subject to At y c and y 0 (P) (D)
To obtain the dual problem from the primal problem we swap c and b, replace A by its transpose At , replace `' with `' in the constraints, and replace `maximize' with `minimize'. The non-negativity restrictions remain. 38
3.2.1
Example
The following is a primal-dual pair of LP problems:
Primal Maximize subject to and z = 6x1 + 4x2 3x1 + x2 2x1 + 2x2 5 4 Minimize subject to and Dual w = 5y1 + 4y2 3y1 + 2y2 y1 + 2y2 6 4
x1 , x2 0.
y1 , y2 0.
The primal problem can be solved easily using the standard simplex algorithm. The optimal solution is zmax = 11 when (x1 , x2 , x3 , x4 ) = (3/2, 1/2, 0, 0). We solved the dual problem by the dual simplex algorithm in Section 3.1.3. The optimal solution is wmin = 11 when (y1 , y2 , y3 , y4 ) = (1, 3/2, 0, 0). Notice that the objective functions of the primal and dual problems have the same optimum value. Furthermore, in the optimal dual tableau, the objective row coefficients of the slack variables are equal to the optimal primal decision variables. Consider the cattle-feed problem in Chapter 1. Suppose a chemical company offers the farmer synthetic nutrients at a cost of y1 per unit of protein, y2 per unit of fat, y3 per unit of calcium and y4 per unit of phosphorus. The cost per unit of hay substitute is thus (13.2y1 +4.3y2 +0.02y3 +0.04y4 ). To be economic to the farmer, this must not be more than 0.66. Similarly, considering the oats substitute, 34.0y1 + 5.9y2 + 0.09y3 + 0.09y4 2.08. For feeding one cow, the company will receive (65.0y1 + 14.0y2 + 0.12y3 + 0.15y4 ), which it will wish to maximize. Thus the company's linear programming problem is : Maximize subject to and w = 65.0y1 + 14.0y2 + 0.12y3 + 0.15y4 13.2y1 + 4.3y2 + 0.02y3 + 0.04y4 0.66 34.0y1 + 5.9y2 + 0.09y3 + 0.09y4 2.08 yj 0, j = 1, ..., 4.
We see that the dual of this is the farmer's original problem. As we shall show next, in fact the two problems are the duals of each other. Proposition 3.1 The dual of the dual problem (D) is the primal problem (P). Proof The dual problem (D) can be written as follows: maximize (-b)t y subject to (-A)t y -c and y 0. The dual of this is: minimize (-c)t x subject to (-At )t x -b and x 0.
39
This is equivalent to: maximize ct x subject to Ax b and x 0, which is the same as the primal problem (P). Thus the dual of either problem may be constructed according to the following rules: Primal Maximize ct x Minimize ct x Constraints Ax b Constraints Ax b x0 Dual Minimize bt y Maximize bt y Constraints At y c Constraints At y c y 0.
For every primal constraint there is a dual variable. For every primal variable there is a dual constraint. the constraint coefficients of a primal variable form the left-side coefficients of the corresponding dual constraint; the objective coefficient of the same variable becomes the right-hand side of the dual constraint. We now investigate how the solutions of the primal and dual problems are related, so that by solving one we automatically solve the other. Proposition 3.2 (The weak duality theorem) Let x be any feasible solution to the primal problem (P) and let y be any feasible solution to the dual problem (D). (i) ct x bt y. (ii) If ct x = bt y then x and y are optimal solutions to the primal and dual problems. Proof (i) We have x 0, y 0, Ax b, At y c. Thus ct x (At y)t x = yt Ax yt b = bt y. (ii) From (i) no primal feasible x can give ct x > bt y, so if ct x = bt y then x maximizes z. A similar argument shows that y minimizes w. Proposition 3.3 (The strong duality theorem) If either the primal or dual problem has a finite optimal solution, then so does the other, and the optimum values of the primal and dual objective functions are equal, i.e. zmax = wmin . Proof Let x be a finite optimal solution to the primal, so that zmax = ct x = z say. We have seen that the initial tableau is pre-multiplied as follows to give the final tableau: B-1 yt 0 1 A -ct I 0t B-1 A yt A - ct B-1 yt B-1 b . tb y
b = 0 40
As this is optimal, yt A - ct 0, so At y c, and y 0. Hence y is feasible for the dual problem. Now z = yt b = bt y. But also z = ct x so x, y are feasible solutions which give equal values of the primal and dual objective functions respectively. Thus by Proposition 3.2 (ii), x, y are optimal solutions and z is the optimal value of both z and w. As each problem is the dual of the other, the same reasoning applies if we start with a finite optimal solution y to the dual. The above shows that the entries of y are in fact the optimal values of the main variables in the dual problem. (They are also the shadow prices for the primal constraints). Furthermore the entries of yt A - ct are the values of the dual surplus variables at the optimum, so we shall denote them by ym+1 , . . . , ym+n . Thus the optimal primal tableau contains the following information: Primal main x1 xn Primal slack xn+1 xn+m
Basic Primal basic variables z
z 0 0 1
ym+1 ym+n Values of dual surplus variables
y1 ym Values of dual main variables
Solution Values of primal basic variables Optimum of objective functions (primal and dual)
The optimal dual solutions may therefore be read off the optimal primal tableau without further calculations. Furthermore, since the dual of the dual is the primal, it does not matter which problem we solve the optimal solution of one will give us the optimal solution of the other. This is important, as if we are presented with a `difficult' primal problem, it may be easier to solve it by tackling its dual: if the primal constraints are all of the `' form then (P) cannot be solved by the normal simplex algorithm, but (D) can; if the primal problem has many more constraints than variables then the dual has many fewer constraints than variables, and will in general be quicker to solve. Proposition 3.4 If either the primal (P) or the dual (D) has an unbounded optimal solution then the other has no feasible solution. Proof: Suppose the dual has a feasible solution y. Then for any primal feasible solution x, ct x bt y, so bt y is an upper bound on solutions of the primal. Similarly, if the primal has a feasible solution this places a lower bound on solutions of the dual. It follows that if either problem is unbounded then the other does not have a feasible solution. Proposition 3.4 identifies some cases where the duality results do not hold, i.e. we cannot say that the primal and dual LP problems have the same optimal values of their objective functions: 41
1. Primal problem unbounded and dual problem infeasible. 2. Primal problem infeasible and dual problem unbounded. 3. Primal and dual problems both infeasible.
3.3
Complementary slackness
Complementary slackness is a very important and useful consequence of the relationship between the primal and dual optima. We continue to work with the primal-dual pair (P) and (D). In the final tableau for the primal problem, if xi is non-basic then xi = 0 at the optimum. Now suppose xi is basic in the optimal tableau. Then there is a zero in the z row at the bottom of the xi column, so a certain dual variable is zero at the optimum. If xi is a main variable in the primal, this dual variable is the surplus variable ym+i . For i = 1, . . . , n, either xi = 0 or ym+1 = 0. If xi is a slack variable in the primal then i = n + j for some j and the corresponding dual variable is the main variable yj . For j = 1, . . . , m, either yj = 0 or xn+j = 0. Thus in every case xi ym+i = 0 and xn+j yj = 0. So at the optimal solution, ith primal main variable ith dual surplus variable = 0, jth primal slack variable jth dual main variable = 0. These relationships are called the complementary slackness equations. Thus (x1 xn | xn+1 xn+m )(ym+1 ym+n | y1 ym )t = 0, since the scalar product of two non-negative vectors is 0 iff the product of each corresponding pair of entries is 0. Now the entries of b - Ax are the primal slack variables xn+1 , . . . , xn+m and the entries of At y - c are the dual surplus variables ym+1 , . . . , ym+n , so complementary slackness asserts that at the optimal solution, yt (b - Ax) = 0 and xt (At y - c) = 0. An interpretation of complementary slackness is that if the shadow price of a resource is non-zero then the associated constraint is active at the optimum, i.e. the resource is scarce, but if the constraint is not active (the resource is abundant) then its shadow price is zero. Proposition 3.5 (The complementary slackness theorem) A necessary and sufficient condition for x and y to be optimal for the primal and dual problems (P) and (D) is that x is primal feasible, y is dual feasible, and x and y satisfy the complementary slackness conditions yt (b - Ax) = 0 and xt (At y - c) = 0. Proof: By the duality theorems, x and y are optimal iff they are feasible and ct x = bt y. Now ct x = bt y yt b - xt c = 0 yt b - yt Ax + xt At y - xt c = 0
0 0 0 0
(since yt Ax = xt At y)
yt (b - Ax) + xt (At y - c) = 0 yt (b - Ax) = 0 and xt (At y 42 - c) = 0.
3.3.1
Examples
1. Consider the rose-growing problem in Chapter 1. The solution of this was (x1 , x2 , x3 , x4 , x5 ) = (500, 900, 0, 2200, 0). The dual problem is : Minimize w = 6100y1 + 8000y2 + 5000y3 subject to 5y1 + 8y2 + y3 2, 4y1 + 2y2 + 5y3 3, yi 0 for i = 1, 2, 3. By the strong duality theorem we know that the minimum value of w is the same as the maximum of z in the primal problem, namely 3700. We can read off from the final tableau that y1 = y3 = 1/3, y2 = y4 = y5 = 0, where y4 , y5 are the surplus variables in the two constraints of the dual. If we solved the primal problem graphically, we would only know x1 = 500, x2 = 900. Complementary slackness then tells us that x1 y4 = x2 y5 = x3 y1 = x4 y2 = x5 y3 = 0 so 500y4 = 900y5 = 0y1 = 2200y2 = 0y3 = 0, and since all the yj are 0 it follows that y2 = y4 = y5 = 0. Thus both dual constraints are active at the optimum, so 5y1 + y3 = 2, 4y1 + 5y3 = 3. Solving these gives y1 = y3 = 1/3. 2. Suppose we wish to verify that (x1 , x2 ) = (10, 5) maximizes z = 30x1 + 45x2 subject to the constraints in the Containers Problem of Chapter 1. (10, 5) is certainly feasible for the primal, i.e. it satisfies the constraints. Then z = 525. The dual is: Minimize w = 60y1 + 60y2 subject to 2y1 + 4y2 30, 8y1 + 4y2 45, y1 0, y2 0. When equality holds in both constraints, y1 = 5/2 and y2 = 25/4. Thus (x1 , x2 , x3 , x4 ) = (10, 5, 0, 0) is primal feasible, (y1 , y2 , y3 , y4 ) = (5/2, 25/4, 0, 0) is dual feasible, and (10, 5, 0, 0).(0, 0, 5/2, 25/4) = 0, i.e. the complementary slackness conditions hold. By Theorem 3.5, these solutions are optimal for the primal and dual problems. We can further check that when y1 = 5/2 and y2 = 25/4, w = 525. 3. Consider again the Cattle Feed problem and its dual from Chapter 1. From the original solution, zmin = 3.46 when x1 = 3.48, x2 = 0.56. If x3 , x4 , x5 , x6 are the surplus variables in the four constraints, then x3 = x5 = 0 at the optimum as the first and third constraint are active, but x4 , x6 are non-zero. Let y5 , y6 be the slack variables in the two dual constraints. By complementary slackness, (x1 , x2 , | x3 , x4 , x5 , x6 ).(y5 , y6 , | y1 , y2 , y3 , y4 ) = 0. Thus y2 = y4 = y5 = y6 = 0 at the dual optimum. Hence 13.2y1 + 0.02y3 = 0.66, 34.0y1 + 0.09y3 = 2.08, and solving these gives y1 = 0.035, y3 = 9.87. We conclude that the company should charge 0.035 per unit of synthetic protein, 9.87 per unit of synthetic calcium, give away synthetic fat and phosphorus free, and thus charge 3.46 for feeding one cow. No price structure can bring them a higher income without costing the farmer more than before. In accordance with the Strong Duality Theorem, if the farmer and the company both behave rationally (i.e. optimally) then the costs of the normal and synthetic feeding plans are the same. Of course, in practice other considerations might influence the farmer's decision. If we solved the dual problem by the simplex algorithm, the solutions for x1 , . . . , x6 in the primal problem could be read off from the bottom row of the optimal tableau. The complementary slackness conditions have the following interpretation here: 43
(a) If (Ax)i < bi then yi = 0. This means the farmer should buy zero of any nutrient that is overpriced compared to its synthetic equivalent. (b) If (At y)j > cj then xj = 0. Thus the company should charge zero for any nutrient that is over-supplied in the normal feeding plan.
3.4
Asymmetric duality
The dual problems in Equations (P) and (D) are said to represent symmetric duality. We now examine the situation where the variables in the primal problem are unrestricted in sign. Thus the primal problem is: Maximize z = ct x subject to Ax b, x unrestricted. (AP)
We can convert this into a LP problem in standard form by letting x = x - x , where x 0 and x 0. The constraints then become A(x - x ) b. This can be written as (A | - A)x b, where x = (x1 xn x1 xn )t . The objective function is z = ct x - ct x = (ct | - ct )x, and clearly x 0. Thus the problem becomes Maximize z = (ct | - ct )x subject to (A | - A)x b, x 0. The dual of this problem can be written as: Minimize w = bt y subject to At -At y c -c , y 0.
Now if -At y -c then At y c. If this is true simultaneously with At y c then we must have At y = c. Thus the dual of the unrestricted problem (3.4.1) is Minimize w = bt y subject to At y = c, y 0. (AD)
Conversely, the dual of (AD), a problem with equality constraints, is (AP), a problem in which the variables are unrestricted. (Of course, every LP problem can be expressed as one with equality constraints by including slack and surplus variables.)
3.4.1
Example
Consider the following asymmetric pair of primal-dual problems :
Primal Maximize subject to and z = x1 - 2x2 x1 + x2 -2x1 - 3x2 4 -5 Minimize subject to and Dual w = 4y1 - 5y2 y1 - 2y2 y1 - 3y2 = = 1 -2
x1 , x2 unrestricted.
y1 , y2 0.
Clearly, in the dual the solution can only occur where the two equations hold, i.e. where y1 = 7, y2 = 3. Thus w has a minimum value of 13, and this must also be the maximum value of z in the primal problem. By complementary slackness we find that x1 = 7, x2 = -3. 44
Exercises 3
1. A company which manufactures three products A, B and C, needs to solve the following LP problem in order to maximize their profit. Maximize subject to and z = 3x1 + x2 + 5x3 6x1 + 3x2 + 5x3 45 3x1 + 4x2 + 5x3 30 xj 0 for j = 1, 2, 3.
x1 , x2 and x3 are the amounts of A, B and C to be produced. The first constraint is a labour constraint, and the second is a material constraint. The company solves the problem and obtains an optimal solution in which x1 and x3 are basic. (a) Find the company's optimal solution. (b) How much can c2 , the unit profit for B, be increased above 1 without affecting the original optimal solution? (c) Find the range of values of c1 , the unit profit for A, for which x1 and x3 are still basic at the optimal solution. When this is the case, express the maximum value of z in terms of c1 . (d) Find an optimal solution when b2 , the amount of material available, is 60 units. (e) The constraint 3x1 + 2x2 + 3x3 25 is added to the original problem. How does this affect the original optimal solution? (f) A new product D has a unit profit of 5, and its labour and material requirements are 3 units and 4 units respectively. Is it profitable to produce D? (g) An additional 15 units of material are available for 10. What should be done? 2. A firm can manufacture four products at its factory. Production is limited by the machine hours available and the number of special components available. The data are given in the table below. Note that production of fractions of a unit is possible. Product 2 3 4 3 8 4 2 1 3 25 40 55 45 80 85 Availability Up to 90 machine hours per day Up to 80 components per day
Machine hours per unit Components per unit Production costs ( per unit) Sales income ( per unit)
1 1 2 20 30
(a) Formulate this as a linear programming problem, where xj is the daily production of product j and the objective is to maximize the daily profit (income minus production costs). Find the optimal solution using the simplex tableau method, and state the optimal profit. (b) Write down the shadow prices of machine hours and components, briefly explaining their significance. (c) The firm can increase the available machine hours by up to 10 hours per day by hiring extra machinery. The cost of this would be 40 per day. Use sensitivity analysis to decide whether they should hire it, and if so, find the new production schedule. 45
(d) The production costs of products 1 and 4 are changed by t per unit. Within what range of values can t lie if the original production schedule is to remain optimal? Find the corresponding range of values of the maximum profit. (e) Due to a problem at the distributors, the total daily amount produced has to be limited to 25 units. Implement the dual simplex algorithm to find a new production schedule which meets this restriction. (f) After production has returned to normal (i.e. the original solution is optimal again) the firm considers manufacturing a new product that would require 3 machine hours and 4 components per unit. The production costs would be 45 and sales income 75 per unit. Use sensitivity analysis to decide whether they should go ahead, and if so what the optimum production schedule would be. 3. In each case formulate the dual problem and verify that the given solution is optimal by showing that primal feasibility, dual feasibility and complementary slackness all hold. (a) Maximize 19x1 + 16x2 subject to the constraints x1 + 4x2 20, 3x1 + 2x2 15, x1 0, x2 0. x1 0, x2 0. Solution (x1 , x2 ) = (2, 9/2) Solution (x1 , x2 ) = (1, 0) (b) Minimize 8x1 + 11x2 subject to the constraints 2x1 - 2x2 2, x1 + 4x2 -5,
4. The optimal solution of the problem Maximize 6x1 + 4x2 + 10x3
x1 + 2x2 + x3 20 3x1 + 2x3 24 subject to 2x1 + 2x2 22 and x1 , x2 , x3 0.
occurs at (x1 , x2 , x3 ) = (0, 4, 12). Deduce the solution of the dual problem. 5. Formulate the dual of each of the two problems in Section 2.2.1 and solve them from the optimal primal tableaux using the theory of duality and complementary slackness. 6. By finding and solving the dual problem (without using the simplex algorithm), find the maximum value of z = 5x1 + 7x2 + 8x3 + 4x4 subject to x1 + x3 6, x1 + 2x4 5, x2 + x3 9, x2 + x4 3, where x1 , x2 , x3 , x4 are unrestricted in sign. 7. Use asymmetric duality to find the solutions (if any) of the following: (a) Maximize subject to and 46 z = x1 + 2x2 2x1 - 3x2 1 x1 + 4x2 5 x1 , x2 unrestricted.
(b) Maximize subject to and 8. When the problem Maximize 12x1 + 6x2 + 4x3 4x1 + 2x2 + x3 60 2x1 + 3x2 + 3x3 50 subject to x1 + 3x2 + x3 45 and x1 , x2 , x3 0. z = 3x1 + 7x2 + 5x3 2x1 + 5x2 + 4x3 9 2x1 + 4x2 + 2x3 7 x1 , x2 , x3 unrestricted.
is solved by the simplex method, using slack variables x4 , x5 , x6 respectively in the three constraints, the final tableau is Basic x1 x3 x6 z z 0 0 0 1 x1 1 0 0 0 x2 3/10 4/5 19/10 4/5 x3 0 1 0 0 x4 3/10 -1/5 -1/10 14/5 x5 -1/10 2/5 -3/10 2/5 x6 0 0 1 0 Solution 13 8 24 188
(a) State the optimal solution and the values of x1 , . . . , x6 at the optimum. (b) Write down the dual problem, usimg y1 , y2 , y3 for the dual main variables and y4 , y5 , y6 for the dual surplus variables. (c) Using the above tableau, write down the optimal solution of the dual problem and give the values of y1 , . . . , y6 at the optimum. (d) Show how complementary slackness occurs in these solutions. (e) Convert the dual problem to a maximization problem and solve it by the Dual Simplex method. (f) Comment on the relationships between the two optimal tableaux. 9. By solving the dual problem graphically, solve the LP problem: Minimize subject to and 4x1 + 3x2 + x3 3x1 + 8x2 + 2x3 3 2x1 + 5x2 + 3x3 5 x1 , x2 , x3 0.
Give the values of all the dual and primal variables (main, slack and surplus) at the optimum. 10. Find the dual of the problem Maximize ct x subject to Ax = b, x 0.
47
Chapter 4
The Transportation Problem
4.1 Formulation of the model
The transportation model is concerned with finding the minimum cost of transporting a single commodity from a given number of sources (e.g. factories) to a given number of destinations (e.g. warehouses). Any destination can receive its demand from more than one source. The objective is to find how much should be shipped from each source to each destination so as to minimize the total transportation cost. Sources Supply a1 a2 . . . am S1 S2 . . . Sm
c11
Destinations D1 D2 . . . Dn Demand b1 b2 . . . bn
cmn
The figure represents a transportation model with m sources and n destinations. Each source or destination is represented by a point. The route between a source and destination is represented by a line joining the two points. The supply available at source i is ai , and the demand required at destination j is bj . The cost of transporting one unit between source i and destination j is cij . Let xij denote the amount transported from source i to destination j. Then the problem is
m n
Minimize
n
z=
i=1 j=1
cij xij ,
subject to
j=1 m
xij ai for i = 1, . . . , m xij bj for j = 1, . . . , n,
i=1
and where
xij 0 for all i and j.
The first constraint says that the sum of all shipments from a source cannot exceed the available supply. The second constraint says that the sum of all shipments to a destination must be at least as large as the demand. 48
When the total supply is equal to the total demand (i.e.
n
m i=1
ai =
m
n j=1
bj ) then the trans-
portation model is said to be balanced. In a balanced transportation model, each of the constraints is an equation, i.e.
j=1
xij = ai for i = 1, . . . , m and
i=1
xij = bj for j = 1, . . . , n.
The following is an example of a balanced transportation problem: Factory 1 Factory 2 Demand Warehouse 1 c11 c21 7 Warehouse 2 c12 c22 10 Warehouse 3 c13 c23 13 Supply 20 10
Total supply = 20 + 10 = 30 = 7 + 10 + 13 = Total demand. A transportation model in which the total supply and total demand are not equal is called unbalanced. It is always possible to balance an unbalanced transportation problem. Suppose the demand at warehouse 1 above is 9 units. Then the total supply and total demand are unequal, and the problem is unbalanced. In this case it is not possible to satisfy all the demand at each destination simultaneously. We reformulate the model as follows: since demand exceeds supply by 2 units, we introduce a dummy source which has a capacity of 2. The amount sent from this dummy source to a destination represents the shortfall at that destination. If supply exceeds demand then a dummy destination is added to absorb the surplus units. Any units shipped from a source to a dummy destination represent a surplus at that source. If a penalty cost is incurred for each unit of unsatisfied demand or unused supply, then the transportation cost is set equal to the penalty cost. If there is no penalty cost, the transportation cost is set equal to zero. If no units may be assigned to a dummy or a particular route, allocate a cost M . This represents a number larger than any other in the problem think of it as a million! From now on, we will discuss balanced transportation problems only, as any unbalanced problem can always be balanced by introducing a dummy.
4.2
Solution of the transportation problem
m i=1
A balanced transportation problem has
ai =
n j=1
bj . Hence one constraint is a linear
combination of the others, so there are n + m - 1 independent constraint equations. It is not practicable to use the standard simplex method to solve the transportation problem. However, there is an efficient tableau-based method which makes use of the dual problem.
Starting the algorithm: finding an initial basic feasible solution
Here we examine ways of constructing initial basic feasible solutions, i.e. allocations with m + n - 1 basic variables. 49
Method 1: The North-West Corner Method Consider the problem represented by the following transportation tableau. The number in the bottom right of cell (i, j) is cij , the cost of transporting 1 unit from source i to destination j. Supply 10 12 0 Demand 5 0 7 14 15 20 9 16 15 11 20 18 10 15 25 5
The north-west corner method proceeds as follows: Assign as much as possible to the cell in the top-left of the tableau. Cross out the row or column whose supply or demand is satisfied. If a row and column are both satisfied then cross out only one of them. Adjust the supply and demand for those rows and columns which are not crossed out. Repeat the above steps on the remaining tableau until only one row or column remains. For the above example: 1. x11 = 5. Cross out column 1. Amount left in row 1 is 10. 2. x12 = 10. Cross out row 1. Have 5 units left in column 2. 3. x22 = 5. Cross out column 2. Leaves 20 units in row 2. 4. x23 = 15. Cross out column 3. Have 5 units in row 2. 5. x24 = 5. Cross out row 2. Leaves 5 units in column 4. 6. x34 = 5. Cross out row 3 or column 4. Only one row or column remains, so stop. This provides the basic feasible solution x11 = 5, x12 = 10, x22 = 5, x23 = 15, x24 = 5, x34 = 5. The remaining variables are non-basic and therefore equal to zero. The solution has m + n - 1 basic variables as required. The values of the basic variables xij are entered in the top left of each cell. There should always be m + n - 1 of these; in certain (degenerate) cases some of them may be zero. They must always add up to the total supply and demand in each row and column. Note that some books position the data differently in the cells of the tableau. Method 2: The Least-Cost Method This method usually provides a better initial basic feasible solution than the North-West Corner method. 50
Assign as much as possible to the cell with the smallest unit cost in the entire tableau. If there is a tie then choose arbitrarily. It may be necessary to assign 0. Cross out the row or column whose supply or demand is satisfied. If a row and column are both satisfied then cross out only one of them. Adjust the supply and demand for those rows and columns which are not crossed out. Repeat the above steps on the remaining tableau until only one row or column remains. For the above example, Supply 10 12 0 Demand 5 0 7 14 15 20 9 16 15 11 20 18 10 15 25 5
1. x12 = 15. Cross out column 2. Amount left in row 1 is 0. 2. x31 = 5. Cross out column 1. Have 0 units left in row 3. 3. x23 = 15. Cross out column 3. Leaves 10 units in row 2. 4. x14 = 0. Cross out row 1. Still 10 units in column 4. 5. x34 = 0. Cross out row 3. Still 10 units in column 4. 6. x24 = 10. Cross out column 4 or row 2. Only one row or column remains, so stop.
Checking for optimality and iterating the algorithm
So far, we have only looked at ways of obtaining an initial basic feasible solution to the balanced transportation problem. We now develop a method for checking whether the current basic feasible solution is optimal, and a way of moving to a better basic feasible solution if the current solution is not optimal. For illustrative purposes, we will start the algorithm using the initial bfs that was provided by the North-West Corner method. Usually, initial basic feasible solutions obtained by the Least-Cost method (or other methods given in many text-books, such as Vogel's method) will give better starting configurations. Using asymmetric duality, the dual of the transportation problem can be written as
m n
Maximize subject to and
w=
i=1
ai i +
j=1
bj j ,
i + j cij for each i and j i , j unresricted in sign.
Introducing slack variables sij , the constraints can be written as i + j + sij = cij , i = 1, . . . , m, j = 1, . . . , n. 51
By the complementary slackness conditions we must have xij sij = 0, i.e. xij (cij - i - j ) = 0 for all i and j. As before, primal feasibility, dual feasibility and complementary slackness are necessary and sufficient for optimality. This is the underlying strategy for solving the problem. We assign 's and 's which satisfy i + j = cij to the rows and columns containing the basic variables. (This comes from the complementary slackness condition xij sij = 0.) The degeneracy in the original problem means that we are free to choose one of the 's or 's arbitrarily. For simplicity, it is usual to set 1 = 0. The values of sij = cij - i - j are entered in the top right of the cells. If all the sij values are non-negative, we have an optimal solution. Carrying out this procedure, the transportation tableau becomes: 10 0 7 5 5 10 5 12 0 7 14 0 10 0 15 9 5 16 18 2 20 5 20 13 11
We test for optimality by checking whether sij = cij - i - j 0 for all i and j, i.e. in all cells. (This is the dual feasibility condition). If this holds for every cell of the tableau then the optimum has been reached. Otherwise, choose the cell with the most negative value of sij . This identifies the variable to enter the basis. In this case the entering variable is x31 .
Determining the leaving variable
We construct a closed loop that starts and ends at the entering variable, and links it to basic variables by a succession of horizontal and vertical segments. It does not matter whether the loop is clockwise or anticlockwise. Initial tableau 10 0 7 5 5 10 5 12 0 7 14 0 10 0 15 9 5 16 18 2 20 5 20 13 11
We now see how large the entering variable can be made without violating the feasibility conditions. Suppose x31 increases from zero to some level > 0. Then x11 must change to 5 - to preserve the demand constraint in column 1. This has a knock on effect for x12 which therefore changes to 10 + . This process continues for all the corners of the loop. 52
The departing variable is chosen from among the corners of the loop which decrease when the entering variable increases above zero level. It is the one with the smallest current value, as this will be the first to reach zero as the entering variable increases. Any further increase in the entering variable past this value leads to infeasibility. We may choose any one of x11 , x22 or x34 as the departing variable here. Arbitrarily, we choose x34 . The entering variable x31 can increase to 5 and feasibility will be preserved. Second tableau 0 7 -10 5 0 14 16 18 0 10 0 12 7 10 0 15 0 15 9 2 20 10 20 13 11
Notice that some of the basic variables are zero valued this solution is degenerate. However, this causes no problem to the general method of solving the problem. As before, we construct 's and 's which satisfy i + j = cij for the basic variables. Then we check for optimality as before. This tableau is not optimal because sij 0 does not hold for all the cells. The most negative value of sij occurs for x21 , so this is the entering variable. Next we construct a loop. Thus can only be as large as zero. (This is bound to happen because of the degeneracy of the current solution). We let x11 be the departing variable. Third tableau 5 0 7 -5 0 12 5 0 14 16 18 10 0 7 0 15 0 15 9 2 20 10 20 13 11
Again, this is a degenerate solution, as some of the basic variables are equal to zero. We construct 's and 's as before, and then check for optimality. The tableau is not optimal, and x14 is the entering variable. The loop construction shows that can be as large as 10, and that x24 is the departing variable. Fourth tableau 5 0 7 -5 0 12 5 0 14 16 18 5 10 10 7 0 15 9 20 20 0 2 11 10 11
This is now optimal because i + j cij , i.e. sij 0, in every cell. The minimum cost is therefore given by 5 0 + 10 11 + 0 12 + 10 7 + 15 9 + 5 0 = 315, which occurs when x12 = 5, x14 = 10, x22 = 10, x23 = 15, x31 = 5, and all the other decision variables are equal to zero. 53
The dual objective function is a1 1 + a2 2 + a3 3 + b1 1 + b2 2 + b3 3 + b4 4 = 0 + 175 - 25 + 25 + 0 + 30 + 110 = 315. The primal and dual functions have the same value at feasible points, which confirms that the value is optimal.
4.2.1
Example
This example emphasizes the connection between the transportation algorithm and the primal-dual linear programming problems which underlie the method. Three factories F1 , F2 , F3 produce 15000, 25000 and 15000 units respectively of a commodity. Three warehouses W1 , W2 , W3 require 20000, 19000 and 16000 units respectively. The cost of transporting from Fi to Wj is cij per unit, where c11 = 12, c12 = 7, c13 = 10, c21 = 10, c22 = 8, c23 = 6, c31 = 9, c32 = 15, c33 = 8. If xij thousand units are transported from Fi to Wj , the total cost 1000z is given by z = 12x11 + 7x12 + 10x13 + 10x21 + 8x22 + 6x23 + 9x31 + 15x32 + 8x33 which must be minimized subject to the constraints x11 + x12 + x13 x21 + x22 + x23 x11 x12 x13 where xij 0 for i, j = 1, 2, 3. By Asymmetric Duality, the dual of this problem is : Maximize w = 151 + 252 + 153 + 201 + 192 + 163 subject to 1 + 1 12 1 + 2 7 1 + 3 10 2 + 1 10 2 + 2 8 2 + 3 6 3 + 1 9 3 + 2 15 3 + 3 8 i.e. i.e. i.e. i.e. i.e. i.e. i.e. i.e. i.e. 1 1 1 2 2 2 3 3 3 + + + + + + + + + 1 + s11 2 + s12 3 + s13 1 + s21 2 + s22 3 + s23 1 + s31 2 + s32 3 + s33 = = = = = = = = = 12 7 10 10 8 6 9 15 8 + x21 + x22 + x23 x31 + x32 + x33 + x31 + x32 + x33 = = = = = = 15 25 15 20 19 16
where sij 0 for i, j = 1, 2, 3 but i , j are unrestricted in sign. Complementary slackness tells us that xij sij = 0 for all i, j.
12 10 9
7 8 15
10 6 8 54
12 10 9
7 8 15
10 6 8
12 10 9
7 8 15
10 6 8
12 10 9
7 8 15
10 6 8
We choose to find an initial bfs by the north-west corner method. After three iterations, all the sij are non-negative so we have primal feasibility, dual feasibility and complementary slackness. Hence the optimal solution has been found. The minimum cost is 418,000. The primal solution is (x11 , . . . , x13 , . . .) = (0, 15, 0, 5, 4, 16, 15, 0, 0, | 0, 0, 0, 0, 0, 0). The last six 0's represent unnecessary slack variables in the primal problem; they are included only to show that complementary slackness does indeed hold when we look at the dual solution (1 , 2 , 3 , 1 , 2 , 3 , s11 , . . . , s33 ) = (0, 1, 0, 9, 7, 5, | 3, 0, 5, 0, 0, 0, 0, 8, 3). The problem is now modified as follows: The demand at W2 is increased to 28. There is no link between F2 and W2 . All the demand at W3 must be satisfied. We add a dummy source F4 with capacity 9. The costs c22 and c43 are set equal to a large number M . This is a standard method for ensuring that the allocation to a particular cell is always zero. M is to be thought of as larger than any other number in the problem. The tableau becomes:
12 10 9 0
7 M 15 0
10 6 8 M
12 10 9 0
7 M 15 0
10 6 8 M
12 10 9 0
7 M 15 0
10 6 8 M
12 10 9 0
7 M 15 0
10 6 8 M
We can find an initial allocation by the least-cost method, or by adapting the existing optimal tableau. The minimum cost is 450,000; this is uniquely determined, though the allocation which produces it may not be. 55
Exercises 4
1. For the transportation problem given by the following tableau, find an initial basic feasible solution by the least-cost method and proceed to find an optimal solution. Supply 2 1 3 7 4 5 6 8 Demand 5 6 4
2. Formulate the transportation problem in Question 1 in linear programming form. Also state the dual problem. From your final tableau, write down the values of all the primal and dual variables at the optimal solution. Show how this provides a check on your answer. 3. For the transportation problem given by the following tableau, find an initial basic feasible solution by the North-West corner method and then find an optimal solution. 10 5 15 Demand 5 15 10 10 9 10 8 12 2 12 15 12 4 20 10 10 5 Supply 8 7 10
The supply at Source 3 is now reduced from 10 to 6. There is a penalty of 5 for each unit required but not supplied. Find the new optimal solution. 4. Three refineries with maximum daily capacities of 6, 5, and 8 million gallons of oil supply three distribution areas with daily demands of 4, 8 and 7 million gallons. Oil is transported to the three distribution areas through a network of pipes. The transportation cost is 1 p per 100 gallons per mile. The mileage table below shows that refinery 1 is not connected to distribution area 3. Formulate the problem as a transportation model and solve it. [Hint: Let the transportation cost for the nonconnected route be equal to some large value M say and then proceed as normal.] Distribution 1 2 120 180 300 100 200 250 Area 3 -- 80 120
Refinery
1 2 3
5. In Question 4, suppose additionally that the capacity of refinery 3 is reduced to 6 million gallons. Also, distribution area 1 must receive all its demand, and any shortage at areas 2 and 3 will result in a penalty of 5 pence per gallon. Formulate the problem as a transportation model and solve it. 6. In Question 4, suppose the daily demand at area 3 drops to 4 million gallons. Any surplus production at refineries 1 and 2 must be diverted to other distribution areas by tanker. The resulting average transportation costs per 100 gallons are 1.50 from refinery 1 and 2.20 from refinery 2. Refinery 3 can divert its surplus oil to other chemical processes within the plant. Formulate the problem as a transportation model and solve it.
56