BUGFIX: when ONE or TWO tuner cannot solve a problem
authorHamed Gorjiara <hgorjiar@uci.edu>
Tue, 22 Oct 2019 20:57:45 +0000 (13:57 -0700)
committerHamed Gorjiara <hgorjiar@uci.edu>
Tue, 22 Oct 2019 20:57:45 +0000 (13:57 -0700)
src/Tuner/comptuner.cc

index 64e58a0..d630f2d 100644 (file)
@@ -4,6 +4,7 @@
 #include "searchtuner.h"
 #include <iostream>
 #include <fstream>
+#include <limits>
 #include "solver_interface.h"
 
 CompTuner::CompTuner(uint _budget, uint _timeout) :
@@ -30,12 +31,14 @@ void CompTuner::findBestTwoTuners() {
                        for (uint l = 0; l < problems.getSize(); l++) {
                                Problem *problem = problems.get(l);
                                long long time1 = tuner1->getTime(problem);
+                               if(time1 == -1){
+                                       time1=LLONG_MAX;
+                               }
                                long long time2 = tuner2->getTime(problem);
-                               long long minTime =DBL_MAX;
-                               if(time1 != -1 || time2 != -1){
-                                       minTime = min(time1,time2);
+                               if(time2 == -1){
+                                       time2 = LLONG_MAX;
                                }
-                               mintimes[l] = pow(minTime, (double)1 / problems.getSize());
+                               mintimes[l] = pow(min(time1,time2), (double)1 / problems.getSize());
                        }
                        double result = 1;
                        for (uint l = 0; l < problems.getSize(); l++) {