输出原始模型
This commit is contained in:
parent
2829204b3f
commit
982dd8512b
20
build.sh
20
build.sh
@ -1,20 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
COMPILE_THREADS=16
|
||||
|
||||
|
||||
# build kissat
|
||||
|
||||
# cd kissat-inc
|
||||
# ./configure
|
||||
# make -j $COMPILE_THREADS
|
||||
# cd ..
|
||||
|
||||
# build and copy light-solver
|
||||
|
||||
make -C src-light-solver -j $COMPILE_THREADS
|
||||
|
||||
# build and copy light-master
|
||||
|
||||
make -C src-light-master -j $COMPILE_THREADS
|
@ -79,6 +79,9 @@ void leader_main(light* S, int num_procs, int rank) {
|
||||
MPI_Request solved;
|
||||
MPI_Status status;
|
||||
MPI_Irecv(&is_sat, 1, MPI_INT, MPI_ANY_SOURCE, SOLVED_REPORT_TAG, MPI_COMM_WORLD, &solved);
|
||||
int* sol;
|
||||
|
||||
int res = 0;
|
||||
|
||||
// waiting for results:
|
||||
while(true) {
|
||||
@ -107,23 +110,43 @@ void leader_main(light* S, int num_procs, int rank) {
|
||||
// send signal for getting solution(model) when sat
|
||||
|
||||
if(is_sat) {
|
||||
res = 10;
|
||||
LOGGER->info("recived model size: %v", pre->vars);
|
||||
LOGGER->info("SAT!!!!!!");
|
||||
|
||||
MPI_Send(NULL, 0, MPI_INT, status.MPI_SOURCE, MODEL_REPORT_TAG, MPI_COMM_WORLD);
|
||||
int* sol = new int[pre->vars];
|
||||
sol = new int[pre->vars];
|
||||
MPI_Recv(sol, pre->vars, MPI_INT, status.MPI_SOURCE, MODEL_REPORT_TAG, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
|
||||
|
||||
for(int i=0; i<pre->vars; i++) {
|
||||
printf("%d ", sol[i]);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
delete []sol;
|
||||
} else {
|
||||
res = 20;
|
||||
LOGGER->info("UNSAT!!!!!!");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
MPI_Barrier(MPI_COMM_WORLD);
|
||||
|
||||
if(res == 10) {
|
||||
printf("s SAT\n");
|
||||
for(int i=0; i<pre->vars; i++) {
|
||||
printf("%d ", sol[i]);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
for (int i = 1; i <= pre->orivars; i++)
|
||||
if (pre->mapto[i]) pre->mapval[i] = (sol[abs(pre->mapto[i])-1] > 0 ? 1 : -1) * (pre->mapto[i] > 0 ? 1 : -1);
|
||||
|
||||
pre->get_complete_model();
|
||||
for (int i = 1; i <= pre->orivars; i++) {
|
||||
printf("%d ", i * pre->mapval[i]);
|
||||
}
|
||||
printf("\n");
|
||||
} else if(res == 20) {
|
||||
printf("s UNSAT\n");
|
||||
} else {
|
||||
printf("s UNKNOWN\n");
|
||||
}
|
||||
|
||||
delete []sol;
|
||||
}
|
@ -97,4 +97,6 @@ void worker_main(light* S, int num_procs, int rank) {
|
||||
}
|
||||
|
||||
delete(S);
|
||||
|
||||
MPI_Barrier(MPI_COMM_WORLD);
|
||||
}
|
@ -26,7 +26,6 @@ int main(int argc, char **argv) {
|
||||
if(rank == 0) leader_main(S, num_procs, rank);
|
||||
else worker_main(S, num_procs, rank);
|
||||
|
||||
|
||||
MPI_Barrier(MPI_COMM_WORLD);
|
||||
MPI_Finalize();
|
||||
|
||||
|
@ -198,17 +198,7 @@ int light::run() {
|
||||
parse_input();
|
||||
if (OPT(share)) share();
|
||||
int res = solve();
|
||||
|
||||
// if (res == 10 && OPT(simplify)) {
|
||||
// for (int i = 1; i <= pre->orivars; i++)
|
||||
// if (pre->mapto[i]) pre->mapval[i] = (model[abs(pre->mapto[i])-1] > 0 ? 1 : -1) * (pre->mapto[i] > 0 ? 1 : -1);
|
||||
// pre->get_complete_model();
|
||||
// model.clear();
|
||||
// for (int i = 1; i <= pre->orivars; i++) {
|
||||
// model.push(i * pre->mapval[i]);
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user