Learn R Programming

lpSolveAPI (version 5.5.2.0-17.12)

set.row: Set Row

Description

Set a column in an lpSolve linear program model object.

Usage

set.row(lprec, row, xt, indices)

Value

a NULL value is invisibly returned.

Arguments

lprec

an lpSolve linear program model object.

row

a single numeric value from the set {1, ..., m} (where m is the number of constraints in lprec) specifying which column to set.

xt

a numeric vector containing the constraint coefficients (only the nonzero coefficients if indices is also given). The length of xt must be equal to the number of decision variables in lprec unless indices is provided.

indices

optional for sparse xt. A numeric vector the same length as xt of unique values from the set {1, ..., n} where n is the number of decision variables in lprec; xt[i] is set in column indices[i] in the specified row. The coefficients for the columns not in indices are set to zero. This argument should be omitted when length(xt) == n.

Author

Kjell Konis kjell.konis@me.com

References

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

Examples

Run this code
lps.model <- make.lp(2, 4)
set.row(lps.model, 2, c(6,2,4,9))
set.row(lps.model, 1, c(3,1,5), indices = c(1,2,4))

Run the code above in your browser using DataLab