Description Usage Arguments Value Examples
Conic constraints are often written in the form
Lx + s = rhs
where L is a m \times n (sparse) matrix and s \in \mathcal{K} are the slack variables restricted to some cone \mathcal{K} which is typically the product of simpler cones \mathcal{K} = ∏ \mathcal{K}_i. The right hand side rhs is a vector of length m.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | C_constraint(L, cones, rhs, names = NULL)
as.C_constraint(x, ...)
is.C_constraint(x)
## S3 method for class 'C_constraint'
length(x)
## S3 method for class 'C_constraint'
variable.names(object, ...)
## S3 method for class 'C_constraint'
terms(x, ...)
|
L |
a numeric vector of length n (a single constraint)
or a matrix of dimension m \times n, where n is the
number of objective variables and m is the number of
constraints. Matrices can be of class
|
cones |
an object of class |
rhs |
a numeric vector giving the right hand side of the constraints. |
names |
an optional character vector giving the names of x (column names of L). |
x |
an R object. |
... |
further arguments passed to or from other methods (currently ignored). |
object |
an R object. |
an object of class "C_constraint"
which inherits
from "constraint"
.
1 2 3 4 5 6 7 8 9 10 11 | ## minimize: x1 + x2 + x3
## subject to:
## x1 == sqrt(2)
## ||(x2, x3)|| <= x1
x <- OP(objective = c(1, 1, 1),
constraints = C_constraint(L = rbind(rbind(c(1, 0, 0)),
diag(x=-1, 3)),
cones = c(K_zero(1), K_soc(3)),
rhs = c(sqrt(2), rep(0, 3))),
types = rep("C", 3),
bounds = V_bound(li = 1:3, lb = rep(-Inf, 3)), maximum = FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.