Add competition tuner test file
authorbdemsky <bdemsky@uci.edu>
Sat, 13 Oct 2018 02:28:45 +0000 (19:28 -0700)
committerbdemsky <bdemsky@uci.edu>
Sat, 13 Oct 2018 02:28:45 +0000 (19:28 -0700)
src/Test/runcomptuner.cc [new file with mode: 0644]
src/Tuner/multituner.h

diff --git a/src/Test/runcomptuner.cc b/src/Test/runcomptuner.cc
new file mode 100644 (file)
index 0000000..dc3c035
--- /dev/null
@@ -0,0 +1,37 @@
+#include "csolver.h"
+#include "multituner.h"
+#include "searchtuner.h"
+
+int main(int argc, char **argv) {
+       if (argc < 7) {
+               printf("You should specify %s budget rounds timeout problemfilenames - tunerfilenames", argv[0]);
+               exit(-1);
+       }
+       uint budget;
+       uint rounds;
+       uint timeout;
+       sscanf(argv[1], "%u", &budget);
+       sscanf(argv[2], "%u", &rounds);
+       sscanf(argv[3], "%u", &timeout);
+
+       MultiTuner *multituner = new MultiTuner(budget, rounds, timeout);
+       bool tunerfiles = false;
+       for (int i = 4; i < argc; i++) {
+               if (!tunerfiles) {
+                       if (argv[i][0] == '-' && argv[i][1] == 0)
+                               tunerfiles = true;
+                       else
+                               multituner->addProblem(argv[i]);
+               } else
+                       multituner->addTuner(new SearchTuner(argv[i]));
+       }
+
+       if (!tunerfiles) {
+               printf("You should specify %s budget rounds timeout problemfilenames - tunerfilenames", argv[0]);
+               exit(-1);
+       }
+
+       multituner->tuneComp();
+       delete multituner;
+       return 0;
+}
index 40bd5e1..1162e82 100644 (file)
@@ -39,6 +39,7 @@ public:
        void addProblem(const char *filename);
        void addTuner(SearchTuner *tuner);
        void tuneK();
+       void tuneComp();
        CMEMALLOC;
 protected:
        long long evaluate(Problem *problem, SearchTuner *tuner);
@@ -47,7 +48,7 @@ protected:
        void mapProblemsToTuners(Vector<TunerRecord *> *tunerV);
        void improveTuners(Vector<TunerRecord *> *tunerV);
        TunerRecord *tune(TunerRecord *tuner);
-       void tuneComp();
+
 
        Vector<TunerRecord *> allTuners;
        Vector<Problem *> problems;