MATH 445/545 Homework 2: Due March 3rd, 216 Answer the following questions. Please include the question with the solution (write or type them out doing this will help you digest the problem). I do not want to see scrap work. Note the problems are separated into two sections a set for all students and a bonus set for those taking the course at the 545 level. All Students 1. You have $2 to invest over the next five years. At the beginning of each year, you can invest money in one or two year bank time deposits, yielding 8% (at the end of one year) and 17% (at the end of the two years) respectively. Also you can invest in threeyear certificates offered only at the start of the second and third years, yielding 26% (total) at the end of the third year. Assume that you invest all money available each year, and want to withdraw all cash at the end of year 5. Formulate the situation as a linear programming problem; carefully define your decision variables. Then solve the problem using lindo or lingo (as we have done in class), and attach the lindo output. Be sure to interpret your results. Let x i,j be the amount of money invested in an account at the start of year i for j years. Then for example x 5,1 is the amount of money invested into an account for one year at the start of year five. There will then be 11 possible decision variables: decision variables = {x 1,1, x 2,1, x 3,1, x 4,1, x 5,1, x 1,2, x 2,2, x 3,2, x 4,2, x 2,3, and x 3,3 } The objective is to maximize the money received during the fifth year. Thus, maximize z = 1.8x 1,5 + 1.17x 2,4 + 1.26x 3,3 we are now subject to the following constraints: x 1,1 + x 1,2 = 2 x 2,1 + x 2,2 + x 2,3 = 1.8x 1,1 x 3,1 + x 3,2 + x 3,3 = 1.17x 1,2 + 1.8x 2,1 x 4,1 + x 4,2 = 1.17x 2,2 + 1.8x 3,1 x 5,1 = 1.26x 2,3 + 1.17x 3,2 + 1.8x 4,1 start 1st year start 2nd year start 3rd year start 4th year start 5th year with the set of decision variables all nonnegative.
Solving the problem with lingo yields: x 1,1 = 2, x 2,2 = 216, x 4,2 = 2527.2, and all other x i,j =. The optimal objective function is z = $2956.82. You should invest all your money the first year into a one year account. Then in the second year put all your money into a two year account, and in the fourth year put all your money again into a two year account. Note additional optimal solutions may be found, including: x 5,1 = 2737.8, x 1,2 = 2, x 3,2 = 234, and all other x i,j =. 2. Write the following linear program in the standard form, posed as a minimization problem. Use LINDO to solve the problem. maximize z = 6x 1 3x 2 subject to 2x 1 + 5x 2 1 3x 1 + 2x 2 4 x 1, x 2 15. Start by placing adding the x 1, x 2 15 variables into the standard constraints. We convert to looking at the minimization problem by multiplying the objective function by -1 and note that we are solving for ẑ = z. minimize z = 6x 1 + 3x 2 subject to 2x 1 + 5x 2 1 3x 1 + 2x 2 4 x 1 15 x 2 15 with x 1, x 2 free. Now we deal with the variables x 1 and x 2 being free. Thus, we use the change of variables x 1 = x 1 x 1 and x 2 = x 2 x 2 with x 1, x 1, x 2, x 2. minimize z = 6x 1 + 6x 1 + 3x 2 3x 2 subject to 2x 1 2x 1 + 5x 2 5x 2 1 3x 1 3x 1 + 2x 2 2x 2 4 x 1 x 1 15 x 2 x 2 15 with x 1, x 1, x 2, x 2. Page 2
Last we add slack and excess variables to obtain the problem in standard form. minimize z = 6x 1 + 6x 1 + 3x 2 3x 2 subject to 2x 1 2x 1 + 5x 2 5x 2 e 1 = 1 3x 1 3x 1 + 2x 2 2x 2 + s 1 = 4 x 1 x 1 + s 2 = 15 x 2 x 2 + s 3 = 15 with x 1, x 1, x 2, x 2, e 1, s 1, s 2, s 3. Solving the problem in LINDO we obtain: z = 12, with x 1 = 15, x 2 = 4 3. Write the following linear program in the standard form, posed as a maximization problem. Do not use the substitution x 2 = x 2 x 2, use the free variable instead to state the problem using one less constraint. Use LINDO to solve the problem. maximize z = 6x 1 3x 2 subject to 2x 1 + 5x 2 1 3x 1 + 2x 2 4 x 1 and x 2 free. Thus, Here we can start by adding a slack variable to the second constraint. maximize z = 6x 1 3x 2 subject to 2x 1 + 5x 2 1 3x 1 + 2x 2 + s 1 = 4 x 1, s 1 and x 2 free. We can now make note that the second constraint can be solved for x 2 as x 2 = 4 2 3 2 x 1 1 2 s 1 = 2 3 2 x 1 1 2 s 1. This expression for x 2 can be placed into both the objective function and into the remaining constraints. This gives: maximize z = 6x 1 3(2 3x 2 1 1s 2 1) subject to 2x 1 + 5(2 3x 2 1 1s 2 1) 1 x 1, s 1. Page 3
Simplify and add a slack variable to get, maximize subject to z + 6 = 21x 2 1 + 3s 2 1 11 2 1 + 5s 2 1 + s 2 = 9 x 1, s 1, s 2. Note we could do a transform of variables on z to keep track of the additional 6 units for us. Solving the problem in LINDO we obtain: z = 111.8182 with x1 = 16.363636, x 2 = 4.545455 4. Solve the following linear program. minimize z = x 1 3x 2 subject to x 1 2x 2 4 x 1 + x 2 3 x 1, x 2. After adding two slack variables in the constraints the initial tableau for the given linear program is written as: Row z x 1 x 2 s 1 s 2 RHS Basis 1 1 3 z 1 1-2 1 4 s 1 2-1 1 1 3 s 2 As the given problem is a minimization problem we scan the non-basic variables in row zero of the tableau and find that x 2 should be picked to enter the basis. The ratio test shows that s 2 should leave the basis. After basic row operations we obtain the following tableau: Row z x 1 x 2 s 1 s 2 RHS Basis 1 4-3 -9 z 1-1 1 2 1 s 1 2-1 1 1 3 x 2 From the tableau it can be seen that it is favourable for x 1 to enter into the basis; however, as both variables have negative coefficients in the x 1 column for Page 4
the constraints we can see there is a direction of unboundedness. Thus, the linear program is unbounded, and no minimum value of the objective function will be obtained. Specifically we can see that the constraints give: s 1 = 1 + x 1 x 2 = 3 + x 1 Note that if the value of s 1 and x 2 are both increased by one then increasing the value of x 1 by one will keep these constraints satisfied. Thus, from the feasible point: x = 3 1 There is a direction of unboundedness given by: 1 d = 1 1 and for all c we note that x + cd is feasible for the linear program and the objective function is unbounded. 5. Solve the following linear program. maximize z = x 1 + x 2 subject to x 1 + x 2 + x 3 1 x 1 + 2x 3 1 x 1, x 2, x 3. After adding in the slack variables we obtain the following standard form initial tableau: Row z x 1 x 2 x 3 s 1 s 2 RHS Basis 1-1 -1 z 1 1 1 1 1 1 s 1 2 1 2 1 1 s 2 Note that x 1 and x 2 are both attractive to the simplex method. Thus, using Bland s rule we will pick x 1 as the entering variable. The ratio test has a tie between s 1 and Page 5
s 2 as leaving variables. Here we will pick s 1 as the leaving variable. The updated tableau follows: Row z x 1 x 2 x 3 s 1 s 2 RHS Basis 1 1 1 1 z 1 1 1 1 1 1 x 1 2-1 1-1 1 s 2 Here we see that we have obtained an optimal simplex tableau; however, we make note that there are multiple optimal solutions as x 2 is a non-basic variable that has a zero coefficient in row zero of the tableau. Pivot x 2 into the basis variables in place of x 1 to obtain a second optimal solutions. Row z x 1 x 2 x 3 s 1 s 2 RHS Basis 1 1 1 1 z 1 1 1 1 1 1 x 2 2 1 2 1 1 s 2 Here we pivot in x 1 in place of s 2 Row z x 1 x 2 x 3 s 1 s 2 RHS Basis 1 1 1 1 z 1 1-1 1-1 x 2 2 1 2 1 1 x 1 This is a rehash of the earlier degenerate case. The optimal solutions to the linear program are: 1 X 1 = and X 1 2 = 1 For α [, 1] the optimal objective function value z = 1 is found with solutions of the form: αx 1 + (1 α)x 2. (1) Page 6
6. Solve the following linear program. minimize z = 4x 1 + 4x 2 + x 3 subject to x 1 + x 2 + x 3 2 2x 1 + x 2 3 2x 1 + x 2 + 3x 3 3 x 1, x 2, x 3. For this problem we need to add slack and excess variables. For use in the Big-M method for solving this problem we also need to add an artificial variable for the constraint with an excess variable that will allow us to have a starting basic feasible solution. The problem written in standard form then becomes: minimize z = 4x 1 + 4x 2 + x 3 + Ma 1 subject to x 1 + x 2 + x 3 + s 1 = 2 2x 1 + x 2 + s 2 = 3 2x 1 + x 2 + 3x 3 e 1 + a 1 = 3 x 1, x 2, x 3, s 1, s 2, a 1. where M denotes a large positive constant. Note we have penalized the objective function if a 1 is a basic variable. The initial simplex tableau for the problem is: z x 1 x 2 x 3 s 1 s 2 e 1 a 1 RHS Basic 1-4 -4-1 -M z 1 1 1 1 2 s 1 2 1 1 3 s 2 2 1 3-1 1 3 a 1 After adjusting the values of the top row using elementary column operations the following tableau is obtained. z x 1 x 2 x 3 s 1 s 2 e 1 a 1 RHS Basic 1 2M-4 M-4 3M-1 -M z 1 1 1 1 2 s 1 2 1 1 3 s 2 2 1 3-1 1 3 a 1 The simplex method now scans the coefficients in the zero row looking for the most positive value (as this is a minimization problem). Here we see that x 3 is the most attractive. The ratio test shows that a 1 should leave the basis. After the pivot we obtain the tableau: Page 7
z x 1 x 2 x 3 s 1 s 2 e 1 a 1 RHS Basic 1 11 1 1 M + 1 1 z 3 3 3 3 1 2 1 1 1 1 s 3 3 3 3 1 2 1 1 3 s 2 2 1 1 1 1 1 x 3 3 3 3 3 This is an optimal solution as there is no longer any positive coefficients in the zero row of the tableau. The optimal solution to the given linear program is z = 1 when: x 3 = 1, s 1 = 1, s 2 = 3, and all other variables are set to zero. 545 Additional Homework 1. For a linear program written in standard form with constraints Ax = b and x show that d is a direction of unboundedness if and only if Ad = and d. First lets recall what a direction of unboundedness is. An n by 1 vector d is a direction of unboundedness if for all x in S (an LP s feasible region), and c then x + cd S. (= ) Assume here that d is a direction of unboundedness, and that c is a positive constant (c = is trivial). Then we know that for any x S that x + cd is in S. This gives A(x + cd) = b Ax + cad = b b + cad = b cad = Ad =. We also know that x + cd for all x S. Thus, cd, and d. ( =) Assume that Ad =, and d, and consider any point x in the feasible region of our linear program. As x is in the feasible region we know that Ax = b. Thus, for c > consider the point x + cd A(x + cd) = Ax + cad = Ax + = Ax = b. Note we also need our new point x + cd to be non-negative which is true as x S, and d. Thus, x + cd S, and d is a direction of unboundedness. Page 8
2. Characterize all optimal solutions to the following LP: max z = 9x 5 (2) s.t. x 1 + x 3 + 3x 4 + 2x 5 = 2 (3) x 2 + 2x 3 + 4x 4 + 5x 5 = 5 (4) (5) with x i, i {1, 2,..., 5}. The optimal solution has x 5 =. Considering all combinations of basic variables not involving x 5 yields three alternate optimal solutions: 2 5 A :=, B := 1 7 3 2, and C := 2 3 Here all optimal solutions may then be characterized by considering a convex combination of these basic feasible solutions. Let α i [, 1] such that 3 i=1 α i = 1. Then the solution set S for the linear program is given by: S = α 1 A + α 2 B + α 3 C 3. Suppose the Basic Feasible Solution for an optimal tableau is degenerate, and a nonbasic variable in row zero has a zero coefficient. Show by example that either of the following cases may hold: The LP has more than one optimal solution. Recall a degenerate BFS is one in which there is at least one basic variable equal to zero. Assuming a Min Problem we could have an optimal tablue of the following form: Row x 1 x 2 s 1 s 2 RHS basis -3 2 z 1 1-1 2 x 1 2 1 1 1 3 x 2 Page 9
Here we are optimal; however, we can pivot s 1 in to the basis in place of x 2. Row x 1 x 2 s 1 s 2 RHS basis -3 2 z 1 1 1 3 3 x 1 2 1 1 1 3 s 1 Again an optimal solution both yield an objective function value of 2. X 1 = ( 3 ) T, and X 2 = (3 3 ) T The LP has a unique optimal solution. Again assuming a min problem: Row x 1 x 2 s 1 s 2 RHS basis -3 2 z 1 1 1 2 x 1 2 1 1 1 3 x 2 Here we are optimal; however, we can pivot s 1 in to the basis in place of x 1. Note the solutions here are identical. Row x 1 x 2 s 1 s 2 RHS basis -3 2 z 1 1 1 2 x 1 2-1 1-1 3 x 2 X = ( 3 ) T 4. Consider the simplex method, implemented with the usual rules, applied to a linear program of the form: maximize z = c T x, subject to Ax b, x. Can a variable x j that enters at one iteration leave at the very next iteration? Either provide a numerical example (in two variables) in which this happens or prove that it cannot occur. Page 1
Yes a variable that enters the basis at one iteration can leave the basis on the next iteration of the simplex method. Consider the following example: maximize z = 2x 1 + x 2 subject to x 1 + 1x 4 2 1 x 1 3x 2 5 x 1 2x 2 4 x 1, x 2. After adding in the needed slack variables the initial simplex tableau is: Row z x 1 x 2 s 1 s 2 s 3 RHS Basis 1-2 -1 z 1 1.25 1 1 s 1 2 1-3 1 5 s 2 3 1-2 1 4 s 3 The first pivot of the simplex algorithm has x 1 enter the basis in place of s 1. Row z x 1 x 2 s 1 s 2 s 3 RHS Basis 1 -.5 2 2 z 1 1.25 1 1 x 1 2-3.25-1 1 4 s 2 3-2.25-1 1 3 s 3 On the next pivot of the algorithm we see that x 1 is replaced in the basis by x 2. Row z x 1 x 2 s 1 s 2 s 3 RHS Basis 1 2 4 4 z 1 4 1 4 4 x 2 2 13 12 1 17 s 2 3 9 8 1 12 s 3 This is the optimal tableau, and the optimal solution to the stated maximization problem is z = 4 when x 1 =, and x 2 = 4. Page 11