-
Notifications
You must be signed in to change notification settings - Fork 0
/
traj_file_gen.sh
executable file
·37 lines (32 loc) · 1.08 KB
/
traj_file_gen.sh
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
#!/bin/bash
# Script to generate trajectory files from the solution files automatically by calling the parser engine
# Usage: ./traj_file_gen.sh [DOMAIN_FILE] [INSTANCES_FOLDER] [SOLUTIONS_FOLDER] [LOGS_FOLDER]
# e.g. ./traj_file_gen.sh reference-sokoban.pddl instances solutions logs
ENGINE=./trajectory/trajectory.py
DOMAIN=$1
INSTANCES=$2/*.pddl
SOLUTIONS=$3/*
LOGS=$4
inst_regex="instance-([0-9]+)\.pddl$"
soln_regex="solution-([0-9]+)\.soln$"
for instance in $INSTANCES
do
if [[ $instance =~ $inst_regex ]]
then
id_inst=${BASH_REMATCH[1]}
for solution in $SOLUTIONS
do
if [[ $solution =~ $soln_regex ]]
then
id_soln=${BASH_REMATCH[1]}
if [ "$id_inst" == "$id_soln" ]
then
echo $instance $solution
log="${LOGS}/log-$id_soln.log"
echo python "$ENGINE" "$DOMAIN" "$instance" "$solution" "$log"
python "$ENGINE" "$DOMAIN" "$instance" "$solution" > "$log"
fi
fi
done
fi
done