#!/usr/bin/env bash
if [ $# -ne 3 ]; then
    echo "This script must be invoked with three parameters!"
    exit
fi

SCRIPTDIR=`dirname $0`
BIN=$SCRIPTDIR/bin/clingcon
CONF=$SCRIPTDIR/bin/CONFIG
OPTS=$(cat $CONF)
cat - | sed 's/\(max_value(\(.*\))\)/\1. #const mv=\2/g' | cat $SCRIPTDIR/encoding.lp - | $BIN $OPTS 2>&1 | $SCRIPTDIR/bin/convert.py

exit $?

