Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
267a641
initial commit with the new osqp solver concept
danston May 31, 2021
8334712
fixed num_cols issue + added clear function for multiple use
danston Jun 8, 2021
f99d0c3
Improvements and fixes for OSQP_quadratic_program_traits
MaelRL Jun 10, 2021
668bd2d
Add clear() and resize() to OSQP traits
MaelRL Jun 10, 2021
a94890d
update osqp
danston Jun 10, 2021
04ce897
added try catch in osqp
danston Jun 10, 2021
caba087
fixed osqp example
danston Jun 10, 2021
25a08a2
fixed warnings
danston Jun 10, 2021
55bcd98
Tiny size_type change
MaelRL Jun 10, 2021
6780f86
fixed resize method
danston Jun 11, 2021
8bd23ba
fixed verbose
danston Jun 11, 2021
a34d898
Merge remote-tracking branch 'refs/remotes/origin/Solvers-add_osqp-da…
danston Jun 11, 2021
0a0c92d
changed FT to double because it fails with exact types
danston Jun 11, 2021
ff0734d
fixed private section
danston Jun 11, 2021
f865eaa
updated docs and fixed concepts
danston Jun 11, 2021
b905482
fixed typos
danston Jun 11, 2021
bed3189
andreas review
danston Jun 14, 2021
94b7580
Merge branch 'master' into Solvers-add_osqp-danston
danston Jun 18, 2021
76d1432
removed trailing whitespaces
danston Jun 18, 2021
3b905bb
fixed typo
danston Jun 18, 2021
e102b0f
added note about c_float type
danston Jun 24, 2021
0f6fa73
fixed typo
danston Jun 28, 2021
20e02ec
removed tmp modifs
danston Jun 29, 2021
f6c6c2e
updated changes.md
danston Jul 1, 2021
f7a69d5
fixed warning for using precond >= 0 for size_t
danston Jul 8, 2021
5e17827
fixed windows warnings and errors using unique ptrs
danston Jul 16, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions Documentation/doc/Documentation/Third_party.txt
Original file line number Diff line number Diff line change
Expand Up @@ -297,24 +297,27 @@ If you experience such an issue, we recommand to compile \ceres without `glog` s

\glpk (GNU Linear Programming Kit) is a library for solving linear programming (LP), mixed integer programming (MIP), and other related problems.

In \cgal, \glpk provides an optional linear integer program solver
in the \ref PkgPolygonalSurfaceReconstruction package. In order to use
\glpk in \cgal programs, the executables should be linked with the
CMake imported target `CGAL::GLPK_support` provided in
`CGAL_GLPK_support.cmake`.
In \cgal, \glpk provides an optional linear integer program solver in the \ref PkgPolygonalSurfaceReconstruction package.
In order to use \glpk in \cgal programs, the executables should be linked with the CMake imported target `CGAL::GLPK_support` provided in `CGAL_GLPK_support.cmake`.

The \glpk web site is <A HREF="https://www.gnu.org/software/glpk/">`https://www.gnu.org/software/glpk/`</A>.

\subsection thirdpartySCIP SCIP

\scip (Solving Constraint Integer Programs) is currently one of the fastest open source solvers for mixed integer programming (MIP) and mixed integer nonlinear programming (MINLP).

In \cgal, \scip provides an optional linear integer program solver
in the \ref PkgPolygonalSurfaceReconstruction package. In order to use
\scip in \cgal programs, the executables should be linked with the
CMake imported target `CGAL::SCIP_support` provided in
`CGAL_SCIP_support.cmake`.
In \cgal, \scip provides an optional linear integer program solver in the \ref PkgPolygonalSurfaceReconstruction package.
In order to use \scip in \cgal programs, the executables should be linked with the CMake imported target `CGAL::SCIP_support` provided in `CGAL_SCIP_support.cmake`.

The \scip web site is <A HREF="http://scip.zib.de/">`http://scip.zib.de/`</A>.

\subsection thirdpartyOSQP OSQP

\osqp (Operator Splitting Quadratic Program) is currently one of the fastest open source solvers for convex Quadratic Programs (QP).

In \cgal, \osqp provides an optional solver for the QP problems often arising in various computational geometry algorithms.
In order to use \osqp in \cgal programs, the executables should be linked with the CMake imported target `CGAL::OSQP_support` provided in `CGAL_OSQP_support.cmake`.

The \osqp web site is <A HREF="https://osqp.org">`https://osqp.org`</A>.

*/
1 change: 1 addition & 0 deletions Documentation/doc/resources/1.8.13/BaseDoxyfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ ALIASES = "cgal=%CGAL" \
"ceres=Ceres" \
"glpk=GLPK" \
"scip=SCIP" \
"osqp=OSQP" \
"rs=RS" \
"rs3=RS3" \
"unix=Unix" \
Expand Down
1 change: 1 addition & 0 deletions Documentation/doc/resources/1.8.14/BaseDoxyfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ ALIASES = "cgal=%CGAL" \
"ceres=Ceres" \
"glpk=GLPK" \
"scip=SCIP" \
"osqp=OSQP" \
"rs=RS" \
"rs3=RS3" \
"unix=Unix" \
Expand Down
1 change: 1 addition & 0 deletions Documentation/doc/resources/1.8.20/BaseDoxyfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ ALIASES = "cgal=%CGAL" \
"ceres=Ceres" \
"glpk=GLPK" \
"scip=SCIP" \
"osqp=OSQP" \
"rs=RS" \
"rs3=RS3" \
"unix=Unix" \
Expand Down
1 change: 1 addition & 0 deletions Documentation/doc/resources/1.8.4/BaseDoxyfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ ALIASES += "zlib=zlib"
ALIASES += "ceres=Ceres"
ALIASES += "glpk=GLPK"
ALIASES += "scip=SCIP"
ALIASES += "osqp=OSQP"
ALIASES += "rs=RS"
ALIASES += "rs3=RS3"
ALIASES += "unix=Unix"
Expand Down
5 changes: 5 additions & 0 deletions Installation/CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Release History
===============

### [CGAL and Solvers](https://doc.cgal.org/5.4/Manual/packages.html#PkgSolverInterface)

- Added the [OSQP solver](https://osqp.org/) support. This solver enables to efficiently compute the convex Quadratic Programming (QP) problems arising in the context of several packages.


[Release 5.3](https://github.com/CGAL/cgal/releases/tag/v5.3)
-----------

Expand Down
7 changes: 7 additions & 0 deletions Installation/cmake/modules/CGAL_OSQP_support.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
if(OSQP_FOUND AND NOT TARGET CGAL::OSQP_support)
add_library(CGAL::OSQP_support INTERFACE IMPORTED)
set_target_properties(CGAL::OSQP_support PROPERTIES
INTERFACE_COMPILE_DEFINITIONS "CGAL_USE_OSQP"
INTERFACE_INCLUDE_DIRECTORIES "${OSQP_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES "${OSQP_LIBRARIES}")
endif()
23 changes: 23 additions & 0 deletions Installation/cmake/modules/FindOSQP.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# This file sets up OSQP for CMake. Once done this will define
# OSQP_FOUND - system has OSQP lib
# OSQP_INCLUDE_DIR - the OSQP include directory
# OSQP_LIBRARIES - link these to use OSQP

if(NOT OSQP_FOUND)
find_path(OSQP_INCLUDE_DIR
NAMES osqp.h
PATHS /usr/local/include/osqp/
ENV OSQP_INC_DIR)

find_library(OSQP_LIBRARIES
NAMES libosqp osqp
PATHS ENV LD_LIBRARY_PATH
ENV LIBRARY_PATH
/usr/local/lib
${OSQP_INCLUDE_DIR}/../lib
ENV OSQP_LIB_DIR)

if(OSQP_LIBRARIES AND OSQP_INCLUDE_DIR)
set(OSQP_FOUND TRUE)
endif()
endif()
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
/*!
\ingroup PkgSolverInterfaceConcepts
\cgalConcept

A concept that describes the set of methods used to define and solve a
linear programming (`lp`) problem of the general form:
<center>
\f{eqnarray*}{
& \mbox{minimize} & \mathbf{q}^{T}\mathbf{x} + r \\
& \mbox{subject to} & \mathbf{l} \leq A\mathbf{x} \leq \mathbf{u}
\f}
</center>
in \f$ n \f$ real variables \f$ \mathbf{x} = (x_0, \ldots, x_{n-1}) \f$ and \f$ m \f$ constraints.

Here,
<UL>
<LI>\f$ \mathbf{q} \f$ is an \f$ n \f$-dimensional vector (the linear objective function),
<LI>\f$ r \f$ is a constant,
<LI>\f$ A \f$ is an \f$ m\times n\f$ matrix (the constraint matrix),
<LI>\f$ \mathbf{l} \f$ is an \f$ m \f$-dimensional vector of lower constraint bounds,
where \f$ l_i \in \mathbb{R} \cup \{-\infty\} \f$ for all \f$ i \f$,
<LI>\f$ \mathbf{u} \f$ is an \f$ m \f$-dimensional vector of upper constraint bounds,
where \f$ u_i \in \mathbb{R} \cup \{+\infty\} \f$ for all \f$ i \f$.
</UL>
*/
class LinearProgramTraits {

public:

/// \name Memory
/// @{

/*!
Allocates memory for `n` variables and `m` constraints in `lp`.
*/
void resize(const std::size_t n, const std::size_t m) { }

/// @}

/// \name Initialization
/// @{

/*!
Sets the entry `qi` of `lp` to `value`.
*/
void set_q(const std::size_t i, const FT value) { }

/*!
Sets the entry `r` of `lp` to `value`.
*/
void set_r(const FT value) { }

/*!
Sets the entry `Aij` in the row `i` and column `j` of
the constraint matrix `A` of `lp` to `value`.
*/
void set_A(const std::size_t i, const std::size_t j, const FT value) { }

/*!
Sets the entry `li` of `lp` to `value`.
*/
void set_l(const std::size_t i, const FT value) { }

/*!
Sets the entry `ui` of `lp` to `value`.
*/
void set_u(const std::size_t i, const FT value) { }

/// @}

/// \name Solution
/// @{

/*!
\brief solves the linear program.

Number of values in `solution` equals to the number `n` of values in the vector `x`.

\tparam OutIterator
a model of `OutputIterator` that accepts values of type `FieldNumberType`

\param solution
an output iterator with the solution

\returns a status of the computation `success == true`
*/
template<typename OutIterator>
bool solve(OutIterator solution) { }

/// @}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
/*!
\ingroup PkgSolverInterfaceConcepts
\cgalConcept

A concept that describes the set of methods used to define and solve a
quadratic programming (`qp`) problem of the general form:
<center>
\f{eqnarray*}{
& \mbox{minimize} & \frac{1}{2}\mathbf{x}^{T}P\mathbf{x} + \mathbf{q}^{T}\mathbf{x} + r \\
& \mbox{subject to} & \mathbf{l} \leq A\mathbf{x} \leq \mathbf{u}
\f}
</center>
in \f$ n \f$ real variables \f$ \mathbf{x} = (x_0, \ldots, x_{n-1}) \f$ and \f$ m \f$ constraints.

Here,
<UL>
<LI>\f$ P \f$ is a symmetric positive-semidefinite \f$ n \times n\f$ matrix (the quadratic objective function),
<LI>\f$ \mathbf{q} \f$ is an \f$ n \f$-dimensional vector (the linear objective function),
<LI>\f$ r \f$ is a constant,
<LI>\f$ A \f$ is an \f$ m\times n\f$ matrix (the constraint matrix),
<LI>\f$ \mathbf{l} \f$ is an \f$ m \f$-dimensional vector of lower constraint bounds,
where \f$ l_i \in \mathbb{R} \cup \{-\infty\} \f$ for all \f$ i \f$,
<LI>\f$ \mathbf{u} \f$ is an \f$ m \f$-dimensional vector of upper constraint bounds,
where \f$ u_i \in \mathbb{R} \cup \{+\infty\} \f$ for all \f$ i \f$.
</UL>

\cgalHasModel
`CGAL::OSQP_quadratic_program_traits<T>`
*/
class QuadraticProgramTraits {

public:

/// \name Memory
/// @{

/*!
Allocates memory for `n` variables and `m` constraints in `qp`.
*/
void resize(const std::size_t n, const std::size_t m) { }

/// @}

/// \name Initialization
/// @{

/*!
Sets the entries `Pij` and `Pji` of `qp` to `value`.
*/
void set_P(const std::size_t i, const std::size_t j, const FT value) { }

/*!
Sets the entry `qi` of `qp` to `value`.
*/
void set_q(const std::size_t i, const FT value) { }

/*!
Sets the entry `r` of `qp` to `value`.
*/
void set_r(const FT value) { }

/*!
Sets the entry `Aij` in the row `i` and column `j` of
the constraint matrix `A` of `qp` to `value`.
*/
void set_A(const std::size_t i, const std::size_t j, const FT value) { }

/*!
Sets the entry `li` of `qp` to `value`.
*/
void set_l(const std::size_t i, const FT value) { }

/*!
Sets the entry `ui` of `qp` to `value`.
*/
void set_u(const std::size_t i, const FT value) { }

/// @}

/// \name Solution
/// @{

/*!
\brief solves the quadratic program.

Number of values in `solution` equals to the number `n` of values in the vector `x`.

\tparam OutIterator
a model of `OutputIterator` that accepts values of type `FieldNumberType`

\param solution
an output iterator with the solution

\returns a status of the computation `success == true`
*/
template<typename OutIterator>
bool solve(OutIterator solution) { }

/// @}
};
51 changes: 37 additions & 14 deletions Solver_interface/doc/Solver_interface/PackageDescription.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,35 @@
/// \defgroup PkgSolverInterfaceRef CGAL and Solvers Reference
/*!
\defgroup PkgSolverInterfaceRef CGAL and Solvers Reference

/// \defgroup PkgSolverInterfaceConcepts Concepts
/// \ingroup PkgSolverInterfaceRef
///
\defgroup PkgSolverInterfaceConcepts Concepts
\ingroup PkgSolverInterfaceRef

Concepts that describe various solvers.

\defgroup PkgSolverInterfaceLS Linear Systems
\ingroup PkgSolverInterfaceRef

Classes to define and solve linear systems.

\defgroup PkgSolverInterfaceMIP Mixed Integer Programming
\ingroup PkgSolverInterfaceRef

Classes to define and solve mixed integer programs.

\defgroup PkgSolverInterfaceNLP Nonlinear Programming
\ingroup PkgSolverInterfaceRef

Classes to define and solve nonlinear programs.

/*!
\addtogroup PkgSolverInterfaceRef
\cgalPkgDescriptionBegin{CGAL and Solvers,PkgSolverInterface}
\cgalPkgDescriptionBegin{CGAL and Solvers, PkgSolverInterface}
\cgalPkgPicture{solver.png}
\cgalPkgSummaryBegin
\cgalPkgAuthors{Simon Giraudot, Pierre Alliez, Frédéric Cazals, Gaël Guennebaud, Bruno Lévy, Marc Pouget, Laurent Saboret, and Liangliang Nan}
\cgalPkgDesc{This package provides concepts and models for solving linear systems with dense or sparse matrices, Mixed Integer Programming (MIP) problems with or without constraints.}
\cgalPkgManuals{Chapter_CGAL_and_Solvers,PkgSolverInterfaceRef}
\cgalPkgDesc{This package provides concepts and models for solving linear systems with
dense or sparse matrices, mixed integer programming problems with or without constraints,
and nonlinear programming problems with or without constraints.}
\cgalPkgManuals{Chapter_CGAL_and_Solvers, PkgSolverInterfaceRef}
\cgalPkgSummaryEnd
\cgalPkgShortInfoBegin
\cgalPkgSince{4.8}
Expand All @@ -23,27 +41,32 @@
\cgalClassifedRefPages

\cgalCRPSection{Concepts}

- `DiagonalizeTraits`
- `NormalEquationSparseLinearAlgebraTraits_d`
- `SparseLinearAlgebraTraits_d`
- `SparseLinearAlgebraWithFactorTraits_d`
- `SvdTraits`
- `MixedIntegerProgramTraits`
- `LinearProgramTraits`
- `QuadraticProgramTraits`

\cgalCRPSection{Classes}

\cgalCRPSection{Linear Systems}
- `CGAL::Eigen_solver_traits`
- `CGAL::Eigen_diagonalize_traits`
- `CGAL::Eigen_vector`
- `CGAL::Eigen_matrix`
- `CGAL::Eigen_sparse_matrix`
- `CGAL::Eigen_sparse_symmetric_matrix`
- `CGAL::Eigen_svd`
- `CGAL::Mixed_integer_program_traits`
- `CGAL::GLPK_mixed_integer_program_traits`
- `CGAL::SCIP_mixed_integer_program_traits`

\cgalCRPSection{Mixed Integer Programming}
- `CGAL::Variable`
- `CGAL::Linear_constraint`
- `CGAL::Linear_objective`
- `CGAL::Mixed_integer_program_traits`
- `CGAL::GLPK_mixed_integer_program_traits`
- `CGAL::SCIP_mixed_integer_program_traits`

\cgalCRPSection{Nonlinear Programming}
- `CGAL::OSQP_quadratic_program_traits`
*/
Loading