659ad7ee739e4f8c8982d709b00d7140b148eb55
[satune.git] / src / Test / runmultituner.cc
1 #include "csolver.h"
2 #include "searchtuner.h"
3 #include "kmeanstuner.h"
4
5 int main(int argc, char **argv) {
6         if (argc < 7) {
7                 printf("You should specify %s budget rounds timeout problemfilenames - tunerfilenames", argv[0]);
8                 exit(-1);
9         }
10         uint budget;
11         uint rounds;
12         uint timeout;
13         sscanf(argv[1], "%u", &budget);
14         sscanf(argv[2], "%u", &rounds);
15         sscanf(argv[3], "%u", &timeout);
16
17         KMeansTuner *multituner = new KMeansTuner(budget, rounds, timeout);
18         bool tunerfiles = false;
19         for (int i = 4; i < argc; i++) {
20                 if (!tunerfiles) {
21                         if (argv[i][0] == '-' && argv[i][1] == 0)
22                                 tunerfiles = true;
23                         else
24                                 multituner->addProblem(argv[i]);
25                 } else
26                         multituner->addTuner(new SearchTuner(argv[i]));
27         }
28
29         if (!tunerfiles) {
30                 printf("You should specify %s budget rounds timeout problemfilenames - tunerfilenames", argv[0]);
31                 exit(-1);
32         }
33
34         multituner->tune();
35         delete multituner;
36         return 0;
37 }