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 @@
\title{\toulbar2 User documentation}
\author{The \toulbar2 developer team}
......@@ -106,6 +107,31 @@ please look for benchmarks in the
Function benchmark Section}. Other benchmarks coming from various discrete optimization languages are available at \href{}{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:
make test
For debugging \toulbar2 (compile with flag \verb!CMAKE_BUILD_TYPE="Debug"!), more test examples are available at \href{}{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).
cd toulbar2
git clone
./misc/script/ ./cost-function-library/trunk/validation
Other tests on randomly generated problems can be done where optimal solutions are verified by using an older solver \href{}{\toolbar} (executable must be found on your system path).
cd toulbar2
git clone
cd toolbar/toolbar
make toolbar
cd ../..
\section{Using it as a black box}
Using \toulbar2 is just a matter of having a properly formatted input
......@@ -3,7 +3,7 @@
# Usage:
# ./ ../validation
......@@ -21,11 +21,11 @@ while (( $n < $nend )) ; do
rm -f toolbar_sol
rm -f sol
./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