Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Library: nummath
See also: nmlinprog nmlinprogpivot nmlinprogexchange

Quantlet: nmlinprogmaxel
Description: auxiliary quantlet for nmlinprog; determines maximum of coeffiecients in a given row and listed columns

Usage: maxel = nmlinprogmaxel(coef,row,collist, {ncol,inabs})
Input:
coef nr x nc matrix, nr,nc >= 2, tableau of a linear programming problem
row scalar, 0 <= row <= nr-1, index of the row in which a maximum element should be found; index ir corresponds to coef[ir+1,]
collist c x 1 vector, list of columns for searching; index ic corresponds to coef[,ic+1]
ncol (optional) scalar, number of columns that should be searched through for maximum. Default ncol = rows(collist).
inabs (optional) scalar specifying whether the quantlet should search maximum with (inabs = 1) or without (inabs = 0) taking the absolute value. Default inabs = 0.
Output:
maxel.val scalar, maximum value
maxel.ind integer, ind+1 is the index of the column of coef that contains the maximum

Note:

Example:
library("nummath")
coef=#(0,2,8) ~ #(2,-6,3) ~ #(-4,1,-4)
coef	; rows and cols indexed from 0!
first = nmlinprogmaxel(coef,1,1:2,2,0)
first	; value and index of the maximal element in the first row
secon = nmlinprogmaxel(coef,2,1:2,2,1)
secon	; value and index of the maximal(in abs. value) element in the second row

Result:
Contents of coef
[1,]        0        2       -4
[2,]        2       -6        1
[3,]        8        3       -4

Contents of first.val
[1,]        1

Contents of first.ind
[1,]        2

Contents of secon.val
[1,]       -4

Contents of secon.ind
[1,]        2



Author: L. Cizkova, 20021119 license MD*Tech
(C) MD*TECH Method and Data Technologies, 05.02.2006