CGAL 5.4 - CGAL and Solvers
QuadraticProgramTraits Concept Reference

Definition

A concept that describes the set of methods used to define and solve a quadratic programming (qp) problem of the general form:

\begin{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} \end{eqnarray*}

in \( n \) real variables \( \mathbf{x} = (x_0, \ldots, x_{n-1}) \) and \( m \) constraints.

Here,

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

Memory

void resize (const std::size_t n, const std::size_t m)
 Allocates memory for n variables and m constraints in qp.
 

Initialization

void set_P (const std::size_t i, const std::size_t j, const FT value)
 Sets the entries Pij and Pji of qp to value.
 
void set_q (const std::size_t i, const FT value)
 Sets the entry qi of qp to value.
 
void set_r (const FT value)
 Sets the entry r of qp to value.
 
void set_A (const std::size_t i, const std::size_t j, 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_l (const std::size_t i, const FT value)
 Sets the entry li of qp to value.
 
void set_u (const std::size_t i, const FT value)
 Sets the entry ui of qp to value.
 

Solution

template<typename OutIterator >
bool solve (OutIterator solution)
 solves the quadratic program. More...
 

Member Function Documentation

◆ solve()

template<typename OutIterator >
bool QuadraticProgramTraits::solve ( OutIterator  solution)

solves the quadratic program.

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

Template Parameters
OutIteratora model of OutputIterator that accepts values of type FieldNumberType
Parameters
solutionan output iterator with the solution
Returns
a status of the computation success == true