static YAP_Bool paths_to_non_zero(void) { double paths; YAP_Term arg1, arg2, out; DdNode *node; arg1 = YAP_ARG1; arg2 = YAP_ARG2; node = (DdNode *)YAP_IntOfTerm(arg1); paths = Cudd_CountPathsToNonZero(node); out = YAP_MkFloatTerm(paths); return (YAP_Unify(out, arg2)); }
int main(void) { DdManager *manager = Cudd_Init(0,0,CUDD_UNIQUE_SLOTS,CUDD_CACHE_SLOTS,0); //DdNode *one = DD_ONE(manager); //DdNode *zero = Cudd_Not(one); //DdNode *tmp; //DdNode *f; int p1[] = {1,0,0,0}; // DdNode *v = getVar(manager,0,1); DdNode *p = path(manager,p1,4); printf("Is the new path an evaluation of the bdd? %d\n",Cudd_Eval(manager,p,p1) == DD_ONE(manager)); todot(manager,p,"tuple1000.dot"); printf("Paths to one in p: %f from a total of %f\n", Cudd_CountPathsToNonZero(p), Cudd_CountPath(p)); Cudd_RecursiveDeref(manager,p); printf("This number should be zero: %d\n",Cudd_CheckZeroRef(manager)); return 0; }