fix tuner situation
[satune.git] / src / Tuner / searchtuner.h
index 0aabb6465affbc8b116b6271ef562efc7663f21e..3db0064d099c3d1290d42f43a53cc96e6d32ce91 100644 (file)
@@ -5,7 +5,6 @@
 #include "structs.h"
 #include <ostream>
 using namespace std;
-#define TUNEFILE "tune.conf"
 
 class TunableSetting {
 public:
@@ -15,7 +14,7 @@ public:
        TunableSetting(TunableSetting *ts);
        void setDecision(int _low, int _high, int _default, int _selection);
        void print();
-        friend std::ostream& operator<< (std::ostream& stream, const TunableSetting& matrix);
+       friend std ::ostream &operator<< (std::ostream &stream, const TunableSetting &matrix);
        CMEMALLOC;
 private:
        bool hasVar;
@@ -29,6 +28,7 @@ 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);
@@ -40,19 +40,25 @@ typedef SetIterator<TunableSetting *, uintptr_t, 4, tunableSettingHash, tunableS
 class SearchTuner : public Tuner {
 public:
        SearchTuner();
+       SearchTuner(const char *filename);
        ~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();
        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);
+
        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 +67,4 @@ private:
        HashsetTunableSetting settings;
 };
 
-
 #endif