-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcube-solve.sh
More file actions
executable file
·57 lines (48 loc) · 1.65 KB
/
cube-solve.sh
File metadata and controls
executable file
·57 lines (48 loc) · 1.65 KB
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
#!/bin/bash
n=$1 #order
f=$2 #instance file name
v=$3 #num of cubes to cutoff at initial depth
a=$4 #num of cubes to cutoff at initial depth for each proceeding cubing call
d=${f}-d
mkdir -p $d/$v/$n-cubes
di="$d/$v"
./gen_cubes/cube.sh -a $n $f $v $di
files=$(ls $d/$v/$n-cubes/*.cubes)
highest_num=$(echo "$files" | awk -F '[./]' '{print $(NF-1)}' | sort -nr | head -n 1)
echo "currently the cubing depth is $highest_num"
cube_file=$d/$v/$n-cubes/$highest_num.cubes
cube_file_name=$(echo $cube_file | sed 's:.*/::')
new_cube=$((highest_num + 1))
numline=$(< $cube_file wc -l)
new_index=$((numline))
for i in $(seq 1 $new_index) #1-based indexing for cubes
do
command1="./gen_cubes/apply.sh $f $cube_file $i > $cube_file$i.adj"
command2="./solve-verify.sh $n $cube_file$i.adj"
command="$command1 && $command2"
echo $command >> $d/$v/solve.commands
echo $command
eval $command1
eval $command2
done
for i in $(seq 1 $new_index)
do
file="$cube_file$i.adj.log"
if grep -q "UNSATISFIABLE" $file
then
#do something
continue
elif grep -q "SATISFIABLE" $file
then
#do something
continue
else
echo $file is not solved
child_instance="$cube_file$i.adj"
echo "further cube instance $child_instance"
command="./cube-solve.sh $n $child_instance "$d/$v-$i" $a $a"
#for parallization, simply submit the command below using sbatch
echo $command >> ${n}-iterative.commands
eval $command
fi
done