}
MultiTuner::MultiTuner(uint _budget, uint _rounds, uint _timeout) :
-- budget(_budget), rounds(_rounds), timeout(_timeout), execnum(0) {
++ budget(_budget), rounds(_rounds), timeout(_timeout), besttime(_timeout), execnum(0) {
}
MultiTuner::~MultiTuner() {
myfile >> sat;
myfile.close();
}
--
++ updateTimeout(metric);
snprintf(buffer, sizeof(buffer), "tuner%uused", execnum);
tuner->getTuner()->addUsed(buffer);
}
} else if (problem->result != sat && sat != IS_INDETER) {
model_print("******** Result has changed ********\n");
}
++ if(sat == IS_INDETER && metric != -1){ //The case when we have a timeout
++ metric = -1;
++ }
return metric;
}
++void MultiTuner::updateTimeout(long long metric){
++ double currentTime= metric / NANOSEC;
++ if(currentTime < besttime){
++ besttime = currentTime;
++ }
++ uint adoptive;
++ if(besttime > 30){
++ adoptive = besttime * 5;
++ }else {
++ adoptive = 150;
++ }
++ if(adoptive < timeout){
++ timeout = adoptive;
++ }
++}
++
void MultiTuner::tuneComp() {
Vector<TunerRecord *> *tunerV = new Vector<TunerRecord *>(&tuners);
for (uint b = 0; b < budget; b++) {
if (score > tscore)
break;
}
- LOG("ranking[%u]=tuner<%d>(Score=%d)\n", j, tuner->tunernumber, score);
- LOG("************************\n");
+ DEBUG("ranking[%u]=tuner<%p,%u>(Score=%d)\n", j, tuner, tuner->tunernumber, score);
+ DEBUG("************************\n");
ranking.insertAt(j, tuner);
}
- DEBUG("tunerSize=%u\trankingSize=%u\ttunerVSize=%u\n", tuners.getSize(), ranking.getSize(), tunerV->getSize());
+ LOG("tunerSize=%u\trankingSize=%u\ttunerVSize=%u\n", tuners.getSize(), ranking.getSize(), tunerV->getSize());
for (uint i = tuners.getSize(); i < ranking.getSize(); i++) {
TunerRecord *tuner = ranking.get(i);
model_print("Removing tuner %u\n", tuner->tunernumber);