| 
  
   Size: 1406 
  
  Comment:  
 | 
    ← Revision 7 as of 2010-12-02 15:35:57  ⇥ 
  Size: 1595 
  
  Comment:  
 | 
| Deletions are marked like this. | Additions are marked like this. | 
| Line 1: | Line 1: | 
| A {{{run}}} script example to be used for the Model & Solve competition follows.  The script pipes input towards the DLV solver (you might replace with your own) and outputs data in the competition format.  | 
|
| Line 29: | Line 32: | 
| Note that, in the above script, {{{DLV}}} is invoked after a pre-processing perl script. | Note that {{{DLV}}} is invoked after a pre-processing perl script. | 
| Line 31: | Line 34: | 
| Your binary executable might not require a pre-processing script, in which case the following instruction can be used in the script: | Your binary executable might not require a pre-processing script: in such a case the following instruction can be used in the script: | 
A run script example to be used for the Model & Solve competition follows. The script pipes input towards the DLV solver (you might replace with your own) and outputs data in the competition format.
 #! /usr/bin/env bash
set -o pipefail     # Disable output buffering
if [ $# -ne 3 ]; then
    echo "This script must be invoked with three parameters!"
    exit
fi
MAXINT=$1
MAX_NESTING_LEVEL=$2    # NOTE: MAX_NESTING_LEVEL is not used in this version of DLV
OUTPUT_PREDICATES=$3
SCRIPTDIR=`dirname $0`
BIN=$SCRIPTDIR/dlv.i386-linux-elf-static.bin
ENCODING=$SCRIPTDIR/my_encoding.dl
# Execution with preprocessing and postprocessing:
$SCRIPTDIR/preprocess.pl | $BIN -N=$MAXINT -filter=$OUTPUT_PREDICATES -n=1 -silent $ENCODING -- | $SCRIPTDIR/postprocess.pl
ECODE=$?
if [ $ECODE -ne 0 ]; then
    echo UNKNOWN;
fi
exit $ECODENote that DLV is invoked after a pre-processing perl script. The output of DLV is processed by a perl post-processing script. Your binary executable might not require a pre-processing script: in such a case the following instruction can be used in the script:
# Execution with postprocessing only: $BIN -N=$MAXINT -filter=$OUTPUT_PREDICATES -n=1 -silent $ENCODING -- | $SCRIPTDIR/postprocess.pl
Similarly, if your binary executable does not require a post-processing script, the following instruction can be used in the script:
# Execution with preprocessing only: $SCRIPTDIR/preprocess.pl | $BIN -N=$MAXINT -filter=$OUTPUT_PREDICATES -n=1 -silent $ENCODING --
