Library: | nummath |
See also: | nmlinprog nmlinprogmaxel nmlinprogpivot |
Quantlet: | nmlinprogexchange | |
Description: | auxiliary quantlet for nmlinprog; exchange of a left-hand and a right-hand variable |
Usage: | coef = nmlinprogexchange(coefin,nrow,ncol,prow,pcol) | |
Input: | ||
coefin | nr x nc matrix, tableau of a linear programming problem | |
nrow | integer, number of rows of coefin to consider in exchange | |
ncol | integer, number of columns of coefin to consider in exchange | |
prow | integer, index of a left-hand variable to exchange (corresponds to coef[prow+1,]) | |
pcol | integer, index of a right-hand variable to exchange (corresponds to coef[,pcol+1]) | |
Output: | ||
coef | nr x nc matrix, new tableau |
library("nummath") coef=#(0,2,8) ~ #(2,-6,3) ~ #(-4,1,-4) coef ; example as in Numerical Recipes, p. 436 ; lines: z, x1, x4; columns: constant, x2, x3 ; exchange x1 and x2 nmlinprogexchange(coef,2,2,1,1) ; lines: z, x2, x4; columns: constant, x1, x3
Contents of coef [1,] 0 2 -4 [2,] 2 -6 1 [3,] 8 3 -4 Contents of coef [1,] 0.66667 -0.33333 -3.6667 [2,] 0.33333 -0.16667 0.16667 [3,] 9 -0.5 -3.5