tabbing more tuners
authorbdemsky <bdemsky@uci.edu>
Tue, 26 Mar 2019 22:45:45 +0000 (15:45 -0700)
committerbdemsky <bdemsky@uci.edu>
Tue, 26 Mar 2019 22:45:45 +0000 (15:45 -0700)
src/Backend/constraint.cc [changed mode: 0755->0644]
src/Test/orderbm.cc
src/Test/serializestatictuner.cc
src/Tuner/basictuner.cc
src/Tuner/satuner.cc

old mode 100755 (executable)
new mode 100644 (file)
index d69e194..f92c223
@@ -201,8 +201,8 @@ Edge constraintOR(CNF *cnf, uint numEdges, Edge *edges) {
                Edge eand = constraintAND(cnf, numEdges, edgearray);
                return constraintNegate(eand);
        } else {
-               Edge * edgearray=(Edge *)ourmalloc(numEdges*sizeof(Edge));
-               
+               Edge *edgearray = (Edge *)ourmalloc(numEdges * sizeof(Edge));
+
                for (uint i = 0; i < numEdges; i++) {
                        edgearray[i] = constraintNegate(edges[i]);
                }
index af3bd91..239c542 100644 (file)
@@ -7,38 +7,38 @@
  * Result: O(5,1)=0 O(1,4)=0 O(5,4)=0 O(1,5)=1 O(1111,5)=2
  */
 int main(int numargs, char **argv) {
-  if (numargs < 4) {
-    printf("Requires the following arguments: numpoints numclauses maxclausesize randomseed\n");
-    return -1;
-  }
-  int numpoints = atoi(argv[1]);
-  int numclauses = atoi(argv[2]);
-  int maxclause = atoi(argv[3]);
-  srandom(atoi(argv[4]));
-  
-  CSolver *solver = new CSolver();
-  Set *s =solver->createRangeSet(0, 0, numpoints);
-  Order *order = solver->createOrder(SATC_TOTAL, s);
-  BooleanEdge be[maxclause];
-  for(int i = 0; i < numclauses; i++) {
-    int numterms = (random() % (maxclause -1)) + 1;
-    
-    for(int j = 0; j < numterms; j++) {    
-      uint src = random() % (numpoints - 1);
-      uint dst;
-      do {
-       dst = random() % numpoints;
-      } while (src == dst || ((false) && (src > dst)));
-      
-      be[j] =  solver->orderConstraint(order, src, dst);
-    }
-    solver->addConstraint(solver->applyLogicalOperation(SATC_OR, be, numterms));
-  }
-  solver->serialize();
-  if (solver->solve() == 1) {
-    printf("SAT\n");
-  } else {
-    printf("UNSAT\n");
-  }
-  delete solver;
+       if (numargs < 4) {
+               printf("Requires the following arguments: numpoints numclauses maxclausesize randomseed\n");
+               return -1;
+       }
+       int numpoints = atoi(argv[1]);
+       int numclauses = atoi(argv[2]);
+       int maxclause = atoi(argv[3]);
+       srandom(atoi(argv[4]));
+
+       CSolver *solver = new CSolver();
+       Set *s = solver->createRangeSet(0, 0, numpoints);
+       Order *order = solver->createOrder(SATC_TOTAL, s);
+       BooleanEdge be[maxclause];
+       for (int i = 0; i < numclauses; i++) {
+               int numterms = (random() % (maxclause - 1)) + 1;
+
+               for (int j = 0; j < numterms; j++) {
+                       uint src = random() % (numpoints - 1);
+                       uint dst;
+                       do {
+                               dst = random() % numpoints;
+                       } while (src == dst || ((false) && (src > dst)));
+
+                       be[j] =  solver->orderConstraint(order, src, dst);
+               }
+               solver->addConstraint(solver->applyLogicalOperation(SATC_OR, be, numterms));
+       }
+       solver->serialize();
+       if (solver->solve() == 1) {
+               printf("SAT\n");
+       } else {
+               printf("UNSAT\n");
+       }
+       delete solver;
 }
index 6c45511..3a314e0 100644 (file)
 #include <stdlib.h>
 
 int main(int argc, char **argv) {
-       SearchTuner *elem_bin = new SearchTuner();
-       SearchTuner *elem_onehot = new SearchTuner();
-       SearchTuner *elem_unary = new SearchTuner();
-       elem_bin->setTunable(NAIVEENCODER, &NaiveEncodingDesc, BINARYINDEX);
-       elem_onehot->setTunable(NAIVEENCODER, &NaiveEncodingDesc, ONEHOT);
-       elem_unary->setTunable(NAIVEENCODER, &NaiveEncodingDesc, UNARY);
+       {
+               SearchTuner *elem_bin = new SearchTuner();
+               SearchTuner *elem_onehot = new SearchTuner();
+               SearchTuner *elem_unary = new SearchTuner();
+               elem_bin->setTunable(NAIVEENCODER, &NaiveEncodingDesc, BINARYINDEX);
+               elem_onehot->setTunable(NAIVEENCODER, &NaiveEncodingDesc, ONEHOT);
+               elem_unary->setTunable(NAIVEENCODER, &NaiveEncodingDesc, UNARY);
 
-       elem_bin->serialize("binarytuner.conf");
-       elem_onehot->serialize("onehottuner.conf");
-       elem_unary->serialize("unarytuner.conf");
-       elem_bin->setTunable(ENCODINGGRAPHOPT, &onoff, 1);
-       elem_onehot->setTunable(ENCODINGGRAPHOPT, &onoff, 1);
-       elem_unary->setTunable(ENCODINGGRAPHOPT, &onoff, 1);
-       elem_bin->serialize("circuitbinarytuner.conf");
-       elem_onehot->serialize("circuitonehottuner.conf");
-       elem_unary->serialize("circuitunarytuner.conf");
-       delete elem_bin;
-       delete elem_onehot;
-       delete elem_unary;
+               elem_bin->serialize("binarytuner.conf");
+               elem_onehot->serialize("onehottuner.conf");
+               elem_unary->serialize("unarytuner.conf");
+               elem_bin->setTunable(ENCODINGGRAPHOPT, &offon, 1);
+               elem_onehot->setTunable(ENCODINGGRAPHOPT, &offon, 1);
+               elem_unary->setTunable(ENCODINGGRAPHOPT, &offon, 1);
+               elem_bin->serialize("circuitbinarytuner.conf");
+               elem_onehot->serialize("circuitonehottuner.conf");
+               elem_unary->serialize("circuitunarytuner.conf");
+               elem_bin->setTunable(DECOMPOSEORDER, &onoff, 0);
+               elem_onehot->setTunable(DECOMPOSEORDER, &onoff, 0);
+               elem_unary->setTunable(DECOMPOSEORDER, &onoff, 0);
+               elem_bin->serialize("circuitbinarytunernodecompose.conf");
+               elem_onehot->serialize("circuitonehottunernodecompose.conf");
+               elem_unary->serialize("circuitunarytunernodecompose.conf");
+               delete elem_bin;
+               delete elem_onehot;
+               delete elem_unary;
+       }
+       {
+               SearchTuner *elem_bin = new SearchTuner();
+               SearchTuner *elem_onehot = new SearchTuner();
+               SearchTuner *elem_unary = new SearchTuner();
+               elem_bin->setTunable(NAIVEENCODER, &NaiveEncodingDesc, BINARYINDEX);
+               elem_onehot->setTunable(NAIVEENCODER, &NaiveEncodingDesc, ONEHOT);
+               elem_unary->setTunable(NAIVEENCODER, &NaiveEncodingDesc, UNARY);
+               elem_bin->setTunable(DECOMPOSEORDER, &onoff, 0);
+               elem_onehot->setTunable(DECOMPOSEORDER, &onoff, 0);
+               elem_unary->setTunable(DECOMPOSEORDER, &onoff, 0);
+               elem_bin->serialize("binarytunernodecompose.conf");
+               elem_onehot->serialize("onehottunernodecompose.conf");
+               elem_unary->serialize("unarytunernodecompose.conf");
+               delete elem_bin;
+               delete elem_onehot;
+               delete elem_unary;
+       }
+
+
+       {
+               SearchTuner *elem_bin = new SearchTuner();
+               SearchTuner *elem_onehot = new SearchTuner();
+               SearchTuner *elem_unary = new SearchTuner();
+               elem_bin->setTunable(NAIVEENCODER, &NaiveEncodingDesc, BINARYINDEX);
+               elem_onehot->setTunable(NAIVEENCODER, &NaiveEncodingDesc, ONEHOT);
+               elem_unary->setTunable(NAIVEENCODER, &NaiveEncodingDesc, UNARY);
+               elem_bin->setTunable(ORDERINTEGERENCODING, &offon, 1);
+               elem_onehot->setTunable(ORDERINTEGERENCODING, &offon, 1);
+               elem_unary->setTunable(ORDERINTEGERENCODING, &offon, 1);
+
+               elem_bin->serialize("binarytunerint.conf");
+               elem_onehot->serialize("onehottunerint.conf");
+               elem_unary->serialize("unarytunerint.conf");
+               elem_bin->setTunable(ENCODINGGRAPHOPT, &offon, 1);
+               elem_onehot->setTunable(ENCODINGGRAPHOPT, &offon, 1);
+               elem_unary->setTunable(ENCODINGGRAPHOPT, &offon, 1);
+               elem_bin->serialize("circuitbinarytunerint.conf");
+               elem_onehot->serialize("circuitonehottunerint.conf");
+               elem_unary->serialize("circuitunarytunerint.conf");
+               elem_bin->setTunable(DECOMPOSEORDER, &onoff, 0);
+               elem_onehot->setTunable(DECOMPOSEORDER, &onoff, 0);
+               elem_unary->setTunable(DECOMPOSEORDER, &onoff, 0);
+               elem_bin->serialize("circuitbinarytunernodecomposeint.conf");
+               elem_onehot->serialize("circuitonehottunernodecomposeint.conf");
+               elem_unary->serialize("circuitunarytunernodecomposeint.conf");
+               delete elem_bin;
+               delete elem_onehot;
+               delete elem_unary;
+       }
+       {
+               SearchTuner *elem_bin = new SearchTuner();
+               SearchTuner *elem_onehot = new SearchTuner();
+               SearchTuner *elem_unary = new SearchTuner();
+               elem_bin->setTunable(NAIVEENCODER, &NaiveEncodingDesc, BINARYINDEX);
+               elem_onehot->setTunable(NAIVEENCODER, &NaiveEncodingDesc, ONEHOT);
+               elem_unary->setTunable(NAIVEENCODER, &NaiveEncodingDesc, UNARY);
+               elem_bin->setTunable(ORDERINTEGERENCODING, &offon, 1);
+               elem_onehot->setTunable(ORDERINTEGERENCODING, &offon, 1);
+               elem_unary->setTunable(ORDERINTEGERENCODING, &offon, 1);
+               elem_bin->setTunable(DECOMPOSEORDER, &onoff, 0);
+               elem_onehot->setTunable(DECOMPOSEORDER, &onoff, 0);
+               elem_unary->setTunable(DECOMPOSEORDER, &onoff, 0);
+               elem_bin->serialize("binarytunernodecomposeint.conf");
+               elem_onehot->serialize("onehottunernodecomposeint.conf");
+               elem_unary->serialize("unarytunernodecomposeint.conf");
+               delete elem_bin;
+               delete elem_onehot;
+               delete elem_unary;
+       }
 }
index 122f4d3..8ec104c 100644 (file)
@@ -157,7 +157,7 @@ long long BasicTuner::evaluate(Problem *problem, TunerRecord *tuner) {
        uint timeinsecs = problem->getBestTime() / NANOSEC;
        uint adaptive = (timeinsecs > 30) ? timeinsecs * 5 : 150;
        uint maxtime = (adaptive < timeout) ? adaptive : timeout;
-       uint satuneTimeout = 2*maxtime;
+       uint satuneTimeout = 2 * maxtime;
        //Do run
        snprintf(buffer, sizeof(buffer), "timeout %u ./run.sh deserializerun %s %u tuner%u result%u > log%u", satuneTimeout, problem->getProblem(), maxtime, execnum, execnum, execnum);
        model_print("Running: %s\n", buffer);
index 2775081..6a80ecd 100644 (file)
@@ -153,20 +153,20 @@ void SATuner::tune() {
                        TunerRecord *tuner2 = tunerV->get(tunerNumber + i);
                        ASSERT( tunerNumber + i < tunerV->getSize());
                        model_print("Tuner1 = %d \tTuner2 = %d\n", tuner1->getTunerNumber(), tuner2->getTunerNumber());
-                       
+
                        int score1, score2;
-                       if(!scores.contains(tuner1)){
+                       if (!scores.contains(tuner1)) {
                                score1 = 0;
-                       }else {
+                       } else {
                                score1 = scores.get(tuner1);
                        }
-                       if(!scores.contains(tuner2)){
-                               score2=0;
-                       }else {
-                               score2= scores.get(tuner2);
+                       if (!scores.contains(tuner2)) {
+                               score2 = 0;
+                       } else {
+                               score2 = scores.get(tuner2);
                        }
-                       
-                       if( score2 > score1 ){
+
+                       if ( score2 > score1 ) {
                                removeTunerIndex(tunerV, i, allplaces);
                        } else if ( score2 < score1) {
                                model_print("score1=%d\tscore2=%d\tt=%u\texp=%f\n", score1, score2, t, exp((score1 - score2) * 1.0 / t));