Learn R Programming

ROI.plugin.scs (version 1.1-2)

Example-1: SOCP 1

Description

$$maximize \ \ x + y$$ $$subject \ to \ \ x^2 + y^2 \leq 1$$ $$x \geq 0, y \geq 0$$

Arguments

Examples

Run this code

Sys.setenv("ROI_LOAD_PLUGINS" = FALSE)
library(ROI)
library(ROI.plugin.scs)

obj <- L_objective(c(1, 1))
## NOTE: chol(diag(2)) == diag(2)
con <- C_constraint(L = rbind(0, -diag(2)), cones = K_soc(3), rhs = c(1, 0, 0))
op <- OP(obj, con, maximum = TRUE)
x <- ROI_solve(op, solver = "scs")
x
## Optimal solution found.
## The objective value is: 1.414214e+00
solution(x)
## [1] 0.7071068 0.7071068

Run the code above in your browser using DataLab