Running ‘test_scs.R’ [5s/15s]
Running the tests in ‘tests/test_scs.R’ failed.
Complete output:
  > library(ROI)
  ROI: R Optimization Infrastructure
  Registered solver plugins: nlminb, scs.
  Default solver: auto.
  > library(ROI.plugin.scs)
  > 
  > check <- function(domain, condition, level=1, message="", call=sys.call(-1L)) {
  +     if ( isTRUE(condition) ) return(invisible(NULL))
  +     msg <- sprintf("in %s", domain)
  +     if ( all(nchar(message) > 0) ) msg <- sprintf("%s\n\t%s", msg, message)
  +     stop(msg)
  +     return(invisible(NULL))
  + }
  > 
  > ## SOCP - Example - 1
  > ## min:  1 x1 + 1 x2 + 1 x3
  > ## s.t.     x1 == sqrt(2)
  > ##          x1 >= ||(x2, x3)||
  > ##
  > ## c(sqrt(2), -1, -1)
  > test_cp_01 <- function(solver) {
  +     obj <- c(1, 1, 1)
  +     A <- rbind(c(1, 0, 0))
  +     b <- c(sqrt(2))
  +     G <- diag(x=-1, 3)
  +     h <- rep(0, 3)
  +     cones <- list("free"=c(1), "soc"=list(2:4))
  +     bound <- c(V_bound(li=1:3, lb=rep(-Inf, 3)), as.C_bound(cones))
  + 
  +     lc <- L_constraint(L = rbind(A, G), dir=rep("==", length(c(b, h))), rhs = c(b, h))
  +     x <- OP(objective = obj, constraints = lc, types = rep("C", 3),
  +             bounds =  bound, maximum = FALSE)
  + 
  +     opt <- ROI_solve(x, solver=solver)
  +     check("CP-01@01", equal(sum(abs(opt$solution - c(sqrt(2), -1, -1))), 0))
  +     check("CP-01@02", equal(opt$objval, (sqrt(2) - 2)))
  + }
  > 
  > ## SOCP - Example - 2
  > ## min:  0 x1 - 2 x2 - 2 x3 + 0 x4 - 2 x5 - 2 x6
  > ## s.t.     x1 == sqrt(2)
  > ##          x4 == sqrt(2)
  > ##          x1 >= ||(x2, x3)||
  > ##          x4 >= ||(x5, x6)||
  > ##
  > ## c(sqrt(2), 1, 1, sqrt(2), 1, 1)
  > test_cp_02 <- function(solver) {
  +     obj <- c(0, -2, -2, 0, -2, -2)
  +     A <- rbind(c(1, 0, 0, 0, 0, 0),
  +                c(0, 0, 0, 1, 0, 0))
  +     b <- c(sqrt(2), sqrt(2))
  +     G <- diag(x=-1, 6)
  +     h <- rep(0, 6)
  +     cones <- list("free"=c(1, 2), "soc"=list(3:5, 6:8))
  +     bound <- as.C_bound(cones)
  + 
  +     lc <- L_constraint(L = rbind(A, G), dir=rep("==", length(c(b, h))), rhs = c(b, h))
  +     x <- OP(objective = obj, constraints = lc, types = rep("C", 6), bounds =  bound,
  +             maximum = FALSE)
  + 
  +     opt <- ROI_solve(x, solver=solver)
  +     check("CP-02@01", equal(sum(abs(opt$solution - c(sqrt(2), 1, 1, sqrt(2), 1, 1))), 0))
  + }
  > 
  > ## EXPP - Example - 1
  > ## min:  x + y + z
  > ## s.t.
  > ## y e^(x/y) <= z
  > ## y > 0
  > ## x := 1
  > ## y := 2
  > ## c(1, 2, 2*exp(1/2))
  > test_cp_03 <- function(solver) {
  +     obj <- c(1, 1, 1)
  +     A <- rbind(c(1, 0, 0),
  +                c(0, 1, 0))
  +     b <- c(1, 2)
  +     G <- diag(x=-1, 3)
  +     h <- rep(0, 3)
  +     cones <- list("free"=c(1, 2), "expp"=list(3:5))
  +     bound <- as.C_bound(cones)
  + 
  +     lc <- L_constraint(L = rbind(A, G), dir=rep("==", length(c(b, h))), rhs = c(b, h))
  +     x <- OP(objective = obj, constraints = lc, types = rep("C", 3),
  +             bounds =  bound, maximum = FALSE)
  + 
  +     opt <- ROI_solve(x, solver=solver)
  +     check("CP-03@01", equal(opt$solution , c(1, 2, 2*exp(1/2))))
  + }
  > 
  > ## EXPP - Example - 1
  > ## max:  x + y + z
  > ## s.t.
  > ## y e^(x/y) <= z
  > ## y > 0
  > ## y == 2
  > ## z == 2 * exp(1/2)
  > ## c(1, 2, 2*exp(1/2))
  > test_cp_04 <- function(solver) {
  +     obj <- c(1, 1, 1)
  +     A <- rbind(c(0, 1, 0),
  +                c(0, 0, 1))
  +     b <- c(2, 2*exp(1/2))
  +     G <- diag(x=-1, 3)
  +     h <- rep(0, 3)
  +     cones <- list("free"=c(1, 2), "expp"=list(3:5))
  +     bound <- as.C_bound(cones)
  + 
  +     lc <- L_constraint(L = rbind(A, G), dir=rep("==", length(c(b, h))), rhs = c(b, h))
  +     x <- OP(objective = obj, constraints = lc, types = rep("C", 3),
  +             bounds =  bound, maximum = TRUE)
  + 
  +     opt <- ROI_solve(x, solver=solver)
  +     check("CP-04@01", equal(opt$solution , c(1, 2, 2*exp(1/2))))
  + }
  > 
  > ## EXPP - Example - 3
  > ## max:  x + y + z
  > ## s.t.
  > ## y e^(x/y) <= z
  > ## y > 0
  > ## y == 1
  > ## z == exp(1)
  > ## c(1, 1, exp(1))
  > test_cp_05 <- function(solver) {
  +     obj <- c(1, 1, 1)
  +     A <- rbind(c(0, 1, 0),
  +                c(0, 0, 1))
  +     b <- c(1, exp(1))
  +     G <- diag(x=-1, 3)
  +     h <- rep(0, 3)
  +     cones <- list("free"=c(1, 2), "expp"=list(3:5))
  +     bound <- as.C_bound(cones)
  + 
  +     lc <- L_constraint(L = rbind(A, G), dir=rep("==", length(c(b, h))), rhs = c(b, h))
  +     x <- OP(objective = obj, constraints = lc, types = rep("C", 3),
  +             bounds =  bound, maximum = TRUE)
  + 
  +     opt <- ROI_solve(x, solver=solver)
  +     check("CP-05@01", equal(opt$solution , c(1, 1, exp(1))))
  + }
  > 
  > ## EXPD - Example - 1
  > ## min:  u + v + w
  > ## s.t.
  > ##      -u * e^(v/u) <= e * w; u < 0; v >= 0; w >= 0
  > ##      u == -1
  > ##      v ==  1
  > ##
  > ##      c(-1, 1, exp(-2))
  > test_cp_06 <- function(solver) {
  +     obj <- c(1, 1, 1)
  +     A <- rbind(c(1,  0, 0),
  +                c(0,  1, 0))
  +     b <- c(-1, 1)
  +     G <- diag(x=-1, 3)
  +     h <- rep(0, 3)
  +     cones <- list("free"=c(1, 2), "expd"=list(3:5))
  +     bound <- c(V_bound(li=1:3, lb=rep(-Inf, 3)), as.C_bound(cones))
  + 
  +     lc <- L_constraint(L = rbind(A, G), dir=rep("==", length(c(b, h))), rhs = c(b, h))
  +     x <- OP(objective = obj, constraints = lc, types = rep("C", 3),
  +             bounds =  bound, maximum = FALSE)
  + 
  +     opt <- ROI_solve(x, solver=solver)
  +     check("CP-06@01", equal(opt$solution , c(-1, 1, exp(-2))))
  + }
  > 
  > ## POWP - Example - 1
  > ## max:  x + y + z
  > ## s.t.
  > ##      x^a * y ^ (1-a) >= |z|
  > ##      x == 4
  > ##      y == 4
  > ##      a == 1/2
  > ##
  > ## c(4, 4, 4)
  > test_cp_07 <- function(solver) {
  +     obj <- c(1, 1, 1)
  +     A <- rbind(c(1, 0, 0),
  +                c(0, 1, 0))
  +     b <- c(4, 4)
  +     G <- diag(x=-1, 3)
  +     h <- rep(0, 3)
  +     cones <- list("free"=c(1, 2), "powp"=list(list(i=3:5, a=0.5)))
  +     bound <- as.C_bound(cones)
  + 
  +     lc <- L_constraint(L = rbind(A, G), dir=rep("==", length(c(b, h))), rhs = c(b, h))
  +     x <- OP(objective = obj, constraints = lc, types = rep("C", 3),
  +             bounds =  bound, maximum = TRUE)
  + 
  +     opt <- ROI_solve(x, solver=solver)
  +     check("CP-07@01", equal(opt$solution, c(4, 4, 4)))
  +     check("CP-07@02", equal(opt$objval, 12 ))
  + }
  > 
  > ## POWD - Example - 1
  > ## min:  u + v + w
  > ## s.t.
  > ##      (u/a)^a * ( v/(1-a) )^(1-a) >= |w|
  > ##      u == 2
  > ##      v == 2
  > ##      a == 1/2
  > ##
  > ## c(2, 2, 4)
  > test_cp_08 <- function(solver) {
  +     obj <- c(1, 1, 1)
  +     A <- rbind(c(1, 0, 0),
  +                c(0, 1, 0))
  +     b <- c(2, 2)
  +     G <- diag(x=-1, 3)
  +     h <- rep(0, 3)
  +     cones <- list("free"=c(1, 2), "powd"=list(list(i=3:5, a=0.5)))
  +     bound <- as.C_bound(cones)
  + 
  +     lc <- L_constraint(L = rbind(A, G), 
  +                        dir=rep("==", length(c(b, h))), 
  +                        rhs = c(b, h))
  +     x <- OP(objective = obj, constraints = lc, 
  +             types = rep("C", 3), bounds =  bound,
  +             maximum = TRUE)
  + 
  +     opt <- ROI_solve(x, solver=solver)
  +     check("CP-08@01", equal(opt$solution, c(2, 2, 4)))
  + }
  > 
  > ## The following example is from the cvxopt documentation and released under GPL-3
  > ## (c) 2016-2016 Florian Schwendinger
  > ## (c) 2012-2015 M. Andersen and L. Vandenberghe.
  > ## CVXOPT is free software; you can redistribute it and/or modify it under the terms of the 
  > ## GNU General Public License as published by the Free Software Foundation; 
  > ## either version 3 of the License, or (at your option) any later version.
  > 
  > ## SDP - Example - 1
  > ## for the example definition see ROI.plugin.scs inst/doc
  > ## or http://cvxopt.org/userguide/coneprog.html
  > test_cp_09 <- function(solver) {
  +     ## this function or something similar should go into ROI
  +     obj <- c(1, -1, 1)
  +     A1 <- matrix(c(-7, -11, -11,  3), 2)
  +     A2 <- matrix(c( 7, -18, -18,  8), 2)
  +     A3 <- matrix(c(-2,  -8,  -8,  1), 2)
  +     a  <- matrix(c(33,  -9,  -9, 26), 2)
  +     B1 <- matrix(c(-21, -11,  0, -11,  10,   8,  0,    8, 5), 3)
  +     B2 <- matrix(c(  0,  10,  16, 10, -10, -10,  16, -10, 3), 3)
  +     B3 <- matrix(c( -5,   2, -17,  2,  -6,   8, -17,   8, 6), 3)
  +     b  <- matrix(c( 14,   9,  40,  9,  91,  10,  40,  10,15), 3)
  + 
  +     ## PSD matrices have to be vectorized
  +     G1 <- vech(A1, A2, A3)
  +     h1 <- vech(a)
  +     G2 <- vech(B1, B2, B3)
  +     h2 <- vech(b)
  +     h <- c(h1, h2)
  +     bounds <- c(V_bound(li=1:3, lb=rep(-Inf, 3)), 
  +                 C_bound(1:3, type="psd"), C_bound(3+1:6, type="psd"))
  + 
  +     x <- OP(objective = obj,
  +             constraints = L_constraint(L = rbind(G1, G2), dir=rep("==", length(h)), rhs = h),
  +             types = rep("C", length(obj)),
  +             bounds =  bounds,
  +             maximum = FALSE)
  + 
  +     opt <- ROI_solve(x, solver = solver)  
  +     
  +     ## NOTE: The solutions I compare with are from cvxopt where I used the default settings,
  +     ##       therefore it is possible that scs just provides a solution with a smaler eps
  +     sol <- c(-0.367666090041563, 1.89832827158511, -0.887550426343585)
  +     check("CP-09@01", isTRUE(c(obj %*% solution(opt)) <= c(obj %*% sol)))
  +     
  +     ## solution from cvxopt
  +     ## [-3.68e-01 1.90e+00 -8.88e-01]
  +     ## or c(-0.367666090041563, 1.89832827158511, -0.887550426343585)
  +     check("CP-09@02", isTRUE(sum(abs(solution(opt) - sol)) < 1e-3))
  + 
  +     ## [ 3.96e-03 -4.34e-03]
  +     ## [-4.34e-03  4.75e-03]
  +     ## c(0.00396107103000518, -0.00433836779348354, -0.00433836779348354,  0.00475162592559036) 
  +     sol_psd_1 <- c( 0.00396107103000518, -0.00433836779348354, 
  +                    -0.00433836779348354,  0.00475162592559036)
  + 
  +     opt_sol_psd_1 <- as.numeric(as.matrix(solution(opt, "psd")[[1]]))
  +     check("CP-09@03", isTRUE(sum(abs(opt_sol_psd_1 - sol_psd_1)) < 1e-5))
  +     
  +     ## [ 5.58e-02 -2.41e-03  2.42e-02]
  +     ## [-2.41e-03  1.04e-04 -1.05e-03]
  +     ## [ 2.42e-02 -1.05e-03  1.05e-02]
  +     ## c(0.0558011514407859, -0.00240909203896524, 0.0242146296992217,  -0.00240909203896524, 
  +     ##   0.000104021271556218, -0.00104543254168053,  0.0242146296992217, -0.00104543254168053, 
  +     ##   0.0105078600239678) 
  +     sol_psd_2 <- c( 0.0558011514407859, -0.00240909203896524,   0.0242146296992217,  
  +                    -0.00240909203896524, 0.000104021271556218, -0.00104543254168053,  
  +                     0.0242146296992217, -0.00104543254168053,   0.0105078600239678)
  +     opt_sol_psd_2 <- as.numeric(as.matrix(solution(opt, "psd")[[2]]))
  +     check("CP-09@04", isTRUE(sum(abs(opt_sol_psd_2 - sol_psd_2)) < 1e-5))
  + }
  > 
  > 
  > if ( !any("scs" %in% names(ROI_registered_solvers())) ) {
  +     ## This should never happen.
  +     cat("ROI.plugin.scs cloud not be found among the registered solvers.\n")
  + } else {
  +     print("Start Testing!")
  +     local({test_cp_01("scs")})
  +     local({test_cp_02("scs")})
  +     local({test_cp_03("scs")})
  +     local({test_cp_04("scs")})
  +     local({test_cp_05("scs")})
  +     local({test_cp_06("scs")})
  +     local({test_cp_07("scs")})
  +     local({test_cp_08("scs")})
  +     local({test_cp_09("scs")})
  + }
  [1] "Start Testing!"
  
   *** caught segfault ***
  address 0, cause 'memory not mapped'
  
  Traceback:
   1: .Call("scsr", data, cone, control, PACKAGE = "scs")
   2: (function (A, b, obj, cone, control = list(max_iters = 2500L,     normalize = TRUE, verbose = FALSE, cg_rate = 2, scale = 5,     rho_x = 0.001, alpha = 1.5, eps = 1e-06)) {    if (class(A) == "simple_triplet_matrix") {        A <- sparseMatrix(i = A$i, j = A$j, x = A$v, dims = c(A$nrow,             A$ncol))    }    else {        A <- as(A, "dgCMatrix")    }    data <- list(m = dim(A)[1], n = dim(A)[2], Ax = A@x, Ai = A@i,         Ap = A@p, b = b, c = obj)    ret <- .Call("scsr", data, cone, control, PACKAGE = "scs")    return(ret)})(A = list(i = c(1L, 2L, 3L, 4L, 5L, 7L, 8L, 9L, 1L, 2L, 3L, 5L, 6L, 7L, 8L, 9L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L), j = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L), v = c(-7, -15.556349186104, 3, -21, -15.556349186104, 10, 11.3137084989848, 5, 7, -25.4558441227157, 8, 14.142135623731, 22.6274169979695, -10, -14.142135623731, 3, -2, -11.3137084989848, 1, -5, 2.82842712474619, -24.0416305603426, -6, 11.3137084989848, 6), nrow = 9L, ncol = 3L, dimnames = NULL),     b = c(33, -12.7279220613579, 26, 14, 12.7279220613579, 56.5685424949238,     91, 14.142135623731, 15), obj = c(1, -1, 1), cone = list(        s = 2:3), control = list(verbose = FALSE, eps = 1e-06))
   3: eval(expr, envir, enclos)
   4: eval(solver_call)
   5: SOLVE(x, ROI_translate(control, solver))
   6: ROI_solve(x, solver = solver)
   7: test_cp_09("scs")
   8: eval(expr, envir, enclos)
   9: eval(quote({    test_cp_09("scs")}), new.env())
  10: eval(expr, envir, enclos)
  11: eval(expr, p)
  12: eval.parent(substitute(eval(quote(expr), envir)))
  13: local({    test_cp_09("scs")})
  An irrecoverable exception occurred. R is aborting now ...