Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop-0.6' into develop-1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
imciner2 committed Oct 14, 2019
2 parents fab90f8 + ffd5879 commit b72a2fe
Show file tree
Hide file tree
Showing 19 changed files with 167 additions and 29 deletions.
1 change: 1 addition & 0 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[bumpversion]
current_version = 0.6.0
commit = True
tag = True
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\.(?P<release>[a-z]+)(?P<dev>\d+))?
serialize =
{major}.{minor}.{patch}.{release}{dev}
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
Version 0.6.0
Version 0.6.0 (30 August 2019)
------------------------------
* Added meaningful return values to internal functions. Changed syntax of `osqp_setup` function. It now returns an exitflag.
* `osqp_setup` function requires `P` to be upper triangular. It returns a nonzero exitflag otherwise.
* Custom memory allocators via cmake and the configure file.
* Changed interfaces to linsys solver functions. The solve function now computes `(x_tilde,z_tilde)` instead of `(x_tilde,nu)`. This allows to implement custom linear system solvers (also indirect).
* Added `solve` function in Python interface that performs `setup` `solve` and `cleanup` for you directly and disables GIL.
* Improved code generation folder structure.


Version 0.5.0 (10 December 2018)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ minimize 0.5 x' P x + q' x
subject to l <= A x <= u
```

where `x in R^n` is the optimization variable. The objective function is defined by a positive semidefinite matrix `P in S^n_+` and vector `q in R^n`. The linear constraints are defined by matrix `A in R^{m x n}` and vectors `l in R^m U {-inf}^m`, `u in R^m U {+inf}^m`.
where `x in R^n` is the optimization variable. The objective function is defined by a positive semidefinite matrix `P in S^n_+` and vector `q in R^n`. The linear constraints are defined by matrix `A in R^{m x n}` and vectors `l` and `u` so that `l_i in R U {-inf}` and `u_i in R U {+inf}` for all `i in 1,...,m`.


The latest version is `0.6.0`.
Expand Down
28 changes: 28 additions & 0 deletions ci/travis/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,18 @@ cd build
cmake -G "Unix Makefiles" -DCOVERAGE=ON -DUNITTESTS=ON ..
make
${TRAVIS_BUILD_DIR}/build/out/osqp_tester
# Pefrorm code coverage (only in Linux case)
if [[ $TRAVIS_OS_NAME == "linux" ]]; then
cd ${TRAVIS_BUILD_DIR}/build
lcov --directory . --capture -o coverage.info # capture coverage info
lcov --remove coverage.info "${TRAVIS_BUILD_DIR}/tests/*" \
"${TRAVIS_BUILD_DIR}/lin_sys/direct/qdldl/amd/*" \
"${TRAVIS_BUILD_DIR}/lin_sys/direct/qdldl/qdldl_sources/*" \
"/usr/include/x86_64-linux-gnu/**/*" \
-o coverage.info # filter out tests and unnecessary files
lcov --list coverage.info # debug before upload
coveralls-lcov coverage.info # uploads to coveralls
fi

if [[ $TRAVIS_OS_NAME == "linux" ]]; then
echo "Testing OSQP with valgrind (disabling MKL pardiso for memory allocation issues)"
Expand Down Expand Up @@ -76,6 +88,22 @@ cd build
cmake -G "Unix Makefiles" -DEMBEDDED=2 ..
make

echo "Building OSQP without profiling"
cd ${TRAVIS_BUILD_DIR}
rm -rf build
mkdir build
cd build
cmake -G "Unix Makefiles" -DPROFILING=OFF ..
make

echo "Building OSQP without user interrupt"
cd ${TRAVIS_BUILD_DIR}
rm -rf build
mkdir build
cd build
cmake -G "Unix Makefiles" -DCTRLC=OFF ..
make

echo "Testing OSQP without printing"
cd ${TRAVIS_BUILD_DIR}
rm -rf build
Expand Down
3 changes: 2 additions & 1 deletion docs/_static/css/osqp_theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ p.breathe-sectiondef-title.rubric {


/* Margin below tables */
p {
table p {
margin-bottom: 0px;
}

23 changes: 13 additions & 10 deletions docs/citing/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,15 @@ If you use OSQP for published work, we encourage you to put a star on `GitHub <h
.. code:: latex

@article{osqp-infeasibility,
title = {Infeasibility detection in the alternating direction method of multipliers for convex optimization},
journal = {Journal of Optimization Theory and Applications (To appear)},
author = {Banjac, G. and Goulart, P. and Stellato, B. and Boyd, S.},
title = {Infeasibility detection in the alternating direction method of multipliers for convex optimization},
journal = {Journal of Optimization Theory and Applications},
year = {2019},
url = {https://stanford.edu/~boyd/papers/pdf/admm_infeas.pdf},
volume = {183},
number = {2},
pages = {490--519},
doi = {10.1007/s10957-019-01575-y},
url = {https://doi.org/10.1007/s10957-019-01575-y},
}

Code generation
Expand All @@ -46,11 +50,10 @@ If you use OSQP for published work, we encourage you to put a star on `GitHub <h
.. code:: latex

@inproceedings{osqp-codegen,
author = {Banjac, G. and Stellato, B. and Moehle, N. and Goulart, P. and Bemporad, A. and Boyd, S.},
title = {Embedded code generation using the {OSQP} solver},
booktitle = {{IEEE} Conference on Decision and Control ({CDC})},
year = {2017},
month = dec,
doi = {10.1109/CDC.2017.8263928},
url = {https://doi.org/10.1109/CDC.2017.8263928},
author = {Banjac, G. and Stellato, B. and Moehle, N. and Goulart, P. and Bemporad, A. and Boyd, S.},
title = {Embedded code generation using the {OSQP} solver},
booktitle = {IEEE Conference on Decision and Control (CDC)},
year = {2017},
doi = {10.1109/CDC.2017.8263928},
url = {https://doi.org/10.1109/CDC.2017.8263928},
}
26 changes: 26 additions & 0 deletions docs/examples/setup-and-solve.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,32 @@ Julia
R
-

.. code:: r
library(osqp)
library(Matrix)
# Define problem data
P <- Matrix(c(4., 1.,
1., 2.), 2, 2, sparse = TRUE)
q <- c(1., 1.)
A <- Matrix(c(1., 1., 0.,
1., 0., 1.), 3, 2, sparse = TRUE)
l <- c(1., 0., 0.)
u <- c(1., 0.7, 0.7)
# Change alpha parameter and setup workspace
settings <- osqpSettings(alpha = 1.0)
model <- osqp(P, q, A, l, u, settings)
# Solve problem
res <- model$Solve()
C
-

Expand Down
36 changes: 36 additions & 0 deletions docs/examples/update-matrices.rst
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,42 @@ Julia
R
-

.. code:: r
library(osqp)
library(Matrix)
# Define problem data
P <- Matrix(c(4., 1.,
1., 2.), 2, 2, sparse = TRUE)
q <- c(1., 1.)
A <- Matrix(c(1., 1., 0.,
1., 0., 1.), 3, 2, sparse = TRUE)
l <- c(1., 0., 0.)
u <- c(1., 0.7, 0.7)
# Setup workspace
model <- osqp(P, q, A, l, u)
# Solve problem
res <- model$Solve()
# Update problem
# NB: Update only upper triangular part of P
P_new <- Matrix(c(5., 1.5,
1.5, 1.), 2, 2, sparse = TRUE)
A_new <- Matrix(c(1.2, 1.5, 0.,
1.1, 0., 0.8), 3, 2, sparse = TRUE)
model$Update(Px = P_new@x, Ax = A_new@x)
# Solve updated problem
res <- model$Solve()
C
-

Expand Down
34 changes: 34 additions & 0 deletions docs/examples/update-vectors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,40 @@ Julia
R
-

.. code:: r
library(osqp)
library(Matrix)
# Define problem data
P <- Matrix(c(4., 1.,
1., 2.), 2, 2, sparse = TRUE)
q <- c(1., 1.)
A <- Matrix(c(1., 1., 0.,
1., 0., 1.), 3, 2, sparse = TRUE)
l <- c(1., 0., 0.)
u <- c(1., 0.7, 0.7)
# Setup workspace
model <- osqp(P, q, A, l, u)
# Solve problem
res <- model$Solve()
# Update problem
q_new <- c(2., 3.)
l_new <- c(2., -1., -1.)
u_new <- c(2., 2.5, 2.5)
model$Update(q = q_new, l = l_new, u = u_new)
# Solve updated problem
res <- model$Solve()
C
-

Expand Down
4 changes: 2 additions & 2 deletions docs/get_started/linear_system_solvers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ QDLDL
OSQP comes with `QDLDL <https://github.com/oxfordcontrol/qdldl>`_ internally installed.
It does not require any external shared library.
QDLDL is a sparse direct solver that works well for most small to medium sized problems.
However, its becomes not really efficient for large scale problems since it is not multi-threaded.
However, it becomes not really efficient for large scale problems since it is not multi-threaded.


MKL Pardiso
Expand Down Expand Up @@ -61,7 +61,7 @@ Install with Anaconda
^^^^^^^^^^^^^^^^^^^^^
`Anaconda Python distribution <https://www.anaconda.com/download/>`_ comes with the intel MKL libraries preinstalled including MKL Pardiso.
To use this version, the Anaconda libraries folders have to be in your system path.
Anaconda environments should add them automatically so in most cases you do not have do to anything. If you get an error where OSQP cannot find MKL, you can add the right path by adding the output from the following command to your path variable:
Anaconda environments should add them automatically so in most cases you do not have to do anything. If you get an error where OSQP cannot find MKL, you can add the right path by adding the output from the following command to your path variable:

.. code::
Expand Down
8 changes: 4 additions & 4 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
OSQP solver documentation
==========================
**Join our** `forum <https://groups.google.com/forum/#!forum/osqp>`_ **for any
**Join our** `forum <https://osqp.discourse.group/>`_ **for any
questions related to the solver!**

The OSQP (Operator Splitting Quadratic Program) solver is a numerical
Expand Down Expand Up @@ -70,11 +70,11 @@ OSQP is distributed under the `Apache 2.0 License <https://www.apache.org/licens
The following people have been involved in the development of OSQP:

* `Bartolomeo Stellato <https://stellato.io/>`_ (MIT): main development
* `Goran Banjac <http://people.ee.ethz.ch/~gbanjac/>`_ (ETH Zürich): main development
* `Nicholas Moehle <http://web.stanford.edu/~moehle/>`_ (Stanford University): methods, maths, and code generation
* `Goran Banjac <https://people.ee.ethz.ch/~gbanjac/>`_ (ETH Zürich): main development
* `Nicholas Moehle <https://www.nicholasmoehle.com/>`_ (Stanford University): methods, maths, and code generation
* `Paul Goulart <http://users.ox.ac.uk/~engs1373/>`_ (University of Oxford): methods, maths, and Matlab interface
* `Alberto Bemporad <http://cse.lab.imtlucca.it/~bemporad/>`_ (IMT Lucca): methods and maths
* `Stephen Boyd <http://web.stanford.edu/~boyd/>`_ (Stanford University): methods and maths
* `Stephen Boyd <https://web.stanford.edu/~boyd/>`_ (Stanford University): methods and maths

Interfaces development

Expand Down
4 changes: 2 additions & 2 deletions docs/parsers/jump.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
JuMP
=====

`JuMP <https://github.com/JuliaOpt/JuMP.jl>`_ supports the OSQP solver using the `MathProgBase interface <https://github.com/JuliaOpt/MathProgBase.jl>`_.
`JuMP <https://github.com/JuliaOpt/JuMP.jl>`_ supports the OSQP solver using the `MathOptInterface interface <https://github.com/JuliaOpt/MathOptInterface.jl>`_.
You can define a JuMP model to be solved via OSQP as follows


Expand All @@ -26,4 +26,4 @@ After defining your model, you can solve it by just calling
solve(model)
For more details on how to create and modify the models, see the `JuMP Documentation <https://github.com/JuliaOpt/JuMP.jl>`_.
For more details on how to create and modify the models, see the `JuMP Documentation <https://www.juliaopt.org/JuMP.jl/stable/>`_.
2 changes: 1 addition & 1 deletion docs/parsers/yalmip.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
YALMIP
======

`YALMIP <https://yalmip.github.io/download/>`_ support the OSQP solver. You can easily define problems in high-level format and then specify OSQP by simply setting
`YALMIP <https://yalmip.github.io/>`_ support the OSQP solver. You can easily define problems in high-level format and then specify OSQP by simply setting

.. code:: matlab
Expand Down
3 changes: 1 addition & 2 deletions docs/solver/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ where :math:`x\in\mathbf{R}^{n}` is the optimization variable.
The objective function is defined by a positive semidefinite matrix
:math:`P \in \mathbf{S}^{n}_{+}` and vector :math:`q\in \mathbf{R}^{n}`.
The linear constraints are defined by matrix :math:`A\in\mathbf{R}^{m \times n}`
and vectors :math:`l \in \mathbf{R}^{m} \cup \{-\infty\}^{m}`,
:math:`u \in \mathbf{R}^{m} \cup \{+\infty\}^{m}`.
and vectors :math:`l` and :math:`u` so that :math:`l_i \in \mathbf{R} \cup \{-\infty\}` and :math:`u_i \in \mathbf{R} \cup \{+\infty\}` for all :math:`i \in \{1,\ldots,m\}`.


Algorithm
Expand Down
2 changes: 1 addition & 1 deletion include/osqp_api_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ extern const char * OSQP_ERROR_MESSAGE[];
# endif /* ifndef OSQP_NAN */

# ifndef OSQP_INFTY
# define OSQP_INFTY ((c_float)1e20) // infinity
# define OSQP_INFTY ((c_float)1e30) // infinity
# endif /* ifndef OSQP_INFTY */


Expand Down
9 changes: 8 additions & 1 deletion lin_sys/direct/qdldl/qdldl_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,21 @@ static c_int LDL_factor(csc *A, qdldl_solver * p, c_int nvar){
if (sum_Lnz < 0){
// Error
#ifdef PRINTING
c_eprint("Error in KKT matrix LDL factorization when computing the elimination tree. A is not perfectly upper triangular");
c_eprint("Error in KKT matrix LDL factorization when computing the elimination tree.");
if(sum_Lnz == -1){
c_eprint("Matrix is not perfectly upper triangular.");
}
else if(sum_Lnz == -2){
c_eprint("Integer overflow in L nonzero count.");
}
#endif
return sum_Lnz;
}

// Allocate memory for Li and Lx
p->L->i = (c_int *)c_malloc(sizeof(c_int)*sum_Lnz);
p->L->x = (c_float *)c_malloc(sizeof(c_float)*sum_Lnz);
p->L->nzmax = sum_Lnz;

// Factor matrix
factor_status = QDLDL_factor(A->n, A->p, A->i, A->x,
Expand Down
2 changes: 1 addition & 1 deletion lin_sys/direct/qdldl/qdldl_sources
4 changes: 2 additions & 2 deletions src/auxil.c
Original file line number Diff line number Diff line change
Expand Up @@ -743,8 +743,8 @@ c_int check_termination(OSQPSolver *solver, c_int approximate) {
eps_dual_inf = settings->eps_dual_inf;

// If residuals are too large, the problem is probably non convex
if ((info->pri_res > 2 * OSQP_INFTY) ||
(info->dua_res > 2 * OSQP_INFTY)){
if ((info->pri_res > OSQP_INFTY) ||
(info->dua_res > OSQP_INFTY)){
// Looks like residuals are diverging. Probably the problem is non convex!
// Terminate and report it
update_status(info, OSQP_NON_CVX);
Expand Down
2 changes: 2 additions & 0 deletions src/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,10 @@ void print_setup_header(const OSQPSolver *solver) {
if (settings->polish) c_print("polish: on, ");
else c_print("polish: off, ");

# ifdef PROFILING
if (settings->time_limit) c_print("time_limit: %.2e sec\n", settings->time_limit);
else c_print("time_limit: off\n");
# endif /* ifdef PROFILING */

c_print("\n");
}
Expand Down

0 comments on commit b72a2fe

Please sign in to comment.