Skip to content

Commit

Permalink
Pg/update osqp 0.6.0 (#11)
Browse files Browse the repository at this point in the history
* update submodule to 6.0

* update submodule to 6.0

* update to v0.6.0

* update to v0.6.0

* add files for CRAN make

* oldrel fails ok

* oldrel fails ok

* oldrel fails ok

* Update .travis.yml

* oldrel fails ok

* oldrel fails ok

* Fix typo

* Removed valgrind warning

* pass only triu(P)

* modified tolerances

* roxygen rebuild

* docs rebuild

* doc typo fixes

* filename change

* rename back
  • Loading branch information
goulart-paul authored Sep 4, 2019
1 parent fa67f38 commit 35ccaef
Show file tree
Hide file tree
Showing 15 changed files with 34 additions and 21 deletions.
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ osqp_sources/CMakeCache.txt$
osqp_sources/\.bumpversion.cfg$
^.*editorconfig$
^.*git$
^.*valgrind-suppress.supp$
cmake_uninstall.cmake$
cmake_install.cmake$
osqp-targets.cmake$
Expand All @@ -19,3 +20,4 @@ CMakeDirectoryInformation.cmake
libosqp.a
^appveyor\.yml$
^cran_comments\.md$
^CRAN-RELEASE$
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
language: r

r:
- release
- oldrel
Expand Down Expand Up @@ -40,3 +41,6 @@ matrix:
- os: osx
r: oldrel
disable_homebrew: false
allow_failures:
- r: oldrel
os: linux
8 changes: 4 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: osqp
Type: Package
Title: Quadratic Programming Solver using the 'OSQP' Library
Version: 0.5.0
Date: 2018-12-09
Version: 0.6.0
Date: 2019-09-02
Authors@R: c(person("Bartolomeo", "Stellato", email = "[email protected]", role = c("cre", "aut", "ctb", "cph")), person("Goran", "Banjac", role = c("aut", "ctb", "cph")), person("Paul", "Goulart", role = c("aut", "ctb", "cph")), person("Stephen", "Boyd", role = c("aut", "ctb", "cph")), person("Eric", "Anderson", role=c("ctb")))
Copyright: file COPYRIGHT
Description: Provides bindings to the 'OSQP' solver. The 'OSQP' solver is a numerical optimization package or solving convex quadratic programs written in 'C' and based on the alternating direction method of multipliers, 'ADMM'. B. Stellato, G. Banjac, P. Goulart, A. Bemporad, S. Boyd (2018) <arXiv:1711.08013>.
Expand All @@ -13,6 +13,6 @@ RoxygenNote: 6.1.1
Collate: 'RcppExports.R' 'osqp-package.R' 'solve.R' 'osqp.R'
'params.R'
NeedsCompilation: yes
Packaged: 2018-12-09 20:32:49 UTC
Date/Publication: 2018-12-09 13:10:50 UTC
Packaged: 2019-09-02 00:00:00 UTC
Date/Publication: 2019-09-02 00:00:00 UTC
Suggests: testthat
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export(osqp)
export(osqpSettings)
export(solve_osqp)
importFrom(Matrix,sparseMatrix)
importFrom(Matrix,triu)
importFrom(R6,R6Class)
importFrom(Rcpp,sourceCpp)
importFrom(methods,as)
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Version 0.6.0 (2 September 2019) OSQP 0.6.0

* Updated OSQP to version 0.6.0

# Version 0.5.0 (10 December 2018) OSQP 0.5.0

* Updated OSQP to version 0.5.0
Expand Down
10 changes: 6 additions & 4 deletions R/osqp.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
#' OSQP Solver object
#'
#' @importFrom Matrix sparseMatrix
#' @importFrom Matrix triu
#' @importFrom methods as
#' @importFrom R6 R6Class
#' @param P,A sparse matrices of class dgCMatrix or coercible into such, with P positive semidefinite.
#' @param q,l,u Numeric vectors, with possibly infinite elements in l and u
#' @param pars list with optimization parameters, conveniently set with the function
#' \code{\link{osqpSettings}}. For \code{osqpObject$UpdateSettings(newPars)} only a subset of the settings
#' can be updated once the problem has been initnialized.
#' can be updated once the problem has been initialized.
#' @seealso \code{\link{solve_osqp}}
#' @section Usage:
#' \preformatted{model = osqp(P=NULL, q=NULL, A=NULL, l=NULL, u=NULL, pars=osqpSettings())
Expand Down Expand Up @@ -76,10 +77,11 @@ osqp = function(P=NULL, q=NULL, A=NULL, l=NULL, u=NULL, pars = osqpSettings()) {
n = dim(P)[1]


if (is.null(P))
if (is.null(P)){
P = sparseMatrix(integer(), integer(), x = numeric(), dims = c(n, n))
else
P = as(P, "dgCMatrix")
} else {
P = triu(as(P, "dgCMatrix"))
}

if (is.null(q))
q = numeric(n)
Expand Down
3 changes: 1 addition & 2 deletions R/params.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#' @param delta regularization parameter for polish
#' @param polish boolean, polish ADMM solution
#' @param polish_refine_iter iterative refinement steps in polish
#' @param verbose boolean, write out progres
#' @param verbose boolean, write out progress
#' @param scaled_termination boolean, use scaled termination criteria
#' @param check_termination integer, check termination interval. If 0, termination checking is disabled
#' @param warm_start boolean, warm start
Expand Down Expand Up @@ -60,4 +60,3 @@ checkpar = function(l, r) {
return (r)
l
}

2 changes: 1 addition & 1 deletion R/solve.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#' s.t. \deqn{l_i < (A x)_i < u_i}{li < (A x)i < ui}
#' for real matrices P (nxn, positive semidefinite) and A (mxn) with m number of constraints
#' @param P,A sparse matrices of class dgCMatrix or coercible into such, with P positive semidefinite.
#' Only the upper triangular part of P will be used.
#' @param q,l,u Numeric vectors, with possibly infinite elements in l and u
#' @param pars list with optimization parameters, conveniently set with the function \code{osqpSettings}
#' @return A list with elements x (the primal solution), y (the dual solution), prim_inf_cert,
Expand Down Expand Up @@ -40,4 +41,3 @@ solve_osqp <- function(P=NULL, q=NULL, A=NULL, l=NULL, u=NULL, pars = osqpSettin
model = osqp(P, q, A, l, u, pars)
model$Solve()
}

2 changes: 1 addition & 1 deletion man/osqp.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/osqpSettings.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/solve_osqp.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/osqp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ OSQP_SOURCES = \
$(OSQP_SRC_DIR)/src/auxil.c \
$(OSQP_SRC_DIR)/src/cs.c \
$(OSQP_SRC_DIR)/src/ctrlc.c \
$(OSQP_SRC_DIR)/src/error.c \
$(OSQP_SRC_DIR)/src/kkt.c \
$(OSQP_SRC_DIR)/src/lin_alg.c \
$(OSQP_SRC_DIR)/src/lin_sys.c \
Expand Down
6 changes: 3 additions & 3 deletions src/osqp_solve_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ SEXP osqpSetup(const S4& P, const NumericVector& q, const S4& A, const NumericVe


IntegerVector dimP = P.slot("Dim");

IntegerVector dimA = A.slot("Dim");
int n = dimP[0];
int m = dimA[0];
Expand Down Expand Up @@ -55,9 +54,10 @@ SEXP osqpSetup(const S4& P, const NumericVector& q, const S4& A, const NumericVe
data->l = lvec.data();
data->u = uvec.data();

OSQPWorkspace* workp;
osqp_setup(&workp, data.get(), settings.get());

Rcpp::XPtr<OSQPWorkspace, Rcpp::PreserveStorage, mycleanup> work(osqp_setup(data.get(), settings.get()));

Rcpp::XPtr<OSQPWorkspace, Rcpp::PreserveStorage, mycleanup> work(workp);

return work;
}
Expand Down
2 changes: 1 addition & 1 deletion src/osqp_sources
Submodule osqp_sources updated from a02dc2 to 0baddd
5 changes: 2 additions & 3 deletions tests/testthat/test-solve-basic-qp.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ define_simple_qp <- function(){
l <- rep_len(-Inf, 5)

settings <- osqpSettings(verbose = FALSE,
eps_rel = 1e-09,
eps_abs = 1e-09)
eps_rel = 1e-05,
eps_abs = 1e-05)

# Create OSQP model
model <- osqp(P, q, A, l, u, settings)
Expand Down Expand Up @@ -82,4 +82,3 @@ test_that("Update bounds QP", {
-80.0890909023583, 1e-03)

})

0 comments on commit 35ccaef

Please sign in to comment.