The LP subroutine solves the linear programming problem.
The input arguments to the LP subroutine are as follows:
is an vector that specifies the technological coefficients, where is less than or equal to .
is an vector that specifies the right-side vector.
is an optional row vector with one to five elements. If cntl=(indx, nprimal, ndual, epsilon, infinity), then
is the subscript of nonzero objective coefficient.
is the maximum number of primal iterations.
is the maximum number of dual iterations.
is the value of virtual zero.
is the value of virtual infinity.
The default values are as follows: indx equals , nprimal equals 999,999, ndual equals 999,999, epsilon equals 1.0E8, and infinity is machine-dependent. If you specify ndual or nprimal or both, then on return they contain the number of iterations actually performed.
is an optional array of dimension that specifies upper bounds on the decision variables. If you do not specify u, the upper bounds are assumed to be infinity.
is an optional array of dimension that specifies lower bounds on the decision variables. If l is not given, then the lower bounds are assumed to be 0 for all the decision variables. This includes the decision variable associated with the objective value, which is specified by the value of indx.
is an optional array of dimension that specifies the current basis. This is given by identifying which columns are explicitly in the basis and which columns are at their upper bound, as given in u. The absolute value of the elements in this vector is a permutation of the column indices. The columns specified in the first elements of basis are considered the explicit basis. The absolute value of the last elements of basis are the indices of the nonbasic variables. Any of the last elements of basis that are negative indicate that the corresponding nonbasic variable is at its upper bound. On return from the LP subroutine, the basis vector contains the final basis encountered. If you do not specify basis, then the subroutine assumes that an initial basis is in the last columns of and that no nonbasic variables are at their upper bound.
returns one of the following scalar return codes:
rc |
Termination |
---|---|
0 |
The solution is optimal. |
1 |
The solution is primal infeasible and dual feasible. |
2 |
The solution is dual infeasible and primal feasible. |
3 |
The solution is neither primal nor dual feasible. |
4 |
A singular basis was encountered. |
5 |
The solution is numerically unstable. |
6 |
The subroutine could not obtain enough memory. |
7 |
The number of iterations was exceeded. |
returns the current primal solution in a column vector of length .
returns the current dual solution in a row vector of length .
The LP subroutine solves the linear program:
|
|
|
|
|
|
|
|
|
The subroutine first inverts the initial basis. If the basis vector is given, then the initial basis is the submatrix identified by the first elements in basis; otherwise, the initial basis is defined by the last columns of . If the initial basis is singular, the subroutine returns with RC=4. If the basis is nonsingular, then the current dual and primal solutions are evaluated. If neither is feasible, then the subroutine returns with RC=3. If the primal solution is feasible, then the primal algorithm iterates until either a dual feasible solution is encountered or the number of NPRIMAL iterations is exceeded. If the dual solution is feasible, then the dual algorithm iterates until either a primal feasible solution is encountered or the number of NDUAL iterations is exceeded. When a basis is identified that is both primal and dual feasible, then the subroutine returns with RC=0.
Care must be taken when solving a sequence of linear programs that use the NPRIMAL or NDUAL control parameters. Because the LP subroutine resets the NPRIMAL and NDUAL parameters to reflect the number of iterations executed, subsequent invocations of the LP subroutine will have the number of iterations limited to the number used by the last LP subroutine executed. In these cases you should consider resetting these parameters prior to each LP call.
Consider the following example to maximize subject to the constraints , and , and . The problem is solved by using the following statements:
/* the problem data */ obj = {1 0}; coef = {1 1}; b = {0, 10}; /* embed the objective function in the coefficient matrix */ a = obj // coef; a = a || {-1, 0}; /* solve the problem */ call lp(rc, x, dual, a, b); print rc, x, dual;