From: bdemsky Date: Sat, 13 Oct 2018 02:28:45 +0000 (-0700) Subject: Add competition tuner test file X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=a3310cdfff1ba8f2280c4b2731e91b49b76601fb;p=satune.git Add competition tuner test file --- diff --git a/src/Test/runcomptuner.cc b/src/Test/runcomptuner.cc new file mode 100644 index 0000000..dc3c035 --- /dev/null +++ b/src/Test/runcomptuner.cc @@ -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; +} diff --git a/src/Tuner/multituner.h b/src/Tuner/multituner.h index 40bd5e1..1162e82 100644 --- a/src/Tuner/multituner.h +++ b/src/Tuner/multituner.h @@ -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 *tunerV); void improveTuners(Vector *tunerV); TunerRecord *tune(TunerRecord *tuner); - void tuneComp(); + Vector allTuners; Vector problems;