cgal/QP_solver/doc_tex/QP_solver_ref/Quadratic_program.tex

106 lines
3.9 KiB
TeX

\begin{ccRefClass}{Quadratic_program<NT>}
\ccInclude{CGAL/QP_models.h}
\ccDefinition
An object of class \ccRefName\ describes a convex quadratic program of the form
%%
\begin{eqnarray*}
\mbox{(QP)}& \mbox{minimize} & x^{T}Dx+c^{T}x+c_0 \\
&\mbox{subject to} & Ax\qprel b, \\
& & l \leq x \leq u
\end{eqnarray*}
%%
in $n$ real variables $x=(x_0,\ldots,x_{n-1})$.
Here,
\begin{itemize}
\item $A$ is an $m\times n$ matrix (the constraint matrix),
\item $b$ is an $m$-dimensional vector (the right-hand side),
\item $\qprel$ is an $m$-dimensional vector of relations
from $\{\leq, =, \geq\}$,
\item $l$ is an $n$-dimensional vector of lower
bounds for $x$,
\item $u$ is an $n$-dimensional vector of upper bounds for
$x$,
\item $D$ is a symmetric positive-semidefinite $n\times n$ matrix (the
quadratic objective function),
\item $c$ is an $n$-dimensional vector (the linear objective
function), and
\item $c_0$ is a constant.
\end{itemize}
This class allows you to build your program entry by entry, using
the set-methods below. If you only need to wrap existing (random-access)
iterators, then you may use the classes
\ccc{Quadratic_program_from_iterators<A_it, B_it, R_it, FL_it, L_it, FU_it, U_it, D_it, C_it>} and \ccc{Quadratic_program_from_pointers<NT>}). If you want
to read a quadratic program in \ccc{MPSFormat} from a file, please use
the model \ccc{Quadratic_program_from_mps<NT>}.
\ccIsModel
\ccc{QuadraticProgramInterface}
\ccTypes
\ccNestedType{NT}{The number type of the program entries.}
\ccCreation
\ccIndexClassCreation
\ccCreationVariable{qp}
\ccConstructor{
Quadratic_program(CGAL::Comparison_result default_r = CGAL::EQUAL);}
{constructs a quadratic program with no variables and no constraints, ready
for data to be added. Unless
bounds are explicitly set using one of the methods below, bounds will be
$x\geq 0$. Unless relations are explicitly set, relations will be of type
\ccc{default_r}. Numerical entries that are not explicitly set will
default to $0$.}
\ccOperations
\ccCreationVariable{qp}
\ccMethod{bool is_linear() const;}{returns \ccc{true} iff the
objective function matrix of \ccVar\ satisfies $D=0$.}
\ccMethod{bool is_nonnegative() const;}{returns \ccc{true} iff
the bounds of \ccVar\ are $x\geq 0$.}
\ccMethod{void set_a (int j, int i, const NT& val);}{sets the entry $A_{ij}$
in column $j$ and row $i$ of the constraint matrix $A$ of \ccVar\ to
\ccc{val}. An existing entry is overwritten. \ccVar\ is enlarged if
necessary to accomodate this entry.}
\ccMethod{void set_b (int i, const NT& val);}{sets the entry $b_i$
of \ccVar\ to \ccc{val}. An existing entry is overwritten.
\ccVar\ is enlarged if necessary to accomodate this entry.}
\ccMethod{void set_l (int j, bool is_finite, const NT& val = NT(0));}
{if \ccc{is_finite}, this sets the entry $l_j$ of \ccVar\ to \ccc{val},
otherwise it sets $l_j$ to $-\infty$. An existing entry is overwritten.
\ccVar\ is enlarged if necessary to accomodate this entry.}
\ccMethod{void set_u (int j, bool is_finite, const NT& val = NT(0));}
{if \ccc{is_finite}, this sets the entry $u_j$ of \ccVar\ to \ccc{val},
otherwise it sets $u_j$ to $\infty$. An existing entry is overwritten.
\ccVar\ is enlarged if necessary to accomodate this entry.}
\ccMethod{void set_c (int j, const NT& val);}{sets the entry $c_j$
of \ccVar\ to \ccc{val}. An existing entry is overwritten.
\ccVar\ is enlarged if necessary to accomodate this entry.}
\ccMethod{void set_c0 (const NT& val);}{sets the entry $c_0$
of \ccVar\ to \ccc{val}. An existing entry is overwritten.}
\ccMethod{void set_d (int i, int j, const NT& val);}{sets the entry
$2D_{ij}$ of \ccVar\ to \ccc{val}. An existing entry is overwritten.
\ccVar\ is enlarged if necessary to accomodate this entry.}
\ccSeeAlso
\ccc{Quadratic_program_from_iterators<A_it, B_it, R_it, FL_it, L_it, FU_it, U_it, D_it, C_it>}\\
\ccc{Quadratic_program_from_pointers<NT>}\\
\ccc{Quadratic_program_from_mps<NT>}
\end{ccRefClass}