1 CAAM 471/571 - Fall 2014 INTRODUCTION TO LINEAR AND INTEGER PROGRAMMING Homework 3, February 4, 2014 Due: February 11, 2014 Note: All M ATLAB or AMPL functions/files mentioned in this homework assignment can be found on the CAAM471/571 homepage, or come with M ATLAB . You can use the M ATLAB or AMPL files posted on the CAAM471/571 web-page. If you modify these codes, please turn in the modified files. Otherwise you do not have to turn in printouts of the codes posted on the CAAM471/571 web-page. Turn in all M ATLAB / AMPL code/files that you have written and turn in all output generated by your M ATLAB functions/scripts. M ATLAB and AMPL functions/files/scripts must be commented, output must be formatted nicely, and plots must be labeled. In all the assignments, BT refers to the textbook by Bertsimas and Tsitsiklis. Problem 1 (5 points) BT Exercise 3.1. Problem 2 (10 points) BT Exercise 3.2. Problem 3 (5 points) BT Exercise 3.3. Problem 4 (10 points) BT Exercise 3.7. Problem 5 (15 points) BT Exercise 3.12. Problem 6 (571 only. 10 points) BT Exercise 3.13. Problem 7 (15 points) Klee and Minty (1972) constructed an example with n variables which requires 2n iterations for the simplex algorithm to solve when using the “most-negative” pivot rule. This example is often used to illustrate the worst-case behavior of the Simplex algorithm. In practice, the observed convergence behavior of the Simplex algorithm is typically much better. The problem constructed by Klee and Minty (1972) is given by n max ∑ 10n−i xi , i=1 i−1 s.t. 2 ∑ 10i− j x j + xi ≤ 100i−1 for i = 1, . . . , n, xi ≥ 0 for i = 1, . . . , n. j=1 (Note that the above matrix A is a Teoplitz matrix with constant diagonals.) CAAM 471/571 Homework 3 (generated February 4, 2014) 2 (a) (10 points) Solve the Klee Minty problem for n = 2, 3, . . . , 8 using the script solve an LP.m that calls the simplex solver yzsimplex.p (provided as an executable file for now) with maxiter no less than 300. First read and run the demo file test randomLP.m. Copy it to test KleeMinty.m, and modify it for solving the Klee-Minty problems (keeping prule = 1). Generate a table n 2 3 ··· 8 iter ? ? · · · ? and then deduce a general formula that you think should relate the two quantities. (b) (5 points) Then solve the same problems again using prule = 2. Here we change the so-called pivot rule that determines which edge to follow to the next vertex out of multiple edges that are descending. Present you results and observation in one sentence. Submission: your Matlab code printout and results for (a)-(b). Problem 8 (40 points) We will solve the standard form LP for given data (A, b, c): min cT x, s.t. Ax = b, x ≥ 0, where A ∈ Rm×n with rank(A) = m < n, b ∈ Rm and c ∈ Rn . (a) (25 points) Implement the simplex method, given in TB book pages 90-91, into a Matlab function mysimplex.m to solve the standard LP starting from a given vertex. We only do a “naive implementation” (as described in the TB book). For more details and specifications (and an alternative algorithm description), see http://www.caam.rice.edu/~yzhang/caam471/assignments/hw3/simplex_specs.pdf (http://www.caam.rice.edu/~yzhang/caam471/assignments/hw3/Simplex_alg.pdf). A Matlab function for selecting entering variable (including 2 pivot rules) is provided online. It is important to be aware of an index’s reference range (local in B or N, or global in 1 to n). Also keep in mind of rounding error effects. (b) (10 points) Run the scripts test randomLP.m and test KleeMinty.m (from Problem 7) using both your code mysimplex.m and the handout code yzsimplex.p. Modify the former script so that it can run mysimplex.m and yzsimplex.p side by side on the same set of data for a comparison purpose. (c) (5 points) Run the handout script test cycle.m (that uses yzsimplex.p and cycle.mat provided together), and give your observations in a couple of sentences. Then you also test your code mysimplex.m on the problem (in place of yzsimplex.p). Submission: your code mysimplex.m and the output from running the two scripts. CAAM 471/571 Homework 3 (generated February 4, 2014)