CGAL 5.5.2 - Linear and Quadratic Programming Solver

Definition

A model of LinearProgram describes a linear program of the form.

\begin{eqnarray*} \mbox{(QP)}& \mbox{minimize} & \qpc^{T}\qpx+c_0 \\ &\mbox{subject to} & A\qpx\qprel \qpb, \\ & & \qpl \leq \qpx \leq \qpu \end{eqnarray*}

in \( n\) real variables \( \qpx=(x_0,\ldots,x_{n-1})\). Here,

  • \( A\) is an \( m\times n\) matrix (the constraint matrix),
  • \( \qpb\) is an \( m\)-dimensional vector (the right-hand side),
  • \( \qprel\) is an \( m\)-dimensional vector of relations from \( \{\leq, =, \geq\}\),

  • \( \qpl\) is an \( n\)-dimensional vector of lower bounds for \( \qpx\), where \( l_j\in\mathbb{R}\cup\{-\infty\}\) for all \( j\)
  • \( \qpu\) is an \( n\)-dimensional vector of upper bounds for \( \qpx\), where \( u_j\in\mathbb{R}\cup\{\infty\}\) for all \( j\)

  • \( \qpc\) is an \( n\)-dimensional vector (the linear objective function), and
  • \( c_0\) is a constant.

The description is given by appropriate random-access iterators over the program data, see below. The program therefore comes in dense representation which includes zero entries.

Has Models:

CGAL::Quadratic_program<NT>

CGAL::Quadratic_program_from_mps<NT>

CGAL::Linear_program_from_iterators<A_it, B_it, R_it, FL_it, L_it, FU_it, U_it, D_it, C_it>

and the other concepts

See also
QuadraticProgram
NonnegativeQuadraticProgram
NonnegativeLinearProgram

Types

typedef unspecified_type A_iterator
 A random access iterator type to go columnwise over the constraint matrix \( A\). More...
 
typedef unspecified_type B_iterator
 A random access iterator type to go over the entries of the right-hand side \( \qpb\).
 
typedef unspecified_type R_iterator
 A random access iterator type to go over the relations \( \qprel\). More...
 
typedef unspecified_type FL_iterator
 A random access iterator type to go over the existence (finiteness) of the lower bounds \( l_j, j=0,\ldots,n-1\). More...
 
typedef unspecified_type L_iterator
 A random acess iterator type to go over the entries of the lower bound vector \( \qpl\).
 
typedef unspecified_type UL_iterator
 A random access iterator type to go over the existence (finiteness) of the upper bounds \( u_j, j=0,\ldots,n-1\). More...
 
typedef unspecified_type U_iterator
 A random acess iterator type to go over the entries of the upper bound vector \( \qpu\).
 
typedef unspecified_type C_iterator
 A random access iterator type to go over the entries of the linear objective function vector \( c\).
 

Operations

int get_n () const
 returns the number \( n\) of variables (number of columns of \( A\)) in lp.
 
int get_m () const
 returns the number \( m\) of constraints (number of rows of \( A\)) in lp.
 
A_iterator get_a () const
 returns an iterator over the columns of \( A\). More...
 
B_iterator get_b () const
 returns an iterator over the entries of \( \qpb\). More...
 
R_iterator get_r () const
 returns an iterator over the entries of \( \qprel\). More...
 
FL_iterator get_fl () const
 returns an iterator over the existence of the lower bounds \( l_j, j=0,\ldots,n-1\). More...
 
L_iterator get_l () const
 returns an iterator over the entries of \( \qpl\). More...
 
FU_iterator get_fu () const
 returns an iterator over the existence of the upper bounds \( u_j, j=0,\ldots,n-1\). More...
 
L_iterator get_u () const
 returns an iterator over the entries of \( \qpu\). More...
 
C_iterator get_c () const
 returns an iterator over the entries of \( \qpc\). More...
 
std::iterator_traits< C_iterator >::value_type get_c0 () const
 returns the constant term \( c_0\) of the objective function.
 

Member Typedef Documentation

◆ A_iterator

A random access iterator type to go columnwise over the constraint matrix \( A\).

The value type is a random access iterator type for an individual column that goes over the entries in that column.

◆ FL_iterator

A random access iterator type to go over the existence (finiteness) of the lower bounds \( l_j, j=0,\ldots,n-1\).

The value type of FL_iterator is bool.

◆ R_iterator

A random access iterator type to go over the relations \( \qprel\).

The value type of R_iterator is CGAL::Comparison_result.

◆ UL_iterator

A random access iterator type to go over the existence (finiteness) of the upper bounds \( u_j, j=0,\ldots,n-1\).

The value type of UL_iterator is bool.

Member Function Documentation

◆ get_a()

A_iterator LinearProgram::get_a ( ) const

returns an iterator over the columns of \( A\).

The corresponding past-the-end iterator is get_a()+get_n(). For \( j=0,\ldots,n-1\), *(get_a()+j) is a random access iterator for column \( j\).

◆ get_b()

B_iterator LinearProgram::get_b ( ) const

returns an iterator over the entries of \( \qpb\).

The corresponding past-the-end iterator is get_b()+get_m().

◆ get_c()

C_iterator LinearProgram::get_c ( ) const

returns an iterator over the entries of \( \qpc\).

The corresponding past-the-end iterator is get_c()+get_n().

◆ get_fl()

FL_iterator LinearProgram::get_fl ( ) const

returns an iterator over the existence of the lower bounds \( l_j, j=0,\ldots,n-1\).

The corresponding past-the-end iterator is get_fl()+get_n(). If *(get_fl()+j) has value \( true\), the variable \( x_j\) has a lower bound given by *(get_l()+j), otherwise it has no lower bound.

◆ get_fu()

FU_iterator LinearProgram::get_fu ( ) const

returns an iterator over the existence of the upper bounds \( u_j, j=0,\ldots,n-1\).

The corresponding past-the-end iterator is get_fu()+get_n(). If *(get_fu()+j) has value \( true\), the variable \( x_j\) has an upper bound given by *(get_u()+j), otherwise it has no upper bound.

◆ get_l()

L_iterator LinearProgram::get_l ( ) const

returns an iterator over the entries of \( \qpl\).

The corresponding past-the-end iterator is get_l()+get_n(). If *(get_fl()+j) has value \( false\), the value *(get_l()+j) is not accessed.

Precondition
if both *(get_fl()+j) and *(get_fu()+j) have value \( true\), then *(get_l()+j) <= *(get_u()+j).

◆ get_r()

R_iterator LinearProgram::get_r ( ) const

returns an iterator over the entries of \( \qprel\).

The corresponding past-the-end iterator is get_r()+get_m(). The value CGAL::SMALLER stands for \( \leq\), CGAL::EQUAL stands for \( =\), and CGAL::LARGER stands for \( \geq\).

◆ get_u()

L_iterator LinearProgram::get_u ( ) const

returns an iterator over the entries of \( \qpu\).

The corresponding past-the-end iterator is get_u()+get_n(). If *(get_fu()+j) has value \( false\), the value *(get_u()+j) is not accessed.

Precondition
if both *(get_fl()+j) and *(get_fu()+j) have value \( true\), then *(get_l()+j) <= *(get_u()+j).