From: Hamed Gorjiara Date: Sat, 28 Apr 2018 19:48:03 +0000 (-0700) Subject: Fixing autoTuner's bug + making logs more legible X-Git-Url: http://plrg.eecs.uci.edu/git/?p=satune.git;a=commitdiff_plain;h=ab3148a0a14a748cb589829029ed0bd40788f972 Fixing autoTuner's bug + making logs more legible --- diff --git a/src/Tuner/autotuner.cc b/src/Tuner/autotuner.cc index bdfeb61..4a35fcd 100644 --- a/src/Tuner/autotuner.cc +++ b/src/Tuner/autotuner.cc @@ -5,8 +5,10 @@ #include #include +#define UNSETVALUE -1 + AutoTuner::AutoTuner(uint _budget) : - budget(_budget) { + budget(_budget), result(UNSETVALUE) { } void AutoTuner::addProblem(CSolver *solver) { @@ -17,7 +19,13 @@ long long AutoTuner::evaluate(CSolver *problem, SearchTuner *tuner) { CSolver *copy = problem->clone(); copy->setTuner(tuner); model_print("**********************\n"); - int result = copy->solve(); + int sat = copy->solve(); + if(result == UNSETVALUE) + result = sat; + else if(result != sat){ + model_print("&&&&&&&&&&&&&&&&&& Result has changed &&&&&&&&&&&&&\n"); + copy->printConstraints(); + } //model_print("SAT %d\n", result); long long elapsedTime = copy->getElapsedTime(); // long long encodeTime = copy->getEncodeTime(); diff --git a/src/Tuner/autotuner.h b/src/Tuner/autotuner.h index d9fb430..0346e42 100644 --- a/src/Tuner/autotuner.h +++ b/src/Tuner/autotuner.h @@ -16,5 +16,6 @@ private: Vector solvers; uint budget; + int result; }; #endif diff --git a/src/Tuner/searchtuner.cc b/src/Tuner/searchtuner.cc index c119597..a0fc1bc 100644 --- a/src/Tuner/searchtuner.cc +++ b/src/Tuner/searchtuner.cc @@ -42,10 +42,10 @@ void TunableSetting::setDecision(int _low, int _high, int _default, int _selecti void TunableSetting::print() { if (hasVar) { - model_print("Type1 %" PRIu64 ", ", type1); - model_print("Type2 %" PRIu64 ", ", type2); + model_print("VarType1 %" PRIu64 ", ", type1); + model_print("VarType2 %" PRIu64 ", ", type2); } - model_print("Param %u = %u\n", param, selectedValue); + model_print("Param %s = %u \t range=[%u,%u]\n", tunableParameterToString( (Tunables)param), selectedValue, lowValue, highValue); } unsigned int tunableSettingHash(TunableSetting *setting) { diff --git a/src/Tuner/tunable.cc b/src/Tuner/tunable.cc index eeba3a2..a57a601 100644 --- a/src/Tuner/tunable.cc +++ b/src/Tuner/tunable.cc @@ -14,3 +14,30 @@ int DefaultTuner::getVarTunable(VarType vartype, TunableParam param, TunableDesc int DefaultTuner::getVarTunable(VarType vartype1, VarType vartype2, TunableParam param, TunableDesc *descriptor) { return descriptor->defaultValue; } + +const char* tunableParameterToString(Tunables tunable){ + switch(tunable){ + case DECOMPOSEORDER: + return "DECOMPOSEORDER"; + case MUSTREACHGLOBAL: + return "MUSTREACHGLOBAL"; + case MUSTREACHLOCAL: + return "MUSTREACHLOCAL"; + case MUSTREACHPRUNE: + return "MUSTREACHPRUNE"; + case OPTIMIZEORDERSTRUCTURE: + return "OPTIMIZEORDERSTRUCTURE"; + case ORDERINTEGERENCODING: + return "ORDERINTEGERENCODING"; + case PREPROCESS: + return "PREPROCESS"; + case NODEENCODING: + return "NODEENCODING"; + case EDGEENCODING: + return "EDGEENCODING"; + case MUSTEDGEPRUNE: + return "MUSTEDGEPRUNE"; + default: + ASSERT(0); + } +} \ No newline at end of file diff --git a/src/Tuner/tunable.h b/src/Tuner/tunable.h index 9edcd3c..fcc97be 100644 --- a/src/Tuner/tunable.h +++ b/src/Tuner/tunable.h @@ -41,4 +41,6 @@ static TunableDesc offon(0, 1, 0); enum Tunables {DECOMPOSEORDER, MUSTREACHGLOBAL, MUSTREACHLOCAL, MUSTREACHPRUNE, OPTIMIZEORDERSTRUCTURE, ORDERINTEGERENCODING, PREPROCESS, NODEENCODING, EDGEENCODING, MUSTEDGEPRUNE}; typedef enum Tunables Tunables; + +const char* tunableParameterToString(Tunables tunable); #endif