-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathli-results.sh
More file actions
43 lines (34 loc) · 872 Bytes
/
Copy pathli-results.sh
File metadata and controls
43 lines (34 loc) · 872 Bytes
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
#!/bin/sh
# Small script to gather data from picosat and your own SAT solver
# Useful for LI prac 01
#
# Example usage:
# ./li-results.sh > out.txt
# Your solver
BIN=./solver
info() {
echo "$@" >&2
}
write_results() {
local name="$1"
local raw="$2"
SATI=$(echo "$raw" | sed -n '/^s /s/s \([^ ]\+\).*/\1/p')
TIME=$(echo "$raw" | sed -n 's/^c \(.*\) total run time$/\1/p')
NDEC=$(echo "$raw" | sed -n 's/^c \(.*\) decisions$/\1/p')
NPPS=$(echo "$raw" | sed -n 's/^c \(.*props.*\)$/\1/p')
echo "## $name"
echo "$SATI"
echo "Total time: $TIME"
echo "Total number of decisions: $NDEC"
echo "Propagations per second: $NPPS"
echo
}
for f in $(ls tests/*.cnf); do
echo "$f"
echo "========================"
echo
info "picosat -v < $f"
write_results "Picosat" "$(picosat -v < $f)"
info "$BIN < $f"
write_results "Own SAT solver" "$($BIN < $f)"
done