-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from bnaras/bodono_v3.2.3_tinytest
Bodono v3.2.3 tinytest
- Loading branch information
Showing
64 changed files
with
2,031 additions
and
517 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.Rhistory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
Package: scs | ||
Version: 3.0-1 | ||
Version: 3.2.3 | ||
Title: Splitting Conic Solver | ||
Authors@R: c( person("Florian", "Schwendinger", role = c("aut", "cre"), email = "[email protected]"), | ||
person("Brendan", "O'Donoghue", role = c("aut", "cph")), | ||
|
@@ -14,8 +14,9 @@ Description: Solves convex cone programs via operator splitting. Can solve: | |
Depends: R (>= 3.5.0) | ||
SystemRequirements: GNU Make | ||
Suggests: | ||
Matrix, | ||
slam, | ||
testthat | ||
tinytest | ||
Encoding: UTF-8 | ||
License: GPL-3 | ||
URL: https://github.com/FlorianSchwendinger/scs | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
## Saved Results from scs 3.2.3 Tests | ||
|
||
These test problems and expected results were saved from `scs` source | ||
(`C`) test files using | ||
[RInside](https://cran.r-project.org/package=RInside). |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
## A simple example" | ||
|
||
A <- matrix(c(1), 2, 1) | ||
b <- c(1,1) | ||
c <- c(1) | ||
cone <- list(z = 2) | ||
params <- list(eps_abs = 1e-3, eps_rel = 1e-3, max_iters = 50) | ||
sol <- scs(A = A, b = b, obj = c, cone = cone, control = params) | ||
|
||
expect_equal(sol$info$status, "solved") | ||
expect_equal(sol$x, 1, tolerance = 1e-7) | ||
expect_equal(sol$y, c(-0.5, -0.5), tolerance = 1e-7) | ||
expect_equal(sol$info$pobj, 1, tolerance = 1e-7) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
## "Saved Problems" | ||
|
||
rds_files <- c( | ||
"degenerate1.RDS", | ||
"degenerate2.RDS", | ||
"degenerate3.RDS", | ||
"degenerate4.RDS", | ||
"hs21_tiny_qp1.RDS", | ||
"hs21_tiny_qp2.RDS", | ||
"infeasible_tiny_qp.RDS", | ||
"max_ent.RDS", | ||
"qafiro_tiny_qp1.RDS", | ||
"qafiro_tiny_qp2.RDS", | ||
"qafiro_tiny_qp3.RDS", | ||
"random_prob.RDS", | ||
"rob_gauss_cov_est.RDS", | ||
"small_lp.RDS", | ||
"small_qp1.RDS", | ||
"unbounded_tiny_qp.RDS" | ||
) | ||
|
||
info_vars_to_check <- c( | ||
"iter", | ||
"status", | ||
"status_val", | ||
"scale_updates", | ||
"pobj", | ||
"dobj", | ||
## "res_pri", | ||
## "res_dual", | ||
## "gap", | ||
## "res_infeas", | ||
"res_unbdd_a", | ||
"res_unbdd_p", | ||
## "setup_time", | ||
## "solve_time", | ||
"scale", | ||
## "comp_slack", | ||
"rejected_accel_steps", | ||
"accepted_accel_steps" | ||
## "lin_sys_time", | ||
## "cone_time", | ||
## "accel_time" | ||
) | ||
|
||
sol_vars_to_check <- c("x", "y", "s") | ||
|
||
for (fname in rds_files) { | ||
d <- readRDS(file.path("problem_results", fname)) | ||
sol <- scs(A = d$data$A, P = d$data$P, b = d$data$b, obj = d$data$obj, cone = d$cone, control = d$settings) | ||
expect_equal(sol$info[info_vars_to_check], d$sol$info[info_vars_to_check], tolerance = d$settings$eps_abs) | ||
expect_equal(sol[sol_vars_to_check], d$sol[sol_vars_to_check], tolerance = d$settings$eps_abs) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
## Simple PSD Test | ||
|
||
A <- simple_triplet_matrix( | ||
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) | ||
|
||
rhs <- c(33, -12.7279220613579, 26, 14, 12.7279220613579, 56.5685424949238, 91, 14.142135623731, 15) | ||
obj <- c(1, -1, 1) | ||
cone <- list(z = 0L, l = 0L, s = c(2, 3)) | ||
|
||
sol <- scs(A = A, b = rhs, obj = obj, cone = cone, control = list(verbose = 1)) | ||
expect_equal(sol$info$status, "solved") | ||
expect_equal(sol$x, | ||
c(-0.36778629730617, 1.89834935806707, -0.88746074956525), | ||
tolerance = 1e-4) | ||
expect_equal(sol$y, | ||
c(0.00396134156379081, -0.00613634113889057, 0.00475276897567086, 0.0558030988006113, | ||
-0.00340904764830297, 0.0342440719001259, 0.000104130479854425, -0.00147926212203912, | ||
0.0105070907711366), | ||
tolerance = 1e-4) | ||
expect_equal(sol$info$pobj, -3.1535964049385, tolerance = 1e-4) | ||
expect_equal(sol$info$dobj, -3.1535519733301, tolerance = 1e-4) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
## A Random LP Problem | ||
|
||
set.seed(1) | ||
m <- 100 | ||
n <- 100 | ||
A <- matrix(rnorm(m * n), m, n) | ||
b <- rnorm(m) | ||
c <- rnorm(n) | ||
cone <- list(z = m) | ||
params <- list(eps_rel = 1e-4, eps_abs = 1e-4, max_iters = 5000) | ||
sol <- scs(A = A, b = b, obj = c, cone = cone, control = params) | ||
expect_equal(sol$info$status, "solved") | ||
expect_equal(sol$info$pobj, 13.5089, tolerance = 1e-4) | ||
expect_equal(sol$info$dobj, 13.5089, tolerance = 1e-4) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
## SOCP Test | ||
|
||
A <- simple_triplet_matrix(i = 1:4, j = c(1L, 1L, 2L, 3L), v = c(1, -1, -1, -1), nrow = 4L, ncol = 3L) | ||
rhs <- c(1.4142135623731, 0, 0, 0) | ||
obj <- c(1, 1, 1) | ||
cone <- list(z = 1L, l = 0L, q = 3L) | ||
|
||
sol <- scs(A = A, b = rhs, obj = obj, cone = cone) | ||
expect_equal(sol$info$status, "solved") | ||
expect_equal(sol$x, c(sqrt(2), -1, -1), tolerance = 1e-7) | ||
expect_equal(sol$info$pobj, -0.5857864, tolerance = 1e-5) | ||
expect_equal(sol$info$dobj, -0.5857864, tolerance = 1e-5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
## Some tests for utils | ||
|
||
s <- Matrix::sparseMatrix(i = c(2,4,3:5), j= c(4,7:5,5), x = 1:5, dims = c(7,7), symmetric = TRUE) | ||
|
||
## Test that make_csc_sym_matrix works on plain matrices | ||
|
||
ms <- as.matrix(s) | ||
cm <- scs:::make_csc_symm_matrix.matrix(ms) | ||
s2 <- Matrix::sparseMatrix(i = cm[["matind"]], p = cm[["matbeg"]], x = cm[["values"]], | ||
symmetric = TRUE, index1 = FALSE) | ||
|
||
expect_equal(s, s2) | ||
|
||
|
||
## Test that make_csc_sym_matrix works on simple triplet matrices | ||
|
||
ts <- as(s, "dgTMatrix") | ||
sl <- slam::simple_triplet_matrix(i = ts@i, j = ts@j, v = ts@x, nrow = 7, ncol = 7) | ||
|
||
tm <- scs:::make_csc_symm_matrix.simple_triplet_matrix(sl) | ||
s3 <- Matrix::sparseMatrix(i = tm[["matind"]], p = tm[["matbeg"]], x = tm[["values"]], dims = c(7, 7), | ||
symmetric = TRUE, index1 = FALSE) | ||
expect_equal(s, s3) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
## A tiny test | ||
|
||
sol <- scs(A = matrix(c(0.5, 2), 2, 1), b = c(3, 1), obj = 1, | ||
cone = list(l = 2), control = list(max_iters = 5000)) | ||
expect_equal(sol$info$status, "unbounded") | ||
expect_equal(sol$info$pobj, -Inf) | ||
expect_equal(sol$info$dobj, -Inf) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
## Summary of modifications | ||
|
||
These modifications are against scs 3.0 (3aaa93c7aa04c7001df5e51b81f21b126dfa99b3). | ||
These modifications are against [scs@fa32d87](https://github.com/cvxgrp/scs). | ||
|
||
1. In `rw.c`, all the `fread` calls were checked for returned `bytes` | ||
to avoid compilation warnings. Routines affected are | ||
`read_scs_cone`, `read_scs_stgs`, `read_amatrix`, `read_scs_data`, | ||
`SCS`. | ||
`SCS`. This was done by adding two macros `FREAD` and `FWRITE` and | ||
globally replacing `fread` with `FREAD` and `fwrite` with | ||
`FWRITE`, except for line 144. | ||
|
||
2. In `scs.mk` added a solaris check to ensure it compiles using | ||
Oracle developer studio or GNU tools. This is for CRAN. | ||
|
||
|
||
2. Remove all SOLARIS patches as the platform is no longer supported. |
Oops, something went wrong.