forked from curtisbright/PhysicsCheck
-
Notifications
You must be signed in to change notification settings - Fork 0
/
check-minimal-candidates.sh
executable file
·52 lines (48 loc) · 1.22 KB
/
check-minimal-candidates.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
[ "$1" = "-h" -o "$1" = "--help" -o "$#" -ne 2 ] && echo "
Description:
Need file name and order.
" && exit
file=$1
n=$2
m=$((n*(n-1)/2)) # Number of edge variables in instance
if [ -f "non_minimal_$n" ]
then
rm non_minimal_$n
fi
touch non_minimal_$n
while read line; do
count=0
while [ "$count" -lt "$m" ]
do
if [ -f "temp.txt" ]
then
rm temp.txt
fi
touch temp.txt
echo "removing edge $count..."
if [ -f "non_colorable_check_$n" ]
then
rm non_colorable_check_$n
fi
python3 check-minimal-candidates.py "$line" $n $count
if [ -f "non_colorable_check_$n" ]
then
if cadical/build/cadical non_colorable_check_$n | grep -q "exit 20"
then
echo "non_colorable"
echo "$line" >> temp.txt
else
echo "colorable, not satisfied"
fi
else
echo "no valid edge selected"
fi
occurence=($(grep -o "$line" temp.txt | wc -l))
if [ "$occurence" -eq "2" ]
then
echo "$line" >> non_minimal_$n
break
fi
count=$((count+1))
done
done < $file