Closed adelin-b closed 7 years ago
There was a minor bug in the return type of boolexpr_BoolExpr_sat
function, which I corrected a couple days ago.
Here's a recipe I just cooked up to demonstrate:
#include <boolexpr/boolexpr.h>
int
main(void)
{
void * ctx;
void * a;
void * b;
void * F;
void * bxs [2];
void * soln;
ctx = boolexpr_Context_new();
a = (void *) boolexpr_Context_get_var(ctx, "a");
b = (void *) boolexpr_Context_get_var(ctx, "b");
bxs[0] = a;
bxs[1] = b;
F = (void *) boolexpr_xor(2, bxs);
soln = (void *) boolexpr_BoolExpr_sat(F);
printf("Is F SAT? %d\n", boolexpr_Soln_first(soln));
boolexpr_Soln_del(soln);
boolexpr_BoolExpr_del(F);
boolexpr_BoolExpr_del(a);
boolexpr_BoolExpr_del(b);
boolexpr_Context_del(ctx);
return 0;
}
Compling with g++ --std=c++11 -o foo -Iinclude -Ithird_party/boost-1.54.0 -Ithird_party/glucosamine/src -Lbuild foo.c -lboolexpr
, then running the binary should output this:
Is F SAT? 1
You can also get the exact SAT model by calling boolexpr_Soln_snd(soln)
. That return type is called a "point", and you can iterate over it to get all the variable assignment in the SAT model.
Hello, Im trying to use the sat function in c, however it seem that something go wrong each time I try to use it.
Does the
boolexpr_BoolExpr_sat()
function need a certain type of expression ?