set.objfn {lpSolveAPI} | R Documentation |
Set the objective function in an lpSolve linear program model object.
set.objfn(lprec, obj, indices = 1:n)
lprec |
an lpSolve linear program model object. |
obj |
a numeric vector of length n (where n is the number of decision variables in lprec ) containing the coefficients of the objective function. Alternatively, if indices is also provided, a numeric vector of the same length as indices containing only the nonzero coefficients. |
indices |
a numeric vector containing unique elements from the set {1, ..., n} (where n is the number of decision variables in lprec ) identifying the nonzero coefficients in the objective function. Coefficients not specified in indices are set to zero. |
a logical value indicating whether setting the objective function was successful is invisibly returned.
Kjell Konis kjell.konis@epfl.ch
http://lpsolve.sourceforge.net/5.5/index.htm
lps.model <- make.lp(4, 2) x <- c(6,2,4,9) set.column(lps.model, 2, x) y <- c(3,1,5) ind <- c(1,2,4) set.column(lps.model, 1, y, ind) set.objfn(lps.model, c(-3, -4))