Learn R Programming

lpSolveAPI (version 5.5.0.12-3)

add.column: Add Column

Description

Add a column to an lpSolve linear program model object.

Usage

add.column(lprec, x, indices = 1:m)

Arguments

lprec
an lpSolve linear program model object.
x
a numeric vector containing the elements (only the nonzero elements if indices is also given) to be used in the added column. The length of x must be equal to the number of constraints in lprec unless indices
indices
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 coeffic

Value

  • a logical value is invisibly returned: TRUE indicates that the operation was successful and FALSE indicates that an error occurred.

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.

References

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

See Also

resize.lp

Examples

Run this code
lps.model <- make.lp(4, 0)

x <- c(6,2,4,9)
add.column(lps.model, x)

y <- c(3,1,5)
ind <- c(1,2,4)
add.column(lps.model, y, ind)

Run the code above in your browser using DataLab