}
}
+bool MultiTuner::finishTunerExist(TunerRecord *tunerRec){
+ SearchTuner *tuner = tunerRec->getTuner();
+ for(uint i=0; i< explored.getSize(); i++){
+ if(explored.get(i)->getTuner()->equalUsed(tuner))
+ return true;
+ }
+ return false;
+}
+
void MultiTuner::addTuner(SearchTuner *tuner) {
TunerRecord *t = new TunerRecord(tuner);
tuners.push(t);
updateTimeout(problem, metric);
snprintf(buffer, sizeof(buffer), "tuner%uused", execnum);
tuner->getTuner()->addUsed(buffer);
- explored.push(tuner);
+ if(!finishTunerExist(tuner)){
+ explored.push(tuner);
+ }
}
//Increment execution count
execnum++;
void readData(uint numRuns);
void updateTimeout(Problem *problem, long long metric);
void tuneK();
+ bool finishTunerExist(TunerRecord *tuner);
void tuneComp();
void printData();
void findBestThreeTuners();
}
}
+bool SearchTuner::equalUsed(SearchTuner* tuner){
+ if(tuner->usedSettings.getSize() != usedSettings.getSize()){
+ return false;
+ }
+ bool result = true;
+ SetIteratorTunableSetting *iterator = usedSettings.iterator();
+ while(iterator->hasNext()){
+ TunableSetting *setting = iterator->next();
+ if(!tuner->usedSettings.contains(setting)){
+ result = false;
+ break;
+ }else{
+ TunableSetting *tunerSetting = tuner->usedSettings.get(setting);
+ if(tunerSetting->selectedValue != setting->selectedValue){
+ result = false;
+ break;
+ }
+ }
+ }
+ delete iterator;
+ return result;
+}
+
void SearchTuner::addUsed(const char *filename) {
ifstream myfile;
myfile.open (filename, ios::in);
void serialize(const char *file);
void serializeUsed(const char *file);
void addUsed(const char *file);
-
+ bool equalUsed(SearchTuner *tuner);
CMEMALLOC;
protected:
/** Used Settings keeps track of settings that were actually used by