Description Usage Arguments Details Value Author(s) See Also Examples
addConstraint
creates a new constraint (<, >, <=,
>=, ==) and adds it to a linear program (LP) or mixed
integer program (MIP) represented by an object of class
lpmodeler
.
1 | addConstraint(p, sense, rhs, coefs = NULL, name = NULL)
|
p |
an object of class |
sense |
sense of the constraint ( |
rhs |
right hand side of the constraint |
coefs |
optional coefficients of the variables in the left hand side of the constraint |
name |
an optional string to name the new constraint |
TODO
An object of class lpmodeler
.
Cyrille Szymanski <cnszym at gmail.com>
TODO
1 2 3 4 5 6 7 8 9 10 11 | p <- newProblem()
# add variables x and y
p <- addVariable(p, "C", 5, "x")
p <- addVariable(p, "C", 4, "y")
# add the constraint: x + 2y >= 5
p <- addConstraint(p, ">=", 5, c(1, 2), name = "x+2y greater or equal than 5")
# add the empty constraint: <= 10
p <- addConstraint(p, "<=", 10, name = "less or equal than 10")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.