C_constraint {ROI}R Documentation

Conic Constraints

Description

Conic constraints are often written in the form

Lx+s=rhsLx + s = rhs

where LL is a m×nm \times n (sparse) matrix and sKs \in \mathcal{K} are the slack variables restricted to some cone K\mathcal{K} which is typically the product of simpler cones K=Ki\mathcal{K} = \prod \mathcal{K}_i. The right hand side rhsrhs is a vector of length mm.

Usage

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, ...)

Arguments

L

a numeric vector of length nn (a single constraint) or a matrix of dimension m×nm \times n, where nn is the number of objective variables and mm is the number of constraints. Matrices can be of class "simple_triplet_matrix" to allow a sparse representation of constraints.

cones

an object of class "cone" created by the combination, of K_zero, K_lin, K_soc, K_psd, K_expp, K_expd, K_powp or K_powd.

rhs

a numeric vector giving the right hand side of the constraints.

names

an optional character vector giving the names of xx (column names of LL).

x

an R object.

...

further arguments passed to or from other methods (currently ignored).

object

an R object.

Value

an object of class "C_constraint" which inherits from "constraint".

Examples

## 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)

[Package ROI version 1.0-1 Index]