|
|
@ -59,46 +59,80 @@ TEST(CuddDd, BddConstants) { |
|
|
|
} |
|
|
|
|
|
|
|
TEST(CuddDd, BddExistAbstractRepresentative) { |
|
|
|
std::shared_ptr<storm::dd::DdManager<storm::dd::DdType::CUDD>> manager(new storm::dd::DdManager<storm::dd::DdType::CUDD>()); |
|
|
|
std::shared_ptr<storm::dd::DdManager<storm::dd::DdType::CUDD>> manager(new storm::dd::DdManager<storm::dd::DdType::CUDD>()); |
|
|
|
std::pair<storm::expressions::Variable, storm::expressions::Variable> x; |
|
|
|
std::pair<storm::expressions::Variable, storm::expressions::Variable> y; |
|
|
|
std::pair<storm::expressions::Variable, storm::expressions::Variable> z; |
|
|
|
ASSERT_NO_THROW(x = manager->addMetaVariable("x", 0, 1)); |
|
|
|
ASSERT_NO_THROW(x = manager->addMetaVariable("x", 0, 1)); |
|
|
|
ASSERT_NO_THROW(y = manager->addMetaVariable("y", 0, 1)); |
|
|
|
ASSERT_NO_THROW(z = manager->addMetaVariable("z", 0, 1)); |
|
|
|
|
|
|
|
storm::dd::Bdd<storm::dd::DdType::CUDD> bddX = manager->getEncoding(x.first, 1); |
|
|
|
//bddX.template toAdd<double>().exportToDot("/opt/masterThesis/storm/build/test_cudd_add_x.dot");
|
|
|
|
storm::dd::Bdd<storm::dd::DdType::CUDD> bddY = manager->getEncoding(y.first, 0); |
|
|
|
//bddY.template toAdd<double>().exportToDot("/opt/masterThesis/storm/build/test_cudd_add_y.dot");
|
|
|
|
storm::dd::Bdd<storm::dd::DdType::CUDD> bddZ = manager->getEncoding(z.first, 0); |
|
|
|
//bddZ.template toAdd<double>().exportToDot("/opt/masterThesis/storm/build/test_cudd_add_z.dot");
|
|
|
|
|
|
|
|
storm::dd::Bdd<storm::dd::DdType::CUDD> bddX1Y0Z0 = (bddX && bddY) && bddZ; |
|
|
|
//bddX1Y0Z0.template toAdd<double>().exportToDot("/opt/masterThesis/storm/build/test_cudd_bddX1Y0Z0.dot");
|
|
|
|
|
|
|
|
EXPECT_EQ(1ul, bddX1Y0Z0.getNonZeroCount()); |
|
|
|
EXPECT_EQ(1ul, bddX1Y0Z0.getLeafCount()); |
|
|
|
EXPECT_EQ(4ul, bddX1Y0Z0.getNodeCount()); |
|
|
|
|
|
|
|
|
|
|
|
storm::dd::Bdd<storm::dd::DdType::CUDD> bddX1 = manager->getEncoding(x.first, 1); |
|
|
|
storm::dd::Bdd<storm::dd::DdType::CUDD> bddY0 = manager->getEncoding(y.first, 0); |
|
|
|
storm::dd::Bdd<storm::dd::DdType::CUDD> bddZ0 = manager->getEncoding(z.first, 0); |
|
|
|
|
|
|
|
storm::dd::Bdd<storm::dd::DdType::CUDD> bddX1Y0Z0 = (bddX1 && bddY0) && bddZ0; |
|
|
|
EXPECT_EQ(1ul, bddX1Y0Z0.getNonZeroCount()); |
|
|
|
EXPECT_EQ(1ul, bddX1Y0Z0.getLeafCount()); |
|
|
|
EXPECT_EQ(4ul, bddX1Y0Z0.getNodeCount()); |
|
|
|
|
|
|
|
storm::dd::Bdd<storm::dd::DdType::CUDD> representative_x = bddX1Y0Z0.existsAbstractRepresentative({x.first}); |
|
|
|
EXPECT_EQ(1ul, representative_x.getNonZeroCount()); |
|
|
|
EXPECT_EQ(1ul, representative_x.getLeafCount()); |
|
|
|
EXPECT_EQ(4ul, representative_x.getNodeCount()); |
|
|
|
EXPECT_EQ(1ul, representative_x.getLeafCount()); |
|
|
|
EXPECT_EQ(4ul, representative_x.getNodeCount()); |
|
|
|
EXPECT_TRUE(bddX1Y0Z0 == representative_x); |
|
|
|
//representative_x.template toAdd<double>().exportToDot("/opt/masterThesis/storm/build/test_representativea_x.dot");
|
|
|
|
|
|
|
|
storm::dd::Bdd<storm::dd::DdType::CUDD> representative_y = bddX1Y0Z0.existsAbstractRepresentative({y.first}); |
|
|
|
EXPECT_EQ(1ul, representative_y.getNonZeroCount()); |
|
|
|
EXPECT_EQ(1ul, representative_y.getLeafCount()); |
|
|
|
EXPECT_EQ(4ul, representative_y.getNodeCount()); |
|
|
|
EXPECT_EQ(1ul, representative_y.getLeafCount()); |
|
|
|
EXPECT_EQ(4ul, representative_y.getNodeCount()); |
|
|
|
EXPECT_TRUE(bddX1Y0Z0 == representative_y); |
|
|
|
//representative_y.template toAdd<double>().exportToDot("/opt/masterThesis/storm/build/test_representativea_y.dot");
|
|
|
|
|
|
|
|
storm::dd::Bdd<storm::dd::DdType::CUDD> representative_z = bddX1Y0Z0.existsAbstractRepresentative({z.first}); |
|
|
|
EXPECT_EQ(1ul, representative_z.getNonZeroCount()); |
|
|
|
EXPECT_EQ(1ul, representative_z.getLeafCount()); |
|
|
|
EXPECT_EQ(4ul, representative_z.getNodeCount()); |
|
|
|
EXPECT_EQ(1ul, representative_z.getLeafCount()); |
|
|
|
EXPECT_EQ(4ul, representative_z.getNodeCount()); |
|
|
|
EXPECT_TRUE(bddX1Y0Z0 == representative_z); |
|
|
|
//representative_z.template toAdd<double>().exportToDot("/opt/masterThesis/storm/build/test_representativea_z.dot");
|
|
|
|
|
|
|
|
storm::dd::Bdd<storm::dd::DdType::CUDD> representative_xyz = bddX1Y0Z0.existsAbstractRepresentative({x.first, y.first, z.first}); |
|
|
|
EXPECT_EQ(1ul, representative_xyz.getNonZeroCount()); |
|
|
|
EXPECT_EQ(1ul, representative_xyz.getLeafCount()); |
|
|
|
EXPECT_EQ(4ul, representative_xyz.getNodeCount()); |
|
|
|
EXPECT_TRUE(bddX1Y0Z0 == representative_xyz); |
|
|
|
|
|
|
|
storm::dd::Bdd<storm::dd::DdType::CUDD> bddX0 = manager->getEncoding(x.first, 0); |
|
|
|
storm::dd::Bdd<storm::dd::DdType::CUDD> bddY1 = manager->getEncoding(y.first, 1); |
|
|
|
storm::dd::Bdd<storm::dd::DdType::CUDD> bddZ1 = manager->getEncoding(z.first, 1); |
|
|
|
|
|
|
|
storm::dd::Bdd<storm::dd::DdType::CUDD> bddX0Y0Z0 = (bddX0 && bddY0) && bddZ0; |
|
|
|
storm::dd::Bdd<storm::dd::DdType::CUDD> bddX1Y1Z1 = (bddX1 && bddY1) && bddZ1; |
|
|
|
|
|
|
|
storm::dd::Bdd<storm::dd::DdType::CUDD> bddAllTrueOrAllFalse = bddX0Y0Z0 || bddX1Y1Z1; |
|
|
|
//bddAllTrueOrAllFalse.template toAdd<double>().exportToDot("test_cudd_addAllTrueOrAllFalse.dot");
|
|
|
|
|
|
|
|
representative_x = bddAllTrueOrAllFalse.existsAbstractRepresentative({x.first}); |
|
|
|
EXPECT_EQ(2ul, representative_x.getNonZeroCount()); |
|
|
|
EXPECT_EQ(1ul, representative_x.getLeafCount()); |
|
|
|
EXPECT_EQ(5ul, representative_x.getNodeCount()); |
|
|
|
EXPECT_TRUE(bddAllTrueOrAllFalse == representative_x); |
|
|
|
|
|
|
|
representative_y = bddAllTrueOrAllFalse.existsAbstractRepresentative({y.first}); |
|
|
|
EXPECT_EQ(2ul, representative_y.getNonZeroCount()); |
|
|
|
EXPECT_EQ(1ul, representative_y.getLeafCount()); |
|
|
|
EXPECT_EQ(5ul, representative_y.getNodeCount()); |
|
|
|
EXPECT_TRUE(bddAllTrueOrAllFalse == representative_y); |
|
|
|
|
|
|
|
representative_z = bddAllTrueOrAllFalse.existsAbstractRepresentative({z.first}); |
|
|
|
EXPECT_EQ(2ul, representative_z.getNonZeroCount()); |
|
|
|
EXPECT_EQ(1ul, representative_z.getLeafCount()); |
|
|
|
EXPECT_EQ(5ul, representative_z.getNodeCount()); |
|
|
|
EXPECT_TRUE(bddAllTrueOrAllFalse == representative_z); |
|
|
|
|
|
|
|
representative_xyz = bddAllTrueOrAllFalse.existsAbstractRepresentative({x.first, y.first, z.first}); |
|
|
|
EXPECT_EQ(1ul, representative_xyz.getNonZeroCount()); |
|
|
|
EXPECT_EQ(1ul, representative_xyz.getLeafCount()); |
|
|
|
EXPECT_EQ(4ul, representative_xyz.getNodeCount()); |
|
|
|
EXPECT_TRUE(bddX0Y0Z0 == representative_xyz); |
|
|
|
} |
|
|
|
|
|
|
|
TEST(CuddDd, AddGetMetaVariableTest) { |
|
|
|