scripts for learning
authorHamed Gorjiara <hgorjiar@uci.edu>
Fri, 28 Dec 2018 00:33:14 +0000 (16:33 -0800)
committerHamed Gorjiara <hgorjiar@uci.edu>
Fri, 28 Dec 2018 00:33:14 +0000 (16:33 -0800)
common.sh
hexiom/bench.sh
hexiom/learn.sh [new file with mode: 0755]
killerSudoku/bench.sh
killerSudoku/learn.sh [new file with mode: 0755]
nqueens/bench.sh
nqueens/learn.sh [new file with mode: 0755]
sudoku-csolver/bench.sh
sudoku-csolver/learn.sh [new file with mode: 0755]

index b53fb39592dc91fd2efe7d91976b689b6601bb6c..18bd051e086b2b2f51726f0e33bd07b2e32ad53a 100755 (executable)
--- a/common.sh
+++ b/common.sh
@@ -4,3 +4,7 @@ OFILE=result.csv
 TEMP="temp.out"
 DUMPDIR="dumps"
 TIMEMAX=5000s
+ROUND=15
+BUDGET=15
+TUNERCONF="onehottuner.conf binarytuner.conf unarytuner.conf"
+
index 6cbb7657523013670574e58a8bd276183192dd5a..76750f548b346dd82074fd330a544b048e10aadf 100755 (executable)
@@ -38,7 +38,8 @@ for PAR in $PARAMETERS; do
                                echo "DONE!" >>$TEMP
                                 echo "Program Execution Time: $DIFF" >>$TEMP
                                mkdir -p $DUMPDIR
-                               mv DUMP* $DUMPDIR
+                               mv DUMP* "$PAR.dump"
+                               mv "$PAR.dump" $DUMPDIR
                        elif [ $2 = '--csolver' ]; then
                                START=$(date +%s.%N)
                                timeout $TIMEMAX ./run.sh csolverHexiom.py $PAR --csolver >> $TEMP
diff --git a/hexiom/learn.sh b/hexiom/learn.sh
new file mode 100755 (executable)
index 0000000..b624784
--- /dev/null
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+#Terminate the script if even one command fails
+set -e
+
+
+#Variables
+source ../common.sh
+BIN=../../bin
+BDIR=../Benchmarks/hexiom/learningset/
+
+#Checking the number of 
+if [ "$#" -lt 1 ]; then
+       echo "Illegal number of argument"
+       echo "./learn.sh [LearningSet]"
+       exit 1
+fi
+if [ "$1" -gt 2 ]; then
+       echo "Only 3 sets are available for learning. Parameter should be less than 3"
+       echo "./bench.sh [NUMBER] [--csolver/--dump]"
+       exit 1
+fi
+
+
+declare -a LearningSet=("${BDIR}38.dump ${BDIR}41.dump ${BDIR}43.dump ${BDIR}44.dump ${BDIR}46.dump ${BDIR}47.dump ${BDIR}49.dump ${BDIR}50.dump"
+"${BDIR}36.dump ${BDIR}41.dump ${BDIR}42.dump ${BDIR}44.dump ${BDIR}45.dump ${BDIR}47.dump ${BDIR}48.dump ${BDIR}50.dump" 
+"${BDIR}36.dump ${BDIR}38.dump ${BDIR}42.dump ${BDIR}43.dump ${BDIR}45.dump ${BDIR}46.dump ${BDIR}48.dump ${BDIR}49.dump")
+
+echo ${LearningSet[$1]}
+cd $BIN
+./run.sh serializestatictuner
+./run.sh runmultituner $BUDGET $ROUND ${LearningSet[$1]} - $TUNERCONF
+
index b470a49e53dc6227527c7fc2108cebcebbb4f297..c572fa4c31168aaef02f70b4af544be9c16cb96a 100755 (executable)
@@ -37,7 +37,10 @@ for PAR in $PROBLEMS; do
                                 echo "DONE!" >> $TEMP
                                 echo "Program Execution Time: $DIFF" >>$TEMP
                                mkdir -p $DUMPDIR
-                               mv DUMP* $DUMPDIR
+                               filename=$(basename -- "$PAR")
+                                filename="${filename%.*}"
+                                mv DUMP* "$filename.dump"
+                                mv "$filename.dump" $DUMPDIR   
                        elif [ $2 = '--csolver' ]; then
                                START=$(date +%s.%N)
                                timeout $TIMEMAX ./run.sh python killerSolver.py --problem $PAR --csolver >> $TEMP
diff --git a/killerSudoku/learn.sh b/killerSudoku/learn.sh
new file mode 100755 (executable)
index 0000000..749cb0f
--- /dev/null
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+#Terminate the script if even one command fails
+set -e
+
+
+#Variables
+source ../common.sh
+BIN=../../bin
+BDIR=../Benchmarks/sudoku-csolver/learningset/
+
+#Checking the number of 
+if [ "$#" -lt 1 ]; then
+       echo "Illegal number of argument"
+       echo "./learn.sh [LearningSet]"
+       exit 1
+fi
+if [ "$1" -gt 2 ]; then
+       echo "Only 3 sets are available for learning. Parameter should be less than 3"
+       echo "./bench.sh [NUMBER] [--csolver/--dump]"
+       exit 1
+fi
+
+
+declare -a LearningSet=("${BDIR}2-25-5.dump ${BDIR}2-25.dump ${BDIR}36x36-591.dump ${BDIR}2-36-3.dump ${BDIR}2-36-4.dump ${BDIR}2-36.dump ${BDIR}4-16-2.dump ${BDIR}4-16.dump ${BDIR}5-16.dump"
+"${BDIR}2-25-4.dump ${BDIR}2-25.dump ${BDIR}2-36-2.dump ${BDIR}2-36-4.dump ${BDIR}2-36-5.dump ${BDIR}4-16-2.dump ${BDIR}4-16-3.dump ${BDIR}5-16.dump ${BDIR}6-16.dump" 
+"${BDIR}2-25-4.dump ${BDIR}2-25-5.dump ${BDIR}2-36-2.dump ${BDIR}2-36-3.dump ${BDIR}2-36-5.dump ${BDIR}2-36.dump ${BDIR}4-16-3.dump ${BDIR}4-16.dump ${BDIR}6-16.dummp")
+
+echo ${LearningSet[$1]}
+cd $BIN
+./run.sh serializestatictuner
+./run.sh runmultituner $BUDGET $ROUND ${LearningSet[$1]} - $TUNERCONF
+
index e3a3b225828488c2893bfd1f44a6571aed87b3c8..1408e25f225da10742e047541637c6e6b7aca54e 100755 (executable)
@@ -37,7 +37,8 @@ for PAR in $PARAMETERS; do
                                 echo "DONE!" >> $TEMP
                                 echo "Program Execution Time: $DIFF" >>$TEMP
                                mkdir -p $DUMPDIR
-                               mv DUMP* $DUMPDIR
+                               mv DUMP* "$PAR.dump"
+                               mv "$PAR.dump" $DUMPDIR
                        elif [ $2 = '--csolver' ]; then
                                START=$(date +%s.%N)
                                timeout $TIMEMAX ./run.sh nqueen $PAR --csolver >> $TEMP
diff --git a/nqueens/learn.sh b/nqueens/learn.sh
new file mode 100755 (executable)
index 0000000..24afb95
--- /dev/null
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+#Terminate the script if even one command fails
+set -e
+
+
+#Variables
+source ../common.sh
+BIN=../../bin
+BDIR=../Benchmarks/nqueens/learningset/
+
+#Checking the number of 
+if [ "$#" -lt 1 ]; then
+       echo "Illegal number of argument"
+       echo "./learn.sh [LearningSet]"
+       exit 1
+fi
+if [ "$1" -gt 2 ]; then
+       echo "Only 3 sets are available for learning. Parameter should be less than 3"
+       echo "./bench.sh [NUMBER] [--csolver/--dump]"
+       exit 1
+fi
+
+
+declare -a LearningSet=("${BDIR}96.dump ${BDIR}112.dump ${BDIR}144.dump ${BDIR}160.dump ${BDIR}224.dump ${BDIR}256.dump ${BDIR}320.dump ${BDIR}352.dump"
+"${BDIR}64.dump ${BDIR}112.dump ${BDIR}128.dump ${BDIR}160.dump ${BDIR}192.dump ${BDIR}256.dump ${BDIR}288.dump ${BDIR}352.dump ${BDIR}384.dump" 
+"${BDIR}64.dump ${BDIR}96.dump ${BDIR}128.dump ${BDIR}144.dump ${BDIR}192.dump ${BDIR}224.dump ${BDIR}288.dump ${BDIR}320.dump ${BDIR}384.dump")
+
+echo ${LearningSet[$1]}
+cd $BIN
+./run.sh serializestatictuner
+./run.sh runmultituner $BUDGET $ROUND ${LearningSet[$1]} - $TUNERCONF
+
index ec396a8ebecb33d96db7dcc7b38b71f9980ff061..8e7050997ec4d3035b7731cbe13c62eb5a7e4d43 100755 (executable)
@@ -37,7 +37,10 @@ for PAR in $PROBLEMS; do
                                 echo "DONE!" >> $TEMP
                                 echo "Program Execution Time: $DIFF" >>$TEMP
                                mkdir -p $DUMPDIR
-                               mv DUMP* $DUMPDIR
+                               filename=$(basename -- "$PAR")
+                               filename="${filename%.*}"
+                               mv DUMP* "$filename.dump"
+                               mv "$filename.dump" $DUMPDIR
                        elif [ $2 = '--csolver' ]; then
                                START=$(date +%s.%N)
                                timeout $TIMEMAX ./run.sh python Sudoku.py --file $PAR --csolver >> $TEMP
diff --git a/sudoku-csolver/learn.sh b/sudoku-csolver/learn.sh
new file mode 100755 (executable)
index 0000000..69bce2c
--- /dev/null
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+#Terminate the script if even one command fails
+set -e
+
+
+#Variables
+source ../common.sh
+BIN=../../bin
+BDIR=../Benchmarks/sudoku-csolver/learningset/
+
+#Checking the number of 
+if [ "$#" -lt 1 ]; then
+       echo "Illegal number of argument"
+       echo "./learn.sh [LearningSet]"
+       exit 1
+fi
+if [ "$1" -gt 2 ]; then
+       echo "Only 3 sets are available for learning. Parameter should be less than 3"
+       echo "./bench.sh [NUMBER] [--csolver/--dump]"
+       exit 1
+fi
+
+
+declare -a LearningSet=("${BDIR}36x36-591.dump ${BDIR}36x36-592.dump ${BDIR}36x36-594.dump ${BDIR}36x36-595.dump ${BDIR}36x36-597.dump ${BDIR}36x36-598.dump ${BDIR}36x36-600.dump ${BDIR}36x36-892.dump ${BDIR}36x36-895.dump ${BDIR}36x36-896.dump ${BDIR}36x36-898.dump"
+"${BDIR}36x36-590.dump ${BDIR}36x36-592.dump ${BDIR}36x36-593.dump ${BDIR}36x36-595.dump ${BDIR}36x36-596.dump ${BDIR}36x36-598.dump ${BDIR}36x36-599.dump ${BDIR}36x36-892.dump ${BDIR}36x36-893.dump ${BDIR}36x36-896.dump ${BDIR}36x36-897.dump" 
+"${BDIR}36x36-590.dump ${BDIR}36x36-591.dump ${BDIR}36x36-593.dump ${BDIR}36x36-596.dump ${BDIR}36x36-597.dump ${BDIR}36x36-599.dump ${BDIR}36x36-600.dump ${BDIR}36x36-893.dump ${BDIR}36x36-895.dump ${BDIR}36x36-897.dump ${BDIR}36x36-898.dump")
+
+echo ${LearningSet[$1]}
+cd $BIN
+./run.sh serializestatictuner
+./run.sh runmultituner $BUDGET $ROUND ${LearningSet[$1]} - $TUNERCONF
+