-
Notifications
You must be signed in to change notification settings - Fork 13
/
myasprilo
executable file
·60 lines (51 loc) · 1.42 KB
/
myasprilo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
SOLVER=clingo
VISUALIZER=visualizer
OPTIONS=""
EXTENSION="lp"
PLAN="asprilo.plan"
REDIRECTION=0
VISUALIZATION=0
STRATEGY=0
HEURISTIC=0
while getopts ":iprvhsl:f:" OPT; do
case ${OPT} in
i ) echo "% Incremental mode"
EXTENSION="ilp"
;;
p ) echo "% One plan only"
OPTIONS="$OPTIONS --outf=0 -V0 --out-atomf=%s. --quiet=1,2,2"
;;
r ) echo "% Redirect output to file"
REDIRECTION=1
;;
v ) echo "% Visualize plan (from file)"
VISUALIZATION=1
;;
s ) echo "% Including strategies"
STRATEGY=1
;;
h ) echo "% Including heuristics"
HEURISTIC=1
;;
l ) echo "% Setting horizon to $OPTARG"
OPTIONS="$OPTIONS -c horizon=$OPTARG"
;;
f ) echo "% Set plan file to $OPTARG"
PLAN=$OPTARG
;;
\?) echo "OOPS: Unknown option"
exit 0
esac
done
shift $(($OPTIND - 1))
DESCRIPTION=asprilo.$EXTENSION
GOAL=asprilo-goal.$EXTENSION
OUTPUT=asprilo-output.$EXTENSION
if [ "$STRATEGY" = "0" ]; then STRATEGY=""; else STRATEGY=asprilo-strategy.$EXTENSION; fi
if [ "$HEURISTIC" = "0" ]; then HEURISTIC=""; else HEURISTIC=asprilo-heuristic.$EXTENSION; fi
if [ "$HEURISTIC" = "1" ]; then OPTIONS="$OPTIONS --heuristic=domain"; fi
CALL="$SOLVER $DESCRIPTION $GOAL $OUTPUT $STRATEGY $HEURISTIC $OPTIONS $@"
echo $CALL
if [ $REDIRECTION == 0 ]; then $CALL; else $CALL | head -n1 > $PLAN; fi
if [ $VISUALIZATION != 0 ]; then $VISUALIZER -t $1 $PLAN; fi