Commit 9f121c5b authored by Simon de Givry's avatar Simon de Givry Committed by Thomas Schiex
Browse files

[doc] add a section on how to test toulbar2

parent 36235b13
No preview for this file type
......@@ -11,6 +11,7 @@
\def\ci{\perp\!\!\!\perp}
\def\toulbar2{\textsc{toulbar2}}
\def\toolbar{\textsc{toolbar}}
\title{\toulbar2 User documentation}
\author{The \toulbar2 developer team}
\date{\today}
......@@ -106,6 +107,31 @@ please look for benchmarks in the
\href{http://costfunction.org/en/benchmark}{Cost
Function benchmark Section}. Other benchmarks coming from various discrete optimization languages are available at \href{http://genoweb.toulouse.inra.fr/~degivry/evalgm}{Genotoul EvalGM}~\cite{Hurley16b}.
\section{How do I test it ?}
Some problem examples are available in the directory {\sf toulbar2/validation}. After compilation with cmake, it is possible to run a series of tests using:
\begin{verbatim}
make test
\end{verbatim}
For debugging \toulbar2 (compile with flag \verb!CMAKE_BUILD_TYPE="Debug"!), more test examples are available at \href{https://forgemia.inra.fr/thomas.schiex/cost-function-library}{Cost Function Library}.
The following commands run \toulbar2 (executable must be found on your system path) on every problems with a 1-hour time limit and compare their optimum with known optima (in .ub files).
\begin{verbatim}
cd toulbar2
git clone https://forgemia.inra.fr/thomas.schiex/cost-function-library.git
./misc/script/runall.sh ./cost-function-library/trunk/validation
\end{verbatim}
Other tests on randomly generated problems can be done where optimal solutions are verified by using an older solver \href{https://forgemia.inra.fr/thomas.schiex/toolbar}{\toolbar} (executable must be found on your system path).
\begin{verbatim}
cd toulbar2
git clone https://forgemia.inra.fr/thomas.schiex/toolbar.git
cd toolbar/toolbar
make toolbar
cd ../..
./misc/script/rungenerate.sh
\end{verbatim}
\section{Using it as a black box}
Using \toulbar2 is just a matter of having a properly formatted input
......
......@@ -3,7 +3,7 @@
# Usage:
# ./runall.sh ../validation
solver=./toulbar2
solver=toulbar2
timelimit=3600
vmemlimit=16000000
K=1
......
......@@ -21,11 +21,11 @@ while (( $n < $nend )) ; do
rm -f toolbar_sol
rm -f sol
randomfile=nary-$n-$d-$tight-$bctr-$tctr-$nary-$nary5-$seed
./toulbar2 -random=$randomfile -C=$K -z > /dev/null
toulbar2 -random=$randomfile -C=$K -z > /dev/null
toolbar problem.wcsp | awk 'BEGIN{opt="-";} /^Optimum: /{opt=$2;} END{printf("%d \n",opt); }' > toolbar_opt
ub0=`cat toolbar_opt`
ub=`expr $ub0 + 2`
./toulbar2 problem.wcsp "$@" -w -ub=$ub | awk 'BEGIN{opt="-";} /Read [0-9]* variables/{n=$2;} / unassigned variables/{f=$1} /^Optimum: /{opt=$2;} END{printf("%d %d %d",opt,n,f);}' > toulbar2_opt
toulbar2 problem.wcsp "$@" -w -ub=$ub | awk 'BEGIN{opt="-";} /Read [0-9]* variables/{n=$2;} / unassigned variables/{f=$1} /^Optimum: /{opt=$2;} END{printf("%d %d %d",opt,n,f);}' > toulbar2_opt
toolbar problem.wcsp -csol | awk 'BEGIN{opt="-";} /^Total cost /{opt=$4;} END{printf("%d \n",opt); }' > toolbar_sol
ub1=`awk '{printf("%d", $1)}' toulbar2_opt`
ub2=`awk '{printf("%d", $1)}' toolbar_opt`
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment