SIMPLEX S,M1,M2,M3,L solves a linear programming problem presented by the matrix file S with M1+M2+M3 constraints and lists the results from line L (optional) onwards. The ordinary simplex algorithm is used. The solution vector and the values of the M1+M2 slack variables will be given as results. These vectors are also saved in matrix files SIMPLEX.M and SLACK.M, respectively. The Simplex Output Table is saved as matrix file TSIMPLEX.M . The algorithm has been taken from Numerical Recipes by Press, Flannery, Teukolsky and Vetterling. The structure of the problem is given on the next page: The problem to be solved is: Maximize Z=A(0,1)*X1+A(0,2)*X2+...+A(0,N)*XN subject to the primary constraints X1>=0, X2>=0, ... , XN>=0 and simultaneously subject to M=M1+M2+M3 additional constraints, M1 of them of the form A(I,1)*X1+A(I,2)*X2+...+A(I,N)*XN <= B(I), B(I)>=0, I=1,...,M1 M2 of them of the form A(I,1)*X1+A(I,2)*X2+...+A(I,N)*XN >= B(I) >= 0, I=M1+1,...,M1+M2 and M3 of them of the form A(I,1)*X1+A(I,2)*X2+...+A(I,N)*XN = B(I) >= 0, I=M1+M2+1,...,M The matrix of coefficients S with M+1 rows and N+1 columns has the form 0 A(0,1) A(0,2) ... A(0,N) B(1) -A(1,1) -A(1,2) ... -A(1,N) B(2) -A(2,1) -A(2,2) ... -A(2,N) ... ... ... ... ... B(M) -A(M,1) -A(M,2) ... -A(M,N) and it must be saved in a MAT file before activating SIMPLEX. Example 1: Maximize Z=X1+X2+3*X3-0.5*X4 with all the X's non-negative and also with X1+2*X3 <= 740 2*X2-7*X4 <= 0 X2-X3+2*X4 >= 0.5 X1+X2+X3+X4 = 9 We have M1=2, M2=1, M3=1 This problem is described and solved by: 1 * 2 *MATRIX S 3 */// C X1 X2 X3 X4 4 *Z 0 1 1 3 -0.5 5 *Z1 740 -1 0 -2 0 6 *Z2 0 0 -2 0 7 7 *Z3 0.5 0 -1 1 -2 8 *Z4 9 -1 -1 -1 -1 9 * 10 *MAT SAVE S / Saving the matrix 11 *SIMPLEX S,2,1,1,12 12 * Example 2: B1 B2 B3 B4 Solving a two-person zero-sum game: A1 3 6 1 4 A2 5 2 4 2 A3 1 4 3 5 2 *MATRIX A 3 */// C A1 A2 A3 V 4 *C 0 0 0 0 1 5 *B1 0 3 5 1 -1 6 *B2 0 6 2 4 -1 7 *B3 0 1 4 3 -1 8 *B4 0 4 2 5 -1 9 *V 1 -1 -1 -1 0 10 * 11 *MAT SAVE A 12 *SIMPLEX A,4,0,1,END+2 / gives the optimal mixed strategy for player A 13 *MAT B=A' / *B~A' 5*6 14 *MAT DIM B /* rowB=5 colB=6 15 *MAT B(1,colB)=-1 16 *SIMPLEX B,0,3,1,END+2 / gives the optimal mixed strategy for player B M = More information on mathematical operations