From f865eaaf351944252b5eba80157b38b00d9995ad Mon Sep 17 00:00:00 2001 From: Dmitry Anisimov Date: Fri, 11 Jun 2021 13:58:20 +0200 Subject: [PATCH] updated docs and fixed concepts --- .../Concepts/LinearProgramTraits.h | 43 ++++------------ .../Concepts/QuadraticProgramTraits.h | 51 +++++-------------- .../doc/Solver_interface/Solver_interface.txt | 2 +- .../CGAL/OSQP_quadratic_program_traits.h | 6 +-- 4 files changed, 27 insertions(+), 75 deletions(-) diff --git a/Solver_interface/doc/Solver_interface/Concepts/LinearProgramTraits.h b/Solver_interface/doc/Solver_interface/Concepts/LinearProgramTraits.h index 9d44b4a667f..49bc506ab92 100644 --- a/Solver_interface/doc/Solver_interface/Concepts/LinearProgramTraits.h +++ b/Solver_interface/doc/Solver_interface/Concepts/LinearProgramTraits.h @@ -3,7 +3,7 @@ \cgalConcept A concept that describes the set of methods used to define and solve a -linear programming (LP) problem of the general form: +linear programming (`lp`) problem of the general form:
\f{eqnarray*}{ & \mbox{minimize} & \mathbf{q}^{T}\mathbf{x} + r \\ @@ -31,24 +31,9 @@ public: /// @{ /*! - Allocates memory for `n` values in the vector `q`. + Allocates memory for `n` variables and `m` constraints in `lp`. */ - void reserve_q(const std::size_t n) { } - - /*! - Allocates memory for `k` non-zero values in the matrix `A`. - */ - void reserve_A(const std::size_t k) { } - - /*! - Allocates memory for `m` values in the vector `l`. - */ - void reserve_l(const std::size_t m) { } - - /*! - Allocates memory for `m` values in the vector `u`. - */ - void reserve_u(const std::size_t m) { } + void resize(const std::size_t n, const std::size_t m) { } /// @} @@ -56,35 +41,30 @@ public: /// @{ /*! - Sets the entry `qj` of `lp` to `value`. + Sets the entry `qi` of `lp` to `value`. */ - void set_q(const std::size_t j, const FT 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) - { } + 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) - { } + 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) - { } + 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) - { } + void set_u(const std::size_t i, const FT value) { } /// @} @@ -97,7 +77,7 @@ public: 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 `FT` + a model of `OutputIterator` that accepts values of type `FieldNumberType` \param solution an output iterator with the solution @@ -105,8 +85,7 @@ public: \returns a status of the computation `success == true` */ template - bool solve(OutIterator solution) - { } + bool solve(OutIterator solution) { } /// @} }; diff --git a/Solver_interface/doc/Solver_interface/Concepts/QuadraticProgramTraits.h b/Solver_interface/doc/Solver_interface/Concepts/QuadraticProgramTraits.h index 504bdcb1296..0d1cec8fe95 100644 --- a/Solver_interface/doc/Solver_interface/Concepts/QuadraticProgramTraits.h +++ b/Solver_interface/doc/Solver_interface/Concepts/QuadraticProgramTraits.h @@ -3,7 +3,7 @@ \cgalConcept A concept that describes the set of methods used to define and solve a -quadratic programming (QP) problem of the general form: +quadratic programming (`qp`) problem of the general form:
\f{eqnarray*}{ & \mbox{minimize} & \frac{1}{2}\mathbf{x}^{T}P\mathbf{x} + \mathbf{q}^{T}\mathbf{x} + r \\ @@ -35,29 +35,9 @@ public: /// @{ /*! - Allocates memory for `k` non-zero values in the matrix `P`. + Allocates memory for `n` variables and `m` constraints in `qp`. */ - void reserve_P(const std::size_t k) { } - - /*! - Allocates memory for `n` values in the vector `q`. - */ - void reserve_q(const std::size_t n) { } - - /*! - Allocates memory for `k` non-zero values in the matrix `A`. - */ - void reserve_A(const std::size_t k) { } - - /*! - Allocates memory for `m` values in the vector `l`. - */ - void reserve_l(const std::size_t m) { } - - /*! - Allocates memory for `m` values in the vector `u`. - */ - void reserve_u(const std::size_t m) { } + void resize(const std::size_t n, const std::size_t m) { } /// @} @@ -69,39 +49,33 @@ public: Note that you should define only the upper triangular part of the matrix! */ - void set_P(const std::size_t i, const std::size_t j, const FT value) - { } + void set_P(const std::size_t i, const std::size_t j, const FT value) { } /*! - Sets the entry `qj` of `qp` to `value`. + Sets the entry `qi` of `qp` to `value`. */ - void set_q(const std::size_t j, const FT 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) - { } + 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) - { } + 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) - { } + 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) - { } + void set_u(const std::size_t i, const FT value) { } /// @} @@ -114,7 +88,7 @@ public: 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 `FT` + a model of `OutputIterator` that accepts values of type `FieldNumberType` \param solution an output iterator with the solution @@ -122,8 +96,7 @@ public: \returns a status of the computation `success == true` */ template - bool solve(OutIterator solution) - { } + bool solve(OutIterator solution) { } /// @} }; diff --git a/Solver_interface/doc/Solver_interface/Solver_interface.txt b/Solver_interface/doc/Solver_interface/Solver_interface.txt index 4a42e373609..1a4e0d0e484 100644 --- a/Solver_interface/doc/Solver_interface/Solver_interface.txt +++ b/Solver_interface/doc/Solver_interface/Solver_interface.txt @@ -137,7 +137,7 @@ extended the existing concepts. Liangliang Nan introduced the concept `MixedIntegerProgramTraits` and two models for solving mixed integer programs when implementing the \ref PkgPolygonalSurfaceReconstruction package. The concepts and models for solving linear and quadratic programs -were later introduced by Dmitry Anisimov. +were later introduced by Dmitry Anisimov and Mael Rouxel-Labbé. Simon Giraudot was responsible for gathering all concepts and classes, and also wrote this user manual with the help of Andreas Fabri. diff --git a/Solver_interface/include/CGAL/OSQP_quadratic_program_traits.h b/Solver_interface/include/CGAL/OSQP_quadratic_program_traits.h index b82173b59f9..3dfc8af4fc1 100644 --- a/Solver_interface/include/CGAL/OSQP_quadratic_program_traits.h +++ b/Solver_interface/include/CGAL/OSQP_quadratic_program_traits.h @@ -57,7 +57,7 @@ private: std::vector q_vec, l_vec, u_vec; public: - /// Default constructor + /// %Default constructor OSQP_quadratic_program_traits() : n(0), m(0) { } /// Constructor @@ -85,7 +85,7 @@ public: } public: - /// Reset the problem, removing all existing entries and setting sizes to `0`. + /// Resets the problem, removing all existing entries and setting sizes to `0`. void clear() { n = m = 0; @@ -96,7 +96,7 @@ public: u_vec.clear(); } - /// Change the number of variables and the number of constraints of the problem. + /// Changes the number of variables and the number of constraints of the problem. /// /// \warning Calling this function also clears all previous entries. void resize(const int new_n,