Bug fix: typos
[satune.git] / src / Tuner / basictuner.cc
index 31b43750482fcc1cd82f255ed3a42c8008fda03b..6ac7453a249648a16fcb93c3850d1ef8d2250e68 100644 (file)
@@ -157,9 +157,10 @@ long long BasicTuner::evaluate(Problem *problem, TunerRecord *tuner) {
        uint timeinsecs = problem->getBestTime() / NANOSEC;
        uint adaptive = (timeinsecs > 30) ? timeinsecs * 5 : 150;
        uint maxtime = (adaptive < timeout) ? adaptive : timeout;
-
+       uint satuneTimeout = (2*maxtime < maxtime + 600)?2*maxtime: maxtime + 600;
        //Do run
-       snprintf(buffer, sizeof(buffer), "./run.sh deserializerun %s %u tuner%u result%u > log%u", problem->getProblem(), maxtime, execnum, execnum, execnum);
+       snprintf(buffer, sizeof(buffer), "timeout %u ./run.sh deserializerun %s %u tuner%u result%u > log%u", satuneTimeout, problem->getProblem(), maxtime, execnum, execnum, execnum);
+       model_print("Running: %s\n", buffer);
        int status = system(buffer);
 
        long long metric = -1;
@@ -178,17 +179,23 @@ long long BasicTuner::evaluate(Problem *problem, TunerRecord *tuner) {
                        myfile >> sat;
                        myfile.close();
                }
-               updateTimeout(problem, metric);
+               if(sat != IS_INDETER){
+                       updateTimeout(problem, metric);
+               }
                snprintf(buffer, sizeof(buffer), "tuner%uused", execnum);
                tuner->getTuner()->addUsed(buffer);
+       } else if (status == 124 << 8) {// timeout happens ...
+               tuner->getTuner()->copySettingstoUsedSettings();
        }
+
        //Increment execution count
        execnum++;
 
        if (problem->getResult() == TUNERUNSETVALUE && sat != IS_INDETER) {
                problem->setResult( sat );
        } else if (problem->getResult() != sat && sat != IS_INDETER) {
-               model_print("******** Result has changed ********\n");
+               model_print("******** Result has changed ******** Found a bug!!\n");
+               ASSERT(0);
        }
        if (sat == IS_INDETER && metric != -1) {//The case when we have a timeout
                metric = -1;