62 lines
1.5 KiB
C
62 lines
1.5 KiB
C
#include <stdio.h>
|
|
#include "cnf.h"
|
|
#include "gpusolver.h"
|
|
#include "time.h"
|
|
#include "tests/masterTest.h"
|
|
#include "ncnf.h"
|
|
|
|
int main() {
|
|
ncnf* c2 = nreadDIMACS("/home/lev/Downloads/uf20/uf20-02.cnf");
|
|
nprintcnf(c2);
|
|
|
|
printf("\n\n\n\n");
|
|
nprintcnf2(c2);
|
|
nsortlastnum(c2);
|
|
printf("\n\n\n\n");
|
|
nprintcnf2(c2);
|
|
printf("the balcony is to your left\n");
|
|
return 0;
|
|
/*
|
|
srand( utime());
|
|
u32 cnt = 4096;
|
|
printf("p cnf %u %u\n", cnt, cnt);
|
|
for (u32 i = 0; i < cnt; ++i) {
|
|
printf("%s%u 0\n", (rand() & 1U) ? ("") : ("-"), i + 1);
|
|
if ((i & 0xFF) == 0) {
|
|
srand(utime() ^ rand());
|
|
}
|
|
}
|
|
return 0;
|
|
*/
|
|
/*
|
|
for (uint i = 0; i < 1000; ++i) {
|
|
char buf[128];
|
|
i32 len = sprintf(buf, "/home/lev/Downloads/uf50/uf50-0%u.cnf", i + 1);
|
|
|
|
|
|
|
|
}
|
|
*/
|
|
|
|
/* Expects a path to a DIMACS file */
|
|
cnf* c = readDIMACS("/home/lev/Downloads/uf50/uf50-088.cnf");
|
|
// printf("%u\n", c->litcnt);
|
|
|
|
// for (u32 i = 0; i < c->clausecnt; ++i) printf("%u ", c->lastvars[i]);
|
|
//printf("\ntomato\n");
|
|
sortlastnum(c, c->litcnt);
|
|
// printf("%u\n", c->lastvars[c->clauses[0]]);
|
|
|
|
//printf("%u %u %u\n\n", c->litcnt, c->varcnt, c->clausecnt);
|
|
u64 start = utime();
|
|
i32 res = gpusolve(c);
|
|
u64 stop = utime();
|
|
// printf("%s : %d\n", buf, res);
|
|
printf("Took %f seconds\n", ((f64) (stop - start)) / 1000000.0);
|
|
// printf("please don't\n");
|
|
// if (res == 1) break;
|
|
freecnf(c);
|
|
|
|
return 0;
|
|
}
|