addVariable creates a new variable (continuous,
integer or binary) and adds it to a linear program (LP) or
mixed integer program (MIP) represented by an object of
class lpmodeler.
Usage
addVariable(p, t = c("C", "I", "B"), o = 0, name = NULL)
Arguments
p
an object of class lpmodeler
t
type of the variable to create, C = continuous
(default), I = integer, B = binary
o
numeric value representing the coefficient of
the variable in the objective function (objective point),
0 by default
p <- newProblem()
# add an integer variable called x to the# problem, and set its coefficient in the# objective function to a value of 5.p <- addVariable(p, "I", 5, "x")