set.type: Set Type

View source: R/set.type.R

set.typeR Documentation

Set Type

Description

Set the type of a decision variable in an lpSolve linear program model object.

Usage

set.type(lprec, columns, type = c("integer", "binary", "real"))

Arguments

lprec

an lpSolve linear program model object.

columns

a numeric vector of unique values from the set {1, ..., n} (where n is the number of decision variables in lprec) specifying which variables are to have their type set.

type

either "integer", "binary" or "real". The decision variables in columns will have their type set to this value.

Details

A binary decision variable is simply an integer decision with an upper bound of one and a lower bound of zero. When type = "binary" the type of the decision variable will be set to "integer" and the bounds will be set to zero and one respectively.

Value

a NULL value is invisibly returned.

Author(s)

Kjell Konis kjell.konis@me.com

References

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

See Also

set.type

Examples

lps.model <- make.lp(0, 3)
xt <- c(6,2,4)
add.constraint(lps.model, xt, "<=", 150)
xt <- c(1,1,6)
add.constraint(lps.model, xt, ">=", 0)
set.type(lps.model, 2, "binary")
xt <- c(4,5,4)
add.constraint(lps.model, xt, "=", 40)
set.type(lps.model, 3, "integer")
set.objfn(lps.model, c(-3,-4,-3))

get.type(lps.model)

lpSolveAPI documentation built on Sept. 11, 2024, 9:27 p.m.