Learn R Programming

lpmodeler (version 0.2-1)

addVariable: Add a new variable to a LP or MIP

Description

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
name
an optional string to name the new variable

Value

An object of class lpmodeler.

Details

TODO

See Also

TODO

Examples

Run this code
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")

Run the code above in your browser using DataLab