CAMLprim value caml_unsatcore(value unit) { CAMLparam0 (); CAMLlocal1( tl ); tl = Val_emptylist; int i, max_idx = picosat_variables (); for (i = 1; i <= max_idx; i++) /* discard all variables that are not in the unsat core */ if (picosat_corelit (i)) tl = append (Val_int(i), tl); CAMLreturn(tl); }
static void write_core_variables (PicoSAT * picosat, FILE * file) { int i, max_idx = picosat_variables (picosat), count = 0; for (i = 1; i <= max_idx; i++) if (picosat_corelit (picosat, i)) { fprintf (file, "%d\n", i); count++; } if (verbose) fprintf (output, "c found and wrote %d core variables\n", count); }
CAMLprim value caml_picosat_corelit(value lit) { CAMLparam1 (lit); CAMLreturn(Val_int(picosat_corelit(Int_val(lit)))); }