-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathipc-lama2011-clean
executable file
·71 lines (57 loc) · 1.64 KB
/
ipc-lama2011-clean
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
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash
#-*- mode:sh -*-
SCRDIR=$(dirname $(readlink -ef $0))
################################################################
#### default options
name=seq-sat-lama2011
[[ -z $name ]] && {
echo "No IPC planner name specified!"
exit 1
}
find-planner-upward (){
echo "finding $1/$name ..."
if [[ -d $1/$name ]]
then
planner_dir=$1/$name
else
if [[ $1 == / ]]
then
echo "Failed to find $name !"
exit 1
else
find-planner-upward $(readlink -ef $1/..)
fi
fi
}
find-planner-upward $(dirname $(readlink -ef $0))
################################################################
#### main
# Run the planner; exit status will be the status of the entire script
plan(){
echo $(whoami)@$(hostname)
ln -s -t . $planner_dir/*
finished_flag=$(basename $(mktemp --tmpdir=. __tmp__XXXXXXXXX))
( ./plan-ipc seq-sat-lama-2011 domain.pddl problem.pddl soln ; touch $finished_flag ) &
planpid=$!
grep -q "$finished_flag\|soln\(\.[0-9]\+\)\?\>" <(inotifywait -e close_write -m .)
}
# Copy the plan files
finalize (){
( ls soln* | grep "soln\(\.[0-9]\+\)\?\>" ) && \
cp $(ls soln* | grep "soln\(\.[0-9]\+\)\?\>" | tail -n 1) $probdir/$probname.plan
rm soln*
}
# When plan was not found, check if the entire problem space is searched
negatively-proven (){
false
}
# Print the costs of plans found, if any
report-results (){
echo "IPC planners do not support printing the cost"
}
plan-found (){
[[ -e $probdir/$probname.plan ]]
}
################################################################
# required
. $SCRDIR/common.sh