Browse Source

Fixed CUDD and Sylvan existsRepresentative.

Former-commit-id: e3ec69ab37
tempestpy_adaptions
PBerger 8 years ago
parent
commit
73a3461650
  1. 17
      resources/3rdparty/cudd-3.0.0/cudd/cuddBddAbs.c
  2. 19
      resources/3rdparty/sylvan/src/sylvan_bdd_storm.c
  3. 2
      test/functional/storage/CuddDdTest.cpp

17
resources/3rdparty/cudd-3.0.0/cudd/cuddBddAbs.c

@ -542,12 +542,27 @@ cuddBddExistAbstractRepresentativeRecur(
if (cube == one) { if (cube == one) {
// printf("return in preprocessing...\n"); // printf("return in preprocessing...\n");
return one; return one;
} else {
res = cuddBddExistAbstractRepresentativeRecur(manager, f, cuddT(cube));
if (res == NULL) {
return(NULL);
}
cuddRef(res);
res1 = cuddBddIteRecur(manager, manager->vars[cube->index], zero, res);
if (res1 == NULL) {
Cudd_IterDerefBdd(manager,res);
Cudd_IterDerefBdd(manager,zero);
return(NULL);
}
cuddDeref(res);
return(res1);
} }
} else if (cube == one) { } else if (cube == one) {
// printf("return in preprocessing...\n"); // printf("return in preprocessing...\n");
return f; return f;
} }
/* From now on, cube is non-constant, but f might be constant. */
/* From now on, cube and f are non-constant. */
// printf("F perm %i and cube perm %i\n", manager->perm[F->index], manager->perm[cube->index]); // printf("F perm %i and cube perm %i\n", manager->perm[F->index], manager->perm[cube->index]);

19
resources/3rdparty/sylvan/src/sylvan_bdd_storm.c

@ -80,24 +80,7 @@ TASK_IMPL_3(BDD, sylvan_existsRepresentative, BDD, a, BDD, variables, BDDVAR, pr
return sylvan_invalid; return sylvan_invalid;
} }
if (res1 == sylvan_true) { if (res1 == sylvan_true) {
BDD res = CALL(sylvan_existsRepresentative, a, _v, level);
if (res == sylvan_invalid) {
return sylvan_invalid;
}
sylvan_ref(res);
BDD res1 = sylvan_ite(sylvan_ithvar(vv), sylvan_false, res);
if (res1 == sylvan_invalid) {
sylvan_deref(res);
return sylvan_invalid;
}
sylvan_deref(res);
//printf("return after abstr. var that does not appear in f...\n");
return res1;
//return sylvan_not(variables);
return sylvan_not(variables);
} }
sylvan_ref(res1); sylvan_ref(res1);

2
test/functional/storage/CuddDdTest.cpp

@ -91,7 +91,7 @@ TEST(CuddDd, BddExistAbstractRepresentative) {
storm::dd::Bdd<storm::dd::DdType::CUDD> representative_true_x = one.existsAbstractRepresentative({x.first}); storm::dd::Bdd<storm::dd::DdType::CUDD> representative_true_x = one.existsAbstractRepresentative({x.first});
EXPECT_EQ(0ul, representative_true_x.getNonZeroCount()); EXPECT_EQ(0ul, representative_true_x.getNonZeroCount());
EXPECT_EQ(1ul, representative_true_x.getLeafCount()); EXPECT_EQ(1ul, representative_true_x.getLeafCount());
EXPECT_EQ(1ul, representative_true_x.getNodeCount());
EXPECT_EQ(2ul, representative_true_x.getNodeCount());
EXPECT_TRUE(representative_true_x == bddX0); EXPECT_TRUE(representative_true_x == bddX0);
storm::dd::Bdd<storm::dd::DdType::CUDD> representative_true_xyz = one.existsAbstractRepresentative({x.first, y.first, z.first}); storm::dd::Bdd<storm::dd::DdType::CUDD> representative_true_xyz = one.existsAbstractRepresentative({x.first, y.first, z.first});

Loading…
Cancel
Save