%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% 4ti2 User Guide, Advanced guide
%
% $Id: 4ti2_manual_advanced.tex,v 1.3 2007/01/05 11:27:32 hemmecke Exp $
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\chapter{Advanced guide}

In this part, we deal with several more advanced problem
specifications in \FourTiTwo{}.

First we introduce \emph{affine systems} and their encodings. In
fact, affine systems are the basic objects used in \FourTiTwo{},
since every linear system is transformed into an affine system.
However, in the integer situation, it is not always possible to
transform an affine system back into a linear system without adding
variables or modulo constraints.

Next, we demonstrate how one can exploit bounds on integer variables
to truncate the solution set.

Again, we use a few sample problems to demonstrate how to use
\FourTiTwo{}. After working through this part, you should know about
how to run the following functions on affine systems:
\begin{itemize}
\item \File{qsolve}, \File{rays}, \File{circuits}
\item \File{zsolve}, \File{hilbert}, \File{graver}
\item \File{markov}, \File{groebner}, \File{normalform}, \File{minimize}
\end{itemize}


\section{Affine systems and their encodings}

In \FourTiTwo, the definition of an \emph{affine system} is slightly
different for the continuous and for the integer situation. In fact,
the definition for the integer case is simply the integer analogue
to the definition for the continuous case.

\subsection{Continuous affine systems}

Let $a+\Lattice_{\R}$ be a linear affine space given by the vector
$a$ and by generators for the linear space $\Lattice_{\R}$. We wish
to find a finite sign-compatible description for the set of all
vectors $x\in a+\Lattice_{\R}$.

\subsection{Integer affine systems}

Let $a+\Lattice_{\Z}$ be an ``integer linear affine space'' given by
the vector $a\in\Z^n$ and by generators for the lattice
$\Lattice_{\Z}\subseteq\Z^n$. We wish to find a finite
sign-compatible description for the set of all (integer) vectors
$x\in a+\Lattice_{\Z}$.

\subsection{Specifying an affine system in \FourTiTwo{}}

Currently, only homogeneous affine systems can be solved in
\FourTiTwo{} over $\R$ and over $\Z$ using the functions
\File{qsolve} and \File{zsolve}, respectively. In order to call
these functions, one needs to specify an affine system to
\FourTiTwo.

As an example, let consider the linear space $\Lattice_{\R}$ and the
lattice $\Lattice_{\Z}$ both spanned by the two vectors $(1,-2,1,0)$
and $(2,-3,-0,1)$. Moreover, consider the sign-constraints
$(1,2,2,0)$. Thus, we are looking for a finite explicit
sign-compatible description for all $x$ that can be written as
\[
x=\left(
\begin{array}{rr}
1 & 2\\
-2 & -3\\
1 & 0\\
0 & 1\\
\end{array}
\right)\lambda,
\]
with $\lambda\in\R^2$ and $\lambda\in\Z^2$, respectively.

In order to solve this affine system using \File{qsolve} or
\File{zsolve}, we create the following input files to encode the
affine system:
\begin{center}
  \begin{tabular}{|l|l|}
\hline
    \text{ PROJECT.lat } & \text{ PROJECT.sign }\\
\hline
  $\begin{array}{rrrrrr}& 2 & 4 & & &\\& 1 & -1 & 1 & 0 &\\& 2 & -3 & 0 & 1 &\\ \end{array}$ &
  $\begin{array}{rrrrrr}& 1 & 4 & & &\\& 1 &  2 & 2 & 0 &\\ \\ \\\end{array}$\\
\hline
  \end{tabular}
\end{center}
and then call
\begin{center}
{\tt ./qsolve PROJECT}
\end{center}
and
\begin{center}
{\tt ./zsolve PROJECT}
\end{center}
In the continuous case, this creates the files \File{PROJECT.qhom}
and \File{PROJECT.qfree}, and in the integer case this creates the
files \File{PROJECT.zhom} and \File{PROJECT.zfree}.

In contrast to calling \File{qsolve} and \File{zsolve} on a inear
system, these calls create only two files, since at the moment only
homogeneous affine systems (with $a=0$) are supported by
\FourTiTwo{}.
