add.column: Add Column

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/add.column.q

Description

Add a column to an lpSolve linear program model object.

Usage

1
add.column(lprec, x, indices)

Arguments

lprec

an lpSolve linear program model object.

x

a numeric vector containing the elements (only the nonzero elements if the indices argument is also provided) of the column to be added. The length of x must be equal to the number of constraints in lprec unless indices is provided.

indices

optional for sparse x. A numeric vector the same length as x of unique values from the set {0, ..., m} where m is the number of constraints in lprec; x[i] is entered into constraint indices[i] in the added column. The coefficients for the constraints not in indices are set to zero. In particular, index 0 is the objective function coefficient in the added column and is set to zero by default. This argument should be omitted when length(x) == m.

Details

This function adds an additional column to an lpSolve linear program model object. If multiple columns are to be added, performance can be improved by calling resize.lp before adding the columns.

Value

a NULL value is invisibly returned.

Author(s)

Kjell Konis [email protected]

References

http://lpsolve.sourceforge.net/5.5/index.htm

See Also

resize.lp

Examples

1
2
3
lps.model <- make.lp(4, 0)
add.column(lps.model, c(6,2,4,9))
add.column(lps.model, c(3,1,5), indices = c(1,2,4))

lpSolveAPI documentation built on May 30, 2017, 7:12 a.m.