Browse Source

worked in newest sylvan changes to api

Former-commit-id: 6dc877753c
tempestpy_adaptions
dehnert 9 years ago
parent
commit
598ed08116
  1. 109
      resources/3rdparty/sylvan/src/sylvan_obj.cpp
  2. 1492
      resources/3rdparty/sylvan/src/sylvan_obj.hpp
  3. 18
      src/storage/dd/sylvan/InternalSylvanAdd.cpp
  4. 12
      src/storage/dd/sylvan/InternalSylvanBdd.cpp

109
resources/3rdparty/sylvan/src/sylvan_obj.cpp

@ -172,24 +172,24 @@ Bdd::operator-=(const Bdd& other)
}
Bdd
Bdd::AndAbstract(const Bdd &g, const Bdd &cube) const
Bdd::AndAbstract(const Bdd &g, const BddSet &cube) const
{
LACE_ME;
return sylvan_and_exists(bdd, g.bdd, cube.bdd);
return sylvan_and_exists(bdd, g.bdd, cube.set.bdd);
}
Bdd
Bdd::ExistAbstract(const Bdd &cube) const
Bdd::ExistAbstract(const BddSet &cube) const
{
LACE_ME;
return sylvan_exists(bdd, cube.bdd);
return sylvan_exists(bdd, cube.set.bdd);
}
Bdd
Bdd::UnivAbstract(const Bdd &cube) const
Bdd::UnivAbstract(const BddSet &cube) const
{
LACE_ME;
return sylvan_forall(bdd, cube.bdd);
return sylvan_forall(bdd, cube.set.bdd);
}
Bdd
@ -251,17 +251,17 @@ Bdd::Leq(const Bdd &g) const
}
Bdd
Bdd::RelPrev(const Bdd& relation, const Bdd& cube) const
Bdd::RelPrev(const Bdd& relation, const BddSet& cube) const
{
LACE_ME;
return sylvan_relprev(relation.bdd, bdd, cube.bdd);
return sylvan_relprev(relation.bdd, bdd, cube.set.bdd);
}
Bdd
Bdd::RelNext(const Bdd &relation, const Bdd &cube) const
Bdd::RelNext(const Bdd &relation, const BddSet &cube) const
{
LACE_ME;
return sylvan_relnext(bdd, relation.bdd, cube.bdd);
return sylvan_relnext(bdd, relation.bdd, cube.set.bdd);
}
Bdd
@ -293,16 +293,16 @@ Bdd::Compose(const BddMap &m) const
}
Bdd
Bdd::Permute(const std::vector<Bdd>& from, const std::vector<Bdd>& to) const
Bdd::Permute(const std::vector<uint32_t>& from, const std::vector<uint32_t>& to) const
{
LACE_ME;
/* Create a map */
BddMap map;
for (int i=from.size()-1; i>=0; i--) {
map.put(from[i].TopVar(), to[i]);
map.put(from[i], Bdd::bddVar(to[i]));
}
return sylvan_compose(bdd, map.bdd);
}
@ -340,13 +340,12 @@ Bdd::GetShaHash() const
}
double
Bdd::SatCount(const Bdd &variables) const
Bdd::SatCount(const BddSet &variables) const
{
LACE_ME;
return sylvan_satcount(bdd, variables.bdd);
return sylvan_satcount(bdd, variables.set.bdd);
}
double
Bdd::SatCount(size_t nvars) const
{
@ -356,22 +355,22 @@ Bdd::SatCount(size_t nvars) const
}
void
Bdd::PickOneCube(const Bdd &variables, uint8_t *values) const
Bdd::PickOneCube(const BddSet &variables, uint8_t *values) const
{
LACE_ME;
sylvan_sat_one(bdd, variables.bdd, values);
sylvan_sat_one(bdd, variables.set.bdd, values);
}
std::vector<bool>
Bdd::PickOneCube(const Bdd &variables) const
Bdd::PickOneCube(const BddSet &variables) const
{
std::vector<bool> result = std::vector<bool>();
BDD bdd = this->bdd;
BDD vars = variables.bdd;
BDD vars = variables.set.bdd;
if (bdd == sylvan_false) return result;
for (; !sylvan_set_isempty(vars); vars = sylvan_set_next(vars)) {
uint32_t var = sylvan_set_var(vars);
if (bdd == sylvan_true) {
@ -394,7 +393,7 @@ Bdd::PickOneCube(const Bdd &variables) const
}
}
}
return result;
}
@ -406,18 +405,18 @@ Bdd::PickOneCube() const
}
Bdd
Bdd::UnionCube(const Bdd &variables, uint8_t *values) const
Bdd::UnionCube(const BddSet &variables, uint8_t *values) const
{
LACE_ME;
return sylvan_union_cube(bdd, variables.bdd, values);
return sylvan_union_cube(bdd, variables.set.bdd, values);
}
Bdd
Bdd::UnionCube(const Bdd &variables, std::vector<uint8_t> values) const
Bdd::UnionCube(const BddSet &variables, std::vector<uint8_t> values) const
{
LACE_ME;
uint8_t *data = values.data();
return sylvan_union_cube(bdd, variables.bdd, data);
return sylvan_union_cube(bdd, variables.set.bdd, data);
}
/**
@ -472,18 +471,18 @@ Bdd::bddVar(uint32_t index)
}
Bdd
Bdd::bddCube(const Bdd &variables, uint8_t *values)
Bdd::bddCube(const BddSet &variables, uint8_t *values)
{
LACE_ME;
return sylvan_cube(variables.bdd, values);
return sylvan_cube(variables.set.bdd, values);
}
Bdd
Bdd::bddCube(const Bdd &variables, std::vector<uint8_t> values)
Bdd::bddCube(const BddSet &variables, std::vector<uint8_t> values)
{
LACE_ME;
uint8_t *data = values.data();
return sylvan_cube(variables.bdd, data);
return sylvan_cube(variables.set.bdd, data);
}
int
@ -636,18 +635,18 @@ Mtbdd::mtbddZero()
}
Mtbdd
Mtbdd::mtbddCube(const Mtbdd &variables, uint8_t *values, const Mtbdd &terminal)
Mtbdd::mtbddCube(const BddSet &variables, uint8_t *values, const Mtbdd &terminal)
{
LACE_ME;
return mtbdd_cube(variables.mtbdd, values, terminal.mtbdd);
return mtbdd_cube(variables.set.bdd, values, terminal.mtbdd);
}
Mtbdd
Mtbdd::mtbddCube(const Mtbdd &variables, std::vector<uint8_t> values, const Mtbdd &terminal)
Mtbdd::mtbddCube(const BddSet &variables, std::vector<uint8_t> values, const Mtbdd &terminal)
{
LACE_ME;
uint8_t *data = values.data();
return mtbdd_cube(variables.mtbdd, data, terminal.mtbdd);
return mtbdd_cube(variables.set.bdd, data, terminal.mtbdd);
}
int
@ -713,10 +712,10 @@ Mtbdd::UApply(mtbdd_uapply_op op, size_t param) const
}
Mtbdd
Mtbdd::Abstract(const Mtbdd &variables, mtbdd_abstract_op op) const
Mtbdd::Abstract(const BddSet &variables, mtbdd_abstract_op op) const
{
LACE_ME;
return mtbdd_abstract(mtbdd, variables.mtbdd, op);
return mtbdd_abstract(mtbdd, variables.set.bdd, op);
}
Mtbdd
@ -755,38 +754,38 @@ Mtbdd::Max(const Mtbdd &other) const
}
Mtbdd
Mtbdd::AbstractPlus(const Mtbdd &variables) const
Mtbdd::AbstractPlus(const BddSet &variables) const
{
LACE_ME;
return mtbdd_abstract_plus(mtbdd, variables.mtbdd);
return mtbdd_abstract_plus(mtbdd, variables.set.bdd);
}
Mtbdd
Mtbdd::AbstractTimes(const Mtbdd &variables) const
Mtbdd::AbstractTimes(const BddSet &variables) const
{
LACE_ME;
return mtbdd_abstract_times(mtbdd, variables.mtbdd);
return mtbdd_abstract_times(mtbdd, variables.set.bdd);
}
Mtbdd
Mtbdd::AbstractMin(const Mtbdd &variables) const
Mtbdd::AbstractMin(const BddSet &variables) const
{
LACE_ME;
return mtbdd_abstract_min(mtbdd, variables.mtbdd);
return mtbdd_abstract_min(mtbdd, variables.set.bdd);
}
Mtbdd
Mtbdd::AbstractMax(const Mtbdd &variables) const
Mtbdd::AbstractMax(const BddSet &variables) const
{
LACE_ME;
return mtbdd_abstract_max(mtbdd, variables.mtbdd);
return mtbdd_abstract_max(mtbdd, variables.set.bdd);
}
Mtbdd
Mtbdd::AndExists(const Mtbdd &other, const Mtbdd &variables) const
Mtbdd::AndExists(const Mtbdd &other, const BddSet &variables) const
{
LACE_ME;
return mtbdd_and_exists(mtbdd, other.mtbdd, variables.mtbdd);
return mtbdd_and_exists(mtbdd, other.mtbdd, variables.set.bdd);
}
int
@ -914,16 +913,16 @@ Mtbdd::Compose(MtbddMap &m) const
}
Mtbdd
Mtbdd::Permute(const std::vector<Mtbdd>& from, const std::vector<Mtbdd>& to) const
Mtbdd::Permute(const std::vector<uint32_t>& from, const std::vector<uint32_t>& to) const
{
LACE_ME;
/* Create a map */
MtbddMap map;
for (int i=from.size()-1; i>=0; i--) {
map.put(from[i].TopVar(), to[i]);
map.put(from[i], Bdd::bddVar(to[i]));
}
return mtbdd_compose(mtbdd, map.mtbdd);
}
@ -935,9 +934,9 @@ Mtbdd::SatCount(size_t nvars) const
}
double
Mtbdd::SatCount(const Mtbdd &variables) const
Mtbdd::SatCount(const BddSet &variables) const
{
return SatCount(sylvan_set_count(variables.mtbdd));
return SatCount(sylvan_set_count(variables.set.bdd));
}
size_t

1492
resources/3rdparty/sylvan/src/sylvan_obj.hpp
File diff suppressed because it is too large
View File

18
src/storage/dd/sylvan/InternalSylvanAdd.cpp

@ -140,17 +140,17 @@ namespace storm {
template<typename ValueType>
InternalAdd<DdType::Sylvan, ValueType> InternalAdd<DdType::Sylvan, ValueType>::sumAbstract(InternalBdd<DdType::Sylvan> const& cube) const {
return InternalAdd<DdType::Sylvan, ValueType>(ddManager, this->sylvanMtbdd.AbstractPlus(static_cast<MTBDD>(cube.sylvanBdd.GetBDD())));
return InternalAdd<DdType::Sylvan, ValueType>(ddManager, this->sylvanMtbdd.AbstractPlus(cube.sylvanBdd));
}
template<typename ValueType>
InternalAdd<DdType::Sylvan, ValueType> InternalAdd<DdType::Sylvan, ValueType>::minAbstract(InternalBdd<DdType::Sylvan> const& cube) const {
return InternalAdd<DdType::Sylvan, ValueType>(ddManager, this->sylvanMtbdd.AbstractMin(static_cast<MTBDD>(cube.sylvanBdd.GetBDD())));
return InternalAdd<DdType::Sylvan, ValueType>(ddManager, this->sylvanMtbdd.AbstractMin(cube.sylvanBdd));
}
template<typename ValueType>
InternalAdd<DdType::Sylvan, ValueType> InternalAdd<DdType::Sylvan, ValueType>::maxAbstract(InternalBdd<DdType::Sylvan> const& cube) const {
return InternalAdd<DdType::Sylvan, ValueType>(ddManager, this->sylvanMtbdd.AbstractMax(static_cast<MTBDD>(cube.sylvanBdd.GetBDD())));
return InternalAdd<DdType::Sylvan, ValueType>(ddManager, this->sylvanMtbdd.AbstractMax(cube.sylvanBdd));
}
template<typename ValueType>
@ -164,13 +164,15 @@ namespace storm {
template<typename ValueType>
InternalAdd<DdType::Sylvan, ValueType> InternalAdd<DdType::Sylvan, ValueType>::swapVariables(std::vector<InternalBdd<DdType::Sylvan>> const& from, std::vector<InternalBdd<DdType::Sylvan>> const& to) const {
std::vector<sylvan::Mtbdd> fromMtbdd;
std::vector<sylvan::Mtbdd> toMtbdd;
std::vector<uint32_t> fromIndices;
std::vector<uint32_t> toIndices;
uint_fast64_t var = 0;
for (auto it1 = from.begin(), ite1 = from.end(), it2 = to.begin(); it1 != ite1; ++it1, ++it2) {
fromMtbdd.push_back(it1->getSylvanBdd());
toMtbdd.push_back(it2->getSylvanBdd());
fromIndices.push_back(it1->getIndex());
toIndices.push_back(it2->getIndex());
++var;
}
return InternalAdd<DdType::Sylvan, ValueType>(ddManager, this->sylvanMtbdd.Permute(fromMtbdd, toMtbdd));
return InternalAdd<DdType::Sylvan, ValueType>(ddManager, this->sylvanMtbdd.Permute(fromIndices, toIndices));
}
template<typename ValueType>

12
src/storage/dd/sylvan/InternalSylvanBdd.cpp

@ -91,13 +91,13 @@ namespace storm {
}
InternalBdd<DdType::Sylvan> InternalBdd<DdType::Sylvan>::swapVariables(std::vector<InternalBdd<DdType::Sylvan>> const& from, std::vector<InternalBdd<DdType::Sylvan>> const& to) const {
std::vector<sylvan::Bdd> fromBdd;
std::vector<sylvan::Bdd> toBdd;
std::vector<uint32_t> fromIndices;
std::vector<uint32_t> toIndices;
for (auto it1 = from.begin(), ite1 = from.end(), it2 = to.begin(); it1 != ite1; ++it1, ++it2) {
fromBdd.push_back(it1->getSylvanBdd());
toBdd.push_back(it2->getSylvanBdd());
fromIndices.push_back(it1->getIndex());
toIndices.push_back(it2->getIndex());
}
return InternalBdd<DdType::Sylvan>(ddManager, this->sylvanBdd.Permute(fromBdd, toBdd));
return InternalBdd<DdType::Sylvan>(ddManager, this->sylvanBdd.Permute(fromIndices, toIndices));
}
InternalBdd<DdType::Sylvan> InternalBdd<DdType::Sylvan>::getSupport() const {
@ -131,7 +131,7 @@ namespace storm {
}
uint_fast64_t InternalBdd<DdType::Sylvan>::getIndex() const {
return static_cast<uint_fast64_t>(this->sylvanBdd.GetBDD());
return static_cast<uint_fast64_t>(this->sylvanBdd.TopVar());
}
void InternalBdd<DdType::Sylvan>::exportToDot(std::string const& filename, std::vector<std::string> const& ddVariableNamesAsStrings) const {

Loading…
Cancel
Save