set.objfn: Set Objective Function

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

Description

Set the objective function in an lpSolve linear program model object.

Usage

1
set.objfn(lprec, obj, indices)

Arguments

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

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

Value

a NULL value is invisibly returned.

Author(s)

Kjell Konis kjell.konis@me.com

References

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

See Also

resize.lp

Examples

1
2
3
lps.model <- make.lp(2, 4)
set.objfn(lps.model, c(1,2,3,4))
set.objfn(lps.model, c(5,7,6), indices = c(1,2,4))

Example output



lpSolveAPI documentation built on May 2, 2019, 6:50 p.m.