Simplex-method (linear programming). Version 1.0 (April 2005) Authors: S.Yu.Orevkov, Yu.P.Orevkov orevkov@picard.ups-tlse.fr 1. Installation: ---------------- Just compile the C-program file using e.g. the command gcc o-simplex.c -o simplex 2. Usage: --------- simplex [ options ] [ output ] Options (the case is ignored, e.g., -i is the same as -I): -i the input data are interpreted as a system of simultaneous Inequalities for non-negative variables (by default, they are interpreted as a system of simultaneous equations for non-negative variables) -m -mnnn print the resulting Matrix with nnn digits after the decimal point (default: nnn=2) -t Trace intermediate steps -d/-n (only if -i is switched on) force usage/Non-usage of the Dual problem. By default the dual problem is used when the number of inequalities is greater that the number of variables. -pnnn absolute Precision is 10^(-nnn). Default: 11. 3. Input: --------- The standard input (the input file if `= 0, j=1..n and the secondary constraints Sum( A[i][j]*xj, j=1..n ) = A[i][0], i=1,...,m (if -i option is switched off) or Sum( A[i][j]*xj, j=1..n ) <= A[i][0], i=1,...,m (if -i option is switched on). 4. Example: ----------- Suppose that we want to find the maximum of the function 5 + 3a + 4b + c under the constraints: a >= b >= c >= 0 a + b/2 + 3c = 6 First, we must replace the problem by searching the minimum of -5-3a-4b-c. There are two possible ways to solve this problem: with or without the -i option. 4.1. Solution using equations (without -i). Let us rewrite the constraints as a - b = z1 b - c = z2 a + b/2 + 3c = 6 a,b,c,z1,z2 >= 0 So, we prepare the input file example1.sx ==================== 5 3 -5 3 4 1 0 0 0 1 -1 0 -1 0 0 0 1 -1 0 -1 6 1 0.5 3 0 0 a b c z1 z2 ==================== and run simplex = 0 So, we prepare the input file example2.sx ... ================= 3 4 -5 3 4 1 0 -1 1 0 0 0 -1 1 6 1 0.5 3 -6 -1 -0.5 -3 a b c ================= ...and run simplex -i n we pass to the dual problem where the roles of m and n are exchanged. Thus, we at most double the memory. This is why we do not recommend to use the -n option when the number of inequalities is big.