void tableGen() { int instances = 50; SEQ_SIZE = 100; LOW = 1; HIGH = 1000000000000; ITER = 50000; DEBUGGING = false; IN_PRODUCTION = true; /*----------------------------------*/ cout << "rowID\tKK\tBoolRR\tBoolHC\tBoolSA\tPartRR\tPartHC\tPartSA\n"; for (int i = 1; i <= instances; i++){ Sequence* s = new Sequence(SEQ_SIZE); /*----------------------------------*/ PREPARTITIONING = false; Sequence* s_copy = s->getCopy(); int64 kk = karmarkarKarp(s_copy); delete s_copy; int64 boolRR = repeatedRandom(s)->residue(); int64 boolHC = hillClimbing(s)->residue(); int64 boolSA = simulatedAnnealing(s); /*----------------------------------*/ PREPARTITIONING = true; int64 partRR = repeatedRandom(s)->residue(); int64 partHC = hillClimbing(s)->residue(); int64 partSA = simulatedAnnealing(s); /*----------------------------------*/ delete s; cout << i << "\t" << kk << "\t" << boolRR << "\t" << boolHC << "\t" << boolSA << "\t" << partRR << "\t" << partHC << "\t" << partSA << "\n"; } }
int main(int argc, const char * argv[]) { mt19937 gen(r()); string fname = argv[1]; if (argc > 2) { // Testing cases present in args int64 flag = atoi(argv[2]); testSuite(flag); } if (argc == 2) { // Proof that KK works Sequence* s = generateInstanceFromFile(fname); Sequence* s_copy = s->getCopy(); cout << "karmarkarKarp: " << karmarkarKarp(s_copy) << endl << endl; PREPARTITIONING = false; repeatedRandom(s)->residue(); cout << endl; hillClimbing(s)->residue(); cout << endl; simulatedAnnealing(s); cout << endl; PREPARTITIONING = true; repeatedRandom(s)->residue(); cout << endl; hillClimbing(s)->residue(); cout << endl; simulatedAnnealing(s); cout << endl; } }