-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerate-instance.sh
More file actions
executable file
·64 lines (53 loc) · 2.05 KB
/
generate-instance.sh
File metadata and controls
executable file
·64 lines (53 loc) · 2.05 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
58
59
60
61
62
63
64
#!/bin/bash
[ "$1" = "-h" -o "$1" = "--help" -o "$#" -lt 1 -o "$#" -gt 4 ] && echo "
Description:
Updated on 2023-01-11
This script call the python file generate.py in gen_instance to generate the SAT encoding for a Kochen Specker candidates. Such candidate satisfies the following condition:
1. The graph is squarefree, hence does not contain C4 subgraph
2. All vertices are part of a triangle
3. Graph is not 010-colorable (refer to the paper for definition)
4. Minimum degree of each vertex is 3
5. We also applied the cubic isomorphism blocking clauses
Usage:
./generate-instance.sh n c o [lex-option]
Options:
<n>: the order of the instance/number of vertices in the graph
<c>: ratio of color-1 vertices to block
<o>: definition used (1 or 2)
lex-option: (optional) 'lex-greatest' to use lex-greatest ordering instead of lex-smallest,
or 'no-lex' to skip isomorphism blocking entirely
" && exit
n=$1 #order
c=$2 #ratio of color-1 vertices to block
o=$3 #definition used
lex_opt="" #default to lex-smallest
echo "Debug: Input parameters:"
echo "n=$n, c=$c, o=$o, \$4=$4"
# Check if fourth argument is a lex option
if [ "$4" = "lex-greatest" ] || [ "$4" = "no-lex" ]; then
echo "Debug: Setting lex_opt to $4"
lex_opt="$4"
fi
base_name="constraints_${n}_${c}_${o}"
file_name="$base_name"
if [ "$lex_opt" = "lex-greatest" ]; then
file_name="${base_name}_lex_greatest"
elif [ "$lex_opt" = "no-lex" ]; then
file_name="${base_name}_no_lex"
fi
echo "Debug: base_name=$base_name"
echo "Debug: file_name=$file_name"
if [ -f "$file_name" ]
then
echo "instance already generated"
else
if [ $o -eq 1 ]
then
echo "Debug: Calling generate.py with: $n $c $lex_opt"
python3 gen_instance/generate.py $n $c "$lex_opt" #generate the instance of order n
else
echo "using extended definition of KS system..."
echo "Debug: Calling generate-def2.py with: $n $c $lex_opt"
python3 gen_instance/generate-def2.py $n $c "$lex_opt" #generate the instance of order n
fi
fi