Fix result file
authorbdemsky <bdemsky@uci.edu>
Tue, 16 Oct 2018 00:13:58 +0000 (17:13 -0700)
committerbdemsky <bdemsky@uci.edu>
Tue, 16 Oct 2018 00:13:58 +0000 (17:13 -0700)
src/Test/deserializerun.cc
src/Test/run.sh
src/Tuner/multituner.cc

index d2c591a..1b7371b 100644 (file)
@@ -19,9 +19,9 @@ int main(int argc, char **argv) {
        int sat = solver->solve();
        long long metric = solver->getElapsedTime();
        ofstream myfile;
-       myfile.open (argv[4], ios::out);
-       myfile << metric;
-       myfile << sat;
+       myfile.open (argv[4], ios::out | ios::trunc);
+       myfile << metric << endl;
+       myfile << sat << endl;
        myfile.close();
        //serialize out the tuner we used
        snprintf(buffer, sizeof(buffer), "%sused", argv[3]);
index e74b557..4590ede 100755 (executable)
@@ -5,5 +5,5 @@ export LD_LIBRARY_PATH=../bin
 export DYLD_LIBRARY_PATH=../bin
 # For sat_solver
 export PATH=.:$PATH
-
+echo $@
 $@
index 03bfeec..1cdeee2 100644 (file)
@@ -66,7 +66,7 @@ long long MultiTuner::evaluate(Problem *problem, TunerRecord *tuner) {
        tuner->getTuner()->serialize(buffer);
 
        //Do run
-       snprintf(buffer, sizeof(buffer), "./run.sh deserializerun %s %u tuner%u result%s%u > log%u", problem->getProblem(), timeout, execnum, problem->getProblem(), execnum, execnum);
+       snprintf(buffer, sizeof(buffer), "./run.sh deserializerun %s %u tuner%u result%u > log%u", problem->getProblem(), timeout, execnum, execnum, execnum);
        int status = system(buffer);
 
        long long metric = -1;
@@ -74,7 +74,7 @@ long long MultiTuner::evaluate(Problem *problem, TunerRecord *tuner) {
 
        if (status == 0) {
                //Read data in from results file
-               snprintf(buffer, sizeof(buffer), "result%s%u", problem->getProblem(), execnum);
+               snprintf(buffer, sizeof(buffer), "result%u", execnum);
 
                ifstream myfile;
                myfile.open (buffer, ios::in);
@@ -87,10 +87,7 @@ long long MultiTuner::evaluate(Problem *problem, TunerRecord *tuner) {
                }
 
                snprintf(buffer, sizeof(buffer), "tuner%uused", execnum);
-               SearchTuner *usedtuner = new SearchTuner(buffer);
-               delete tuner->getTuner();
-               tuner->updateTuner(usedtuner);
-
+               tuner->getTuner()->addUsed(buffer);
        }
        //Increment execution count
        execnum++;