Last active
August 29, 2015 14:15
-
-
Save mvdan/fe359bfadde791980f4b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" | |
satisfiable=$(echo "$raw" | sed -n '/^s /s/s \([^ ]\+\).*/\1/p') | |
totaltime=$(echo "$raw" | sed -n 's/^c \(.*\) total run time$/\1/p') | |
numdecisions=$(echo "$raw" | sed -n 's/^c \(.*\) decisions$/\1/p') | |
propspersec=$(echo "$raw" | sed -n 's/^c \(.*props.*\)$/\1/p') | |
echo "## $name" | |
echo "Satisfiability: $satisfiable" | |
echo "Total time: $totaltime" | |
echo "Total number of decisions: $numdecisions" | |
echo "Propagations per second: $propspersec" | |
echo | |
} | |
for f in $(find . -type f -name '*.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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment