C_constraint | R Documentation |
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} = \prod \mathcal{K}_i
. The right hand side rhs
is a vector of length m
.
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 |
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 |
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"
.
## 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.