C_constraint: Conic Constraints

View source: R/constraints.R

C_constraintR Documentation

Conic Constraints

Description

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.

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 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 "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 x (column names of L).

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)

ROI documentation built on April 21, 2023, 1:11 a.m.

Related to C_constraint in ROI...