X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=src%2FTuner%2Fsearchtuner.h;h=935f5277db5f6c3b56fa532410ca4b92af611b6d;hb=875bd2edcb1767a727ea40419cc601670091f2ed;hp=26fd8df51a66004fa23c1fda5462902811320cd9;hpb=3ea7df0292dcc11b7a60a186d375bda980d771e5;p=satune.git diff --git a/src/Tuner/searchtuner.h b/src/Tuner/searchtuner.h index 26fd8df..935f527 100644 --- a/src/Tuner/searchtuner.h +++ b/src/Tuner/searchtuner.h @@ -5,7 +5,6 @@ #include "structs.h" #include using namespace std; -#define TUNEFILE "tune.conf" class TunableSetting { public: @@ -29,30 +28,32 @@ private: friend unsigned int tunableSettingHash(TunableSetting *setting); friend bool tunableSettingEquals(TunableSetting *setting1, TunableSetting *setting2); friend class SearchTuner; + friend class SerializeTuner; }; -unsigned int tunableSettingHash(TunableSetting *setting); -bool tunableSettingEquals(TunableSetting *setting1, TunableSetting *setting2); - -typedef Hashset HashsetTunableSetting; -typedef SetIterator SetIteratorTunableSetting; - class SearchTuner : public Tuner { public: SearchTuner(); + SearchTuner(const char *filename, bool addused = false); ~SearchTuner(); - int getTunable(TunableParam param, TunableDesc *descriptor); + virtual int getTunable(TunableParam param, TunableDesc *descriptor); int getVarTunable(VarType vartype, TunableParam param, TunableDesc *descriptor); - int getVarTunable(VarType vartype1, VarType vartype2, TunableParam param, TunableDesc *descriptor); + virtual int getVarTunable(VarType vartype1, VarType vartype2, TunableParam param, TunableDesc *descriptor); + void setTunable(TunableParam param, TunableDesc *descriptor, uint value); + void setVarTunable(VarType vartype, TunableParam param, TunableDesc *descriptor, uint value); + void setVarTunable(VarType vartype1, VarType vartype2, TunableParam param, TunableDesc *descriptor, uint value); SearchTuner *copyUsed(); + bool isSubTunerof(SearchTuner *newTuner); void randomMutate(); uint getSize() { return usedSettings.getSize();} void print(); void printUsed(); - void serialize(); - + void serialize(const char *file); + void serializeUsed(const char *file); + void addUsed(const char *file); + bool equalUsed(SearchTuner *tuner); CMEMALLOC; -private: +protected: /** Used Settings keeps track of settings that were actually used by the example. Mutating settings may cause the Constraint Compiler not to query other settings.*/ @@ -61,5 +62,4 @@ private: HashsetTunableSetting settings; }; - #endif