Auto Tuner Initial Full Checkin
authorbdemsky <bdemsky@uci.edu>
Mon, 28 Aug 2017 21:41:46 +0000 (14:41 -0700)
committerbdemsky <bdemsky@uci.edu>
Mon, 28 Aug 2017 21:41:46 +0000 (14:41 -0700)
src/Tuner/searchtuner.cc
src/Tuner/searchtuner.h
src/csolver.cc
src/csolver.h

index fdc9835..e964f45 100644 (file)
@@ -30,6 +30,13 @@ void TunableSetting::setDecision(int _low, int _high, int _default, int _selecti
        selectedValue = _selection;
 }
 
+void TunableSetting::print() {
+       if (hasVar) {
+               model_print("Type %llu, ", type);
+       }
+       model_print("Param %u = %u\n", param, selectedValue);
+}
+
 unsigned int tunableSettingHash(TunableSetting *setting) {
        return setting->hasVar ^ setting->type ^ setting->param;
 }
@@ -105,3 +112,22 @@ void SearchTuner::randomMutate() {
        else
                randomSetting->selectedValue = randomchoice + 1;
 }
+
+void SearchTuner::print() {
+       HSIteratorTunableSetting *iterator=settings.iterator();
+       while(iterator->hasNext()) {
+               TunableSetting *setting=iterator->next();
+               setting->print();
+       }
+       delete iterator;
+
+}
+
+void SearchTuner::printUsed() {
+       HSIteratorTunableSetting *iterator=usedSettings.iterator();
+       while(iterator->hasNext()) {
+               TunableSetting *setting=iterator->next();
+               setting->print();
+       }
+       delete iterator;
+}
index bf96b29..b41a3e0 100644 (file)
@@ -10,6 +10,7 @@ class TunableSetting {
        TunableSetting(TunableParam param);
        TunableSetting(TunableSetting * ts);
        void setDecision(int _low, int _high, int _default, int _selection);
+       void print();
        MEMALLOC;
  private:
        bool hasVar;
@@ -39,7 +40,9 @@ class SearchTuner : public Tuner {
        SearchTuner * copyUsed();
        void randomMutate();
        uint getSize() { return usedSettings.getSize();}
-       
+       void print();
+       void printUsed();
+
        MEMALLOC;
  private:
        /** Used Settings keeps track of settings that were actually used by
index eecbaf3..a9a4f62 100644 (file)
@@ -243,8 +243,8 @@ long long CSolver::getEncodeTime() { return satEncoder->getEncodeTime(); }
 
 long long CSolver::getSolveTime() { return satEncoder->getSolveTime(); }
 
-void CSolver::autoTune() {
-       AutoTuner * autotuner=new AutoTuner();
+void CSolver::autoTune(uint budget) {
+       AutoTuner * autotuner=new AutoTuner(budget);
        autotuner->addProblem(this);
        autotuner->tune();
 }
index 7939ee5..92900a1 100644 (file)
@@ -117,7 +117,7 @@ public:
        void replaceBooleanWithFalse(Boolean *bexpr);
        void replaceBooleanWithBoolean(Boolean *oldb, Boolean *newb);
        CSolver *clone();
-       void autoTune();
+       void autoTune(uint budget);
 
        void setTuner(Tuner * _tuner) { tuner = _tuner; }
        long long getElapsedTime() { return elapsedTime; }