Generating SMT tables
[satune.git] / src / Scripts / runinterpreter.sh
1 #!/bin/bash
2 # run as the following:
3 # ./runalloy.sh [hexiom] [--alloy]
4 # ./runalloy.sh [nqueens] [--alloy]
5 # ./runalloy.sh [sudoku-csolver] [--alloy]
6 # ./runalloy.sh [killerSudoku] [--alloy]
7
8 #./run.sh deserializealloytest ../Benchmarks/sudoku-csolver/4x4.dump --alloy
9 #./run.sh java edu.mit.csail.sdg.alloy4whole.ExampleAlloyCompilerNoViz satune.als > solution.log
10 if [ "$#" -lt 2 ]; then
11         echo "Illegal number of argument"
12         echo "./runinterpreter.sh [benchmark] [--alloy/--z3/--smtrat/--mathsat/--all] [timeout]"
13         exit 1
14 fi
15
16
17 BIN=./bin
18 OUTPUT="$1-SMTsolvers.csv"
19 DUMP=$(find . -name "*.dump")
20 cd $BIN
21 LINE="Benchmark, Alloy, Z3, Smtrat, Mathsat"
22 echo $Line > $OUTPUT
23 for d in $DUMP; do
24         if [[ $d = *$1* ]] && [[ $d = *learningset* ]]; then
25                 echo $d
26                 if [[ $2 = *--all* ]]; then
27                         SOLVERS="--alloy --z3 --smtrat --mathsat"
28                         LINE=""
29                         for solver in $SOLVERS; do
30                                 START=$(date +%s.%N)
31                                 echo "./run.sh deserializealloytest .$d $solver $3"
32                                 ./run.sh deserializealloytest "."$d $solver $3
33                                 END=$(date +%s.%N)
34                                 DIFF=$(echo "$END - $START" | bc)
35                                 LINE="$LINE,$DIFF"
36                         done
37                         echo "$d$LINE" >> $OUTPUT
38                 else
39                         START=$(date +%s.%N)
40                         ./run.sh deserializealloytest "."$d $2 $3
41                         END=$(date +%s.%N)
42                         DIFF=$(echo "$END - $START" | bc)
43                         echo "CSOLVER solve time: $DIFF"
44                         cat solution.sol
45                         echo "Best tuner"
46                 fi
47                 
48         fi
49 done