get.constr.type: Get Constraint Type

View source: R/get.constr.type.R

get.constr.typeR Documentation

Get Constraint Type

Description

Retrieve constraint types from an lpSolve linear program model object.

Usage

get.constr.type(lprec, constraints = 1:m, as.char = TRUE)

Arguments

lprec

an lpSolve linear program model object.

constraints

a numeric vector of unique values from the set {1, ..., m} (where m is the number of constraints in lprec) specifying the constraints for which the types will be retrieved.

as.char

a logical value. If TRUE the constraint type is returned as a character string, otherwise the integer code used internally by lpSolve is returned.

Value

either a character vector or an integer vector containing the types of the constraints specified in constraints. The possibilities are: 0 = "free", 1 = "<=", 2 = ">=" and 3 = "=".

Author(s)

Kjell Konis kjell.konis@me.com

References

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

Examples

lps.model <- make.lp(0, 3)

xt <- c(6,2,4)
add.constraint(lps.model, xt, "<=", 15)

xt <- c(1,1,6)
add.constraint(lps.model, xt, ">=", 15)

xt <- c(4,5,4)
add.constraint(lps.model, xt, "=", 40)

get.constr.type(lps.model)

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