Browse Source

added 'empty' framework for sylvan-based implementation of DD abstraction layer

Former-commit-id: c0f781a515
main
dehnert 9 years ago
parent
commit
d25bd3a32f
  1. 2
      src/CMakeLists.txt
  2. 5
      src/storage/dd/Add.cpp
  3. 5
      src/storage/dd/Add.h
  4. 12
      src/storage/dd/Bdd.cpp
  5. 1
      src/storage/dd/Bdd.h
  6. 1
      src/storage/dd/Dd.cpp
  7. 27
      src/storage/dd/DdManager.cpp
  8. 1
      src/storage/dd/DdManager.h
  9. 1
      src/storage/dd/DdMetaVariable.cpp
  10. 4
      src/storage/dd/DdMetaVariable.h
  11. 6
      src/storage/dd/cudd/CuddAddIterator.h
  12. 2
      src/storage/dd/cudd/InternalCuddAdd.cpp
  13. 317
      src/storage/dd/sylvan/InternalSylvanAdd.cpp
  14. 581
      src/storage/dd/sylvan/InternalSylvanAdd.h
  15. 150
      src/storage/dd/sylvan/InternalSylvanBdd.cpp
  16. 301
      src/storage/dd/sylvan/InternalSylvanBdd.h
  17. 61
      src/storage/dd/sylvan/InternalSylvanDdManager.cpp
  18. 101
      src/storage/dd/sylvan/InternalSylvanDdManager.h
  19. 36
      src/storage/dd/sylvan/SylvanAddIterator.cpp
  20. 69
      src/storage/dd/sylvan/SylvanAddIterator.h

2
src/CMakeLists.txt

@ -36,6 +36,7 @@ file(GLOB STORM_STORAGE_FILES ${PROJECT_SOURCE_DIR}/src/storage/*.h ${PROJECT_SO
file(GLOB STORM_STORAGE_BISIMULATION_FILES ${PROJECT_SOURCE_DIR}/src/storage/bisimulation/*.h ${PROJECT_SOURCE_DIR}/src/storage/bisimulation/*.cpp)
file(GLOB STORM_STORAGE_DD_FILES ${PROJECT_SOURCE_DIR}/src/storage/dd/*.h ${PROJECT_SOURCE_DIR}/src/storage/dd/*.cpp)
file(GLOB_RECURSE STORM_STORAGE_DD_CUDD_FILES ${PROJECT_SOURCE_DIR}/src/storage/dd/cudd/*.h ${PROJECT_SOURCE_DIR}/src/storage/dd/cudd/*.cpp)
file(GLOB_RECURSE STORM_STORAGE_DD_SYLVAN_FILES ${PROJECT_SOURCE_DIR}/src/storage/dd/sylvan/*.h ${PROJECT_SOURCE_DIR}/src/storage/dd/sylvan/*.cpp)
file(GLOB_RECURSE STORM_STORAGE_EXPRESSIONS_FILES ${PROJECT_SOURCE_DIR}/src/storage/expressions/*.h ${PROJECT_SOURCE_DIR}/src/storage/expressions/*.cpp)
file(GLOB_RECURSE STORM_STORAGE_PRISM_FILES ${PROJECT_SOURCE_DIR}/src/storage/prism/*.h ${PROJECT_SOURCE_DIR}/src/storage/prism/*.cpp)
file(GLOB_RECURSE STORM_STORAGE_SPARSE_FILES ${PROJECT_SOURCE_DIR}/src/storage/sparse/*.h ${PROJECT_SOURCE_DIR}/src/storage/sparse/*.cpp)
@ -82,6 +83,7 @@ source_group(storage FILES ${STORM_STORAGE_FILES})
source_group(storage\\bisimulation FILES ${STORM_STORAGE_BISIMULATION_FILES})
source_group(storage\\dd FILES ${STORM_STORAGE_DD_FILES})
source_group(storage\\dd\\cudd FILES ${STORM_STORAGE_DD_CUDD_FILES})
source_group(storage\\dd\\sylvan FILES ${STORM_STORAGE_DD_SYLVAN_FILES})
source_group(storage\\expressions FILES ${STORM_STORAGE_EXPRESSIONS_FILES})
source_group(storage\\prism FILES ${STORM_STORAGE_PRISM_FILES})
source_group(storage\\sparse FILES ${STORM_STORAGE_SPARSE_FILES})

5
src/storage/dd/Add.cpp

@ -768,7 +768,7 @@ namespace storm {
template<DdType LibraryType, typename ValueType>
Bdd<LibraryType> Add<LibraryType, ValueType>::toBdd() const {
return Bdd<DdType::CUDD>(this->getDdManager(), internalAdd.toBdd(), this->getContainedMetaVariables());
return Bdd<LibraryType>(this->getDdManager(), internalAdd.toBdd(), this->getContainedMetaVariables());
}
template<DdType LibraryType, typename ValueType>
@ -783,5 +783,8 @@ namespace storm {
template class Add<storm::dd::DdType::CUDD, double>;
template class Add<storm::dd::DdType::CUDD, uint_fast64_t>;
template class Add<storm::dd::DdType::Sylvan, double>;
template class Add<storm::dd::DdType::Sylvan, uint_fast64_t>;
}
}

5
src/storage/dd/Add.h

@ -5,10 +5,13 @@
#include "src/storage/dd/Dd.h"
#include "src/storage/dd/DdType.h"
#include "src/storage/dd/Odd.h"
#include "src/storage/dd/cudd/InternalCuddAdd.h"
#include "src/storage/dd/sylvan/InternalSylvanAdd.h"
#include "src/storage/dd/cudd/CuddAddIterator.h"
#include "src/storage/dd/Odd.h"
#include "src/storage/dd/sylvan/SylvanAddIterator.h"
namespace storm {
namespace dd {

12
src/storage/dd/Bdd.cpp

@ -261,5 +261,17 @@ namespace storm {
template std::vector<double> Bdd<DdType::CUDD>::filterExplicitVector(Odd const& odd, std::vector<double> const& values) const;
template std::vector<uint_fast64_t> Bdd<DdType::CUDD>::filterExplicitVector(Odd const& odd, std::vector<uint_fast64_t> const& values) const;
template class Bdd<DdType::Sylvan>;
template Bdd<DdType::Sylvan> Bdd<DdType::Sylvan>::fromVector(std::shared_ptr<DdManager<DdType::Sylvan> const> ddManager, std::vector<double> const& values, Odd const& odd, std::set<storm::expressions::Variable> const& metaVariables, std::function<bool (double const&)> const& filter);
template Bdd<DdType::Sylvan> Bdd<DdType::Sylvan>::fromVector(std::shared_ptr<DdManager<DdType::Sylvan> const> ddManager, std::vector<uint_fast64_t> const& values, Odd const& odd, std::set<storm::expressions::Variable> const& metaVariables, std::function<bool (uint_fast64_t const&)> const& filter);
template Add<DdType::Sylvan, double> Bdd<DdType::Sylvan>::toAdd() const;
template Add<DdType::Sylvan, uint_fast64_t> Bdd<DdType::Sylvan>::toAdd() const;
template std::vector<double> Bdd<DdType::Sylvan>::filterExplicitVector(Odd const& odd, std::vector<double> const& values) const;
template std::vector<uint_fast64_t> Bdd<DdType::Sylvan>::filterExplicitVector(Odd const& odd, std::vector<uint_fast64_t> const& values) const;
}
}

1
src/storage/dd/Bdd.h

@ -5,6 +5,7 @@
#include "src/storage/dd/DdType.h"
#include "src/storage/dd/cudd/InternalCuddBdd.h"
#include "src/storage/dd/sylvan/InternalSylvanBdd.h"
namespace storm {
namespace logic {

1
src/storage/dd/Dd.cpp

@ -85,5 +85,6 @@ namespace storm {
}
template class Dd<storm::dd::DdType::CUDD>;
template class Dd<storm::dd::DdType::Sylvan>;
}
}

27
src/storage/dd/DdManager.cpp

@ -51,7 +51,7 @@ namespace storm {
std::vector<Bdd<LibraryType>> const& ddVariables = metaVariable.getDdVariables();
Bdd<DdType::CUDD> result;
Bdd<LibraryType> result;
if (value & (1ull << (ddVariables.size() - 1))) {
result = ddVariables[0];
} else {
@ -114,8 +114,8 @@ namespace storm {
std::vector<Bdd<LibraryType>> variablesPrime;
for (std::size_t i = 0; i < numberOfBits; ++i) {
auto ddVariablePair = internalDdManager.createNewDdVariablePair();
variables.emplace_back(Bdd<DdType::CUDD>(this->shared_from_this(), ddVariablePair.first, {unprimed}));
variablesPrime.emplace_back(Bdd<DdType::CUDD>(this->shared_from_this(), ddVariablePair.second, {primed}));
variables.emplace_back(Bdd<LibraryType>(this->shared_from_this(), ddVariablePair.first, {unprimed}));
variablesPrime.emplace_back(Bdd<LibraryType>(this->shared_from_this(), ddVariablePair.second, {primed}));
}
metaVariableMap.emplace(unprimed, DdMetaVariable<LibraryType>(name, low, high, variables));
@ -138,8 +138,8 @@ namespace storm {
std::vector<Bdd<LibraryType>> variables;
std::vector<Bdd<LibraryType>> variablesPrime;
auto ddVariablePair = internalDdManager.createNewDdVariablePair();
variables.emplace_back(Bdd<DdType::CUDD>(this->shared_from_this(), ddVariablePair.first, {unprimed}));
variablesPrime.emplace_back(Bdd<DdType::CUDD>(this->shared_from_this(), ddVariablePair.second, {primed}));
variables.emplace_back(Bdd<LibraryType>(this->shared_from_this(), ddVariablePair.first, {unprimed}));
variablesPrime.emplace_back(Bdd<LibraryType>(this->shared_from_this(), ddVariablePair.second, {primed}));
metaVariableMap.emplace(unprimed, DdMetaVariable<LibraryType>(name, variables));
metaVariableMap.emplace(primed, DdMetaVariable<LibraryType>(name + "'", variablesPrime));
@ -220,7 +220,7 @@ namespace storm {
// First, we initialize a list DD variables and their names.
std::vector<std::pair<uint_fast64_t, storm::expressions::Variable>> variablePairs;
for (auto const& variablePair : this->metaVariableMap) {
DdMetaVariable<DdType::CUDD> const& metaVariable = variablePair.second;
DdMetaVariable<LibraryType> const& metaVariable = variablePair.second;
// If the meta variable is of type bool, we don't need to suffix it with the bit number.
if (metaVariable.getType() == MetaVariableType::Bool) {
variablePairs.emplace_back(metaVariable.getDdVariables().front().getIndex(), variablePair.first);
@ -325,5 +325,20 @@ namespace storm {
template Add<DdType::CUDD, double> DdManager<DdType::CUDD>::getIdentity(storm::expressions::Variable const& variable) const;
template Add<DdType::CUDD, uint_fast64_t> DdManager<DdType::CUDD>::getIdentity(storm::expressions::Variable const& variable) const;
template class DdManager<DdType::Sylvan>;
template Add<DdType::Sylvan, double> DdManager<DdType::Sylvan>::getAddZero() const;
template Add<DdType::Sylvan, uint_fast64_t> DdManager<DdType::Sylvan>::getAddZero() const;
template Add<DdType::Sylvan, double> DdManager<DdType::Sylvan>::getAddOne() const;
template Add<DdType::Sylvan, uint_fast64_t> DdManager<DdType::Sylvan>::getAddOne() const;
template Add<DdType::Sylvan, double> DdManager<DdType::Sylvan>::getConstant(double const& value) const;
template Add<DdType::Sylvan, uint_fast64_t> DdManager<DdType::Sylvan>::getConstant(uint_fast64_t const& value) const;
template Add<DdType::Sylvan, double> DdManager<DdType::Sylvan>::getIdentity(storm::expressions::Variable const& variable) const;
template Add<DdType::Sylvan, uint_fast64_t> DdManager<DdType::Sylvan>::getIdentity(storm::expressions::Variable const& variable) const;
}
}

1
src/storage/dd/DdManager.h

@ -13,6 +13,7 @@
#include "src/storage/expressions/Variable.h"
#include "src/storage/dd/cudd/InternalCuddDdManager.h"
#include "src/storage/dd/sylvan/InternalSylvanDdManager.h"
namespace storm {
namespace dd {

1
src/storage/dd/DdMetaVariable.cpp

@ -61,5 +61,6 @@ namespace storm {
}
template class DdMetaVariable<DdType::CUDD>;
template class DdMetaVariable<DdType::Sylvan>;
}
}

4
src/storage/dd/DdMetaVariable.h

@ -118,10 +118,10 @@ namespace storm {
int_fast64_t high;
// The vector of variables that are used to encode the meta variable.
std::vector<Bdd<DdType::CUDD>> ddVariables;
std::vector<Bdd<LibraryType>> ddVariables;
// The cube consisting of all variables that encode the meta variable.
Bdd<DdType::CUDD> cube;
Bdd<LibraryType> cube;
};
}
}

6
src/storage/dd/cudd/CuddAddIterator.h

@ -1,5 +1,5 @@
#ifndef STORM_STORAGE_DD_CUDDAddIterator_H_
#define STORM_STORAGE_DD_CUDDAddIterator_H_
#ifndef STORM_STORAGE_DD_CUDDADDITERATOR_H_
#define STORM_STORAGE_DD_CUDDADDITERATOR_H_
#include <memory>
#include <cstdint>
@ -136,4 +136,4 @@ namespace storm {
}
}
#endif /* STORM_STORAGE_DD_CUDDAddIterator_H_ */
#endif /* STORM_STORAGE_DD_CUDDADDITERATOR_H_ */

2
src/storage/dd/cudd/InternalCuddAdd.cpp

@ -179,7 +179,7 @@ namespace storm {
} else {
return this->getCuddAdd().EqualSupNorm(other.getCuddAdd(), precision);
}
};
}
template<typename ValueType>
InternalAdd<DdType::CUDD, ValueType> InternalAdd<DdType::CUDD, ValueType>::swapVariables(std::vector<InternalAdd<DdType::CUDD, ValueType>> const& from, std::vector<InternalAdd<DdType::CUDD, ValueType>> const& to) const {

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

@ -0,0 +1,317 @@
#include "src/storage/dd/sylvan/InternalSylvanAdd.h"
#include "src/utility/macros.h"
#include "src/exceptions/NotImplementedException.h"
namespace storm {
namespace dd {
template<typename ValueType>
bool InternalAdd<DdType::Sylvan, ValueType>::operator==(InternalAdd<DdType::Sylvan, ValueType> const& other) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
bool InternalAdd<DdType::Sylvan, ValueType>::operator!=(InternalAdd<DdType::Sylvan, ValueType> const& other) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
InternalAdd<DdType::Sylvan, ValueType> InternalAdd<DdType::Sylvan, ValueType>::ite(InternalAdd<DdType::Sylvan, ValueType> const& thenDd, InternalAdd<DdType::Sylvan, ValueType> const& elseDd) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
InternalAdd<DdType::Sylvan, ValueType> InternalAdd<DdType::Sylvan, ValueType>::operator!() const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
InternalAdd<DdType::Sylvan, ValueType> InternalAdd<DdType::Sylvan, ValueType>::operator||(InternalAdd<DdType::Sylvan, ValueType> const& other) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
InternalAdd<DdType::Sylvan, ValueType>& InternalAdd<DdType::Sylvan, ValueType>::operator|=(InternalAdd<DdType::Sylvan, ValueType> const& other) {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
InternalAdd<DdType::Sylvan, ValueType> InternalAdd<DdType::Sylvan, ValueType>::operator+(InternalAdd<DdType::Sylvan, ValueType> const& other) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
InternalAdd<DdType::Sylvan, ValueType>& InternalAdd<DdType::Sylvan, ValueType>::operator+=(InternalAdd<DdType::Sylvan, ValueType> const& other) {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
InternalAdd<DdType::Sylvan, ValueType> InternalAdd<DdType::Sylvan, ValueType>::operator*(InternalAdd<DdType::Sylvan, ValueType> const& other) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
InternalAdd<DdType::Sylvan, ValueType>& InternalAdd<DdType::Sylvan, ValueType>::operator*=(InternalAdd<DdType::Sylvan, ValueType> const& other) {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
InternalAdd<DdType::Sylvan, ValueType> InternalAdd<DdType::Sylvan, ValueType>::operator-(InternalAdd<DdType::Sylvan, ValueType> const& other) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
InternalAdd<DdType::Sylvan, ValueType>& InternalAdd<DdType::Sylvan, ValueType>::operator-=(InternalAdd<DdType::Sylvan, ValueType> const& other) {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
InternalAdd<DdType::Sylvan, ValueType> InternalAdd<DdType::Sylvan, ValueType>::operator/(InternalAdd<DdType::Sylvan, ValueType> const& other) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
InternalAdd<DdType::Sylvan, ValueType>& InternalAdd<DdType::Sylvan, ValueType>::operator/=(InternalAdd<DdType::Sylvan, ValueType> const& other) {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
InternalAdd<DdType::Sylvan, ValueType> InternalAdd<DdType::Sylvan, ValueType>::equals(InternalAdd<DdType::Sylvan, ValueType> const& other) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
InternalAdd<DdType::Sylvan, ValueType> InternalAdd<DdType::Sylvan, ValueType>::notEquals(InternalAdd<DdType::Sylvan, ValueType> const& other) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
InternalAdd<DdType::Sylvan, ValueType> InternalAdd<DdType::Sylvan, ValueType>::less(InternalAdd<DdType::Sylvan, ValueType> const& other) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
InternalAdd<DdType::Sylvan, ValueType> InternalAdd<DdType::Sylvan, ValueType>::lessOrEqual(InternalAdd<DdType::Sylvan, ValueType> const& other) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
InternalAdd<DdType::Sylvan, ValueType> InternalAdd<DdType::Sylvan, ValueType>::greater(InternalAdd<DdType::Sylvan, ValueType> const& other) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
InternalAdd<DdType::Sylvan, ValueType> InternalAdd<DdType::Sylvan, ValueType>::greaterOrEqual(InternalAdd<DdType::Sylvan, ValueType> const& other) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
InternalAdd<DdType::Sylvan, ValueType> InternalAdd<DdType::Sylvan, ValueType>::pow(InternalAdd<DdType::Sylvan, ValueType> const& other) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
InternalAdd<DdType::Sylvan, ValueType> InternalAdd<DdType::Sylvan, ValueType>::mod(InternalAdd<DdType::Sylvan, ValueType> const& other) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
InternalAdd<DdType::Sylvan, ValueType> InternalAdd<DdType::Sylvan, ValueType>::logxy(InternalAdd<DdType::Sylvan, ValueType> const& other) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
InternalAdd<DdType::Sylvan, ValueType> InternalAdd<DdType::Sylvan, ValueType>::floor() const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
InternalAdd<DdType::Sylvan, ValueType> InternalAdd<DdType::Sylvan, ValueType>::ceil() const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
InternalAdd<DdType::Sylvan, ValueType> InternalAdd<DdType::Sylvan, ValueType>::minimum(InternalAdd<DdType::Sylvan, ValueType> const& other) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
InternalAdd<DdType::Sylvan, ValueType> InternalAdd<DdType::Sylvan, ValueType>::maximum(InternalAdd<DdType::Sylvan, ValueType> const& other) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
InternalAdd<DdType::Sylvan, ValueType> InternalAdd<DdType::Sylvan, ValueType>::sumAbstract(InternalBdd<DdType::Sylvan> const& cube) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
InternalAdd<DdType::Sylvan, ValueType> InternalAdd<DdType::Sylvan, ValueType>::minAbstract(InternalBdd<DdType::Sylvan> const& cube) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
InternalAdd<DdType::Sylvan, ValueType> InternalAdd<DdType::Sylvan, ValueType>::maxAbstract(InternalBdd<DdType::Sylvan> const& cube) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
bool InternalAdd<DdType::Sylvan, ValueType>::equalModuloPrecision(InternalAdd<DdType::Sylvan, ValueType> const& other, double precision, bool relative) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
InternalAdd<DdType::Sylvan, ValueType> InternalAdd<DdType::Sylvan, ValueType>::swapVariables(std::vector<InternalAdd<DdType::Sylvan, ValueType>> const& from, std::vector<InternalAdd<DdType::Sylvan, ValueType>> const& to) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
InternalAdd<DdType::Sylvan, ValueType> InternalAdd<DdType::Sylvan, ValueType>::multiplyMatrix(InternalAdd<DdType::Sylvan, ValueType> const& otherMatrix, std::vector<InternalAdd<DdType::Sylvan, ValueType>> const& summationDdVariables) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
InternalBdd<DdType::Sylvan> InternalAdd<DdType::Sylvan, ValueType>::greater(ValueType const& value) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
InternalBdd<DdType::Sylvan> InternalAdd<DdType::Sylvan, ValueType>::greaterOrEqual(ValueType const& value) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
InternalBdd<DdType::Sylvan> InternalAdd<DdType::Sylvan, ValueType>::less(ValueType const& value) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
InternalBdd<DdType::Sylvan> InternalAdd<DdType::Sylvan, ValueType>::lessOrEqual(ValueType const& value) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
InternalBdd<DdType::Sylvan> InternalAdd<DdType::Sylvan, ValueType>::notZero() const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
InternalAdd<DdType::Sylvan, ValueType> InternalAdd<DdType::Sylvan, ValueType>::constrain(InternalAdd<DdType::Sylvan, ValueType> const& constraint) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
InternalAdd<DdType::Sylvan, ValueType> InternalAdd<DdType::Sylvan, ValueType>::restrict(InternalAdd<DdType::Sylvan, ValueType> const& constraint) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
InternalBdd<DdType::Sylvan> InternalAdd<DdType::Sylvan, ValueType>::getSupport() const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
uint_fast64_t InternalAdd<DdType::Sylvan, ValueType>::getNonZeroCount(uint_fast64_t numberOfDdVariables) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
uint_fast64_t InternalAdd<DdType::Sylvan, ValueType>::getLeafCount() const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
uint_fast64_t InternalAdd<DdType::Sylvan, ValueType>::getNodeCount() const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
ValueType InternalAdd<DdType::Sylvan, ValueType>::getMin() const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
ValueType InternalAdd<DdType::Sylvan, ValueType>::getMax() const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
InternalBdd<DdType::Sylvan> InternalAdd<DdType::Sylvan, ValueType>::toBdd() const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
bool InternalAdd<DdType::Sylvan, ValueType>::isOne() const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
bool InternalAdd<DdType::Sylvan, ValueType>::isZero() const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
bool InternalAdd<DdType::Sylvan, ValueType>::isConstant() const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
uint_fast64_t InternalAdd<DdType::Sylvan, ValueType>::getIndex() const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
void InternalAdd<DdType::Sylvan, ValueType>::exportToDot(std::string const& filename, std::vector<std::string> const& ddVariableNamesAsStrings) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
AddIterator<DdType::Sylvan, ValueType> InternalAdd<DdType::Sylvan, ValueType>::begin(std::shared_ptr<DdManager<DdType::Sylvan> const> fullDdManager, std::set<storm::expressions::Variable> const& metaVariables, bool enumerateDontCareMetaVariables) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
AddIterator<DdType::Sylvan, ValueType> InternalAdd<DdType::Sylvan, ValueType>::end(std::shared_ptr<DdManager<DdType::Sylvan> const> fullDdManager, bool enumerateDontCareMetaVariables) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
Odd InternalAdd<DdType::Sylvan, ValueType>::createOdd(std::vector<uint_fast64_t> const& ddVariableIndices) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
void InternalAdd<DdType::Sylvan, ValueType>::composeWithExplicitVector(storm::dd::Odd const& odd, std::vector<uint_fast64_t> const& ddVariableIndices, std::vector<ValueType>& targetVector, std::function<ValueType (ValueType const&, ValueType const&)> const& function) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
void InternalAdd<DdType::Sylvan, ValueType>::composeWithExplicitVector(storm::dd::Odd const& odd, std::vector<uint_fast64_t> const& ddVariableIndices, std::vector<uint_fast64_t> const& offsets, std::vector<ValueType>& targetVector, std::function<ValueType (ValueType const&, ValueType const&)> const& function) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
std::vector<InternalAdd<DdType::Sylvan, ValueType>> InternalAdd<DdType::Sylvan, ValueType>::splitIntoGroups(std::vector<uint_fast64_t> const& ddGroupVariableIndices) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
std::vector<std::pair<InternalAdd<DdType::Sylvan, ValueType>, InternalAdd<DdType::Sylvan, ValueType>>> InternalAdd<DdType::Sylvan, ValueType>::splitIntoGroups(InternalAdd<DdType::Sylvan, ValueType> vector, std::vector<uint_fast64_t> const& ddGroupVariableIndices) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
void InternalAdd<DdType::Sylvan, ValueType>::toMatrixComponents(std::vector<uint_fast64_t> const& rowGroupIndices, std::vector<uint_fast64_t>& rowIndications, std::vector<storm::storage::MatrixEntry<uint_fast64_t, ValueType>>& columnsAndValues, Odd const& rowOdd, Odd const& columnOdd, std::vector<uint_fast64_t> const& ddRowVariableIndices, std::vector<uint_fast64_t> const& ddColumnVariableIndices, bool writeValues) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
InternalAdd<DdType::Sylvan, ValueType> InternalAdd<DdType::Sylvan, ValueType>::fromVector(InternalDdManager<DdType::Sylvan> const* ddManager, std::vector<ValueType> const& values, storm::dd::Odd const& odd, std::vector<uint_fast64_t> const& ddVariableIndices) {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template class InternalAdd<DdType::Sylvan, double>;
template class InternalAdd<DdType::Sylvan, uint_fast64_t>;
}
}

581
src/storage/dd/sylvan/InternalSylvanAdd.h

@ -0,0 +1,581 @@
#ifndef STORM_STORAGE_DD_CUDD_INTERNALSYLVANADD_H_
#define STORM_STORAGE_DD_CUDD_INTERNALSYLVANADD_H_
#include <set>
#include <unordered_map>
#include "src/storage/dd/DdType.h"
#include "src/storage/dd/InternalAdd.h"
#include "src/storage/dd/Odd.h"
#include "src/storage/dd/sylvan/InternalSylvanBdd.h"
#include "src/storage/dd/sylvan/SylvanAddIterator.h"
#include "src/storage/expressions/Variable.h"
namespace storm {
namespace storage {
template<typename T>
class SparseMatrix;
class BitVector;
template<typename E, typename V>
class MatrixEntry;
}
namespace dd {
template<DdType LibraryType>
class DdManager;
template<DdType LibraryType>
class InternalDdManager;
template<DdType LibraryType>
class InternalBdd;
template<DdType LibraryType, typename ValueType>
class AddIterator;
template<typename ValueType>
class InternalAdd<DdType::Sylvan, ValueType> {
public:
// Instantiate all copy/move constructors/assignments with the default implementation.
InternalAdd() = default;
InternalAdd(InternalAdd<DdType::Sylvan, ValueType> const& other) = default;
InternalAdd& operator=(InternalAdd<DdType::Sylvan, ValueType> const& other) = default;
InternalAdd(InternalAdd<DdType::Sylvan, ValueType>&& other) = default;
InternalAdd& operator=(InternalAdd<DdType::Sylvan, ValueType>&& other) = default;
/*!
* Retrieves whether the two DDs represent the same function.
*
* @param other The DD that is to be compared with the current one.
* @return True if the DDs represent the same function.
*/
bool operator==(InternalAdd<DdType::Sylvan, ValueType> const& other) const;
/*!
* Retrieves whether the two DDs represent different functions.
*
* @param other The DD that is to be compared with the current one.
* @return True if the DDs represent the different functions.
*/
bool operator!=(InternalAdd<DdType::Sylvan, ValueType> const& other) const;
/*!
* Performs an if-then-else with the given operands, i.e. maps all valuations that are mapped to a non-zero
* function value to the function values specified by the first DD and all others to the function values
* specified by the second DD.
*
* @param thenDd The ADD specifying the 'then' part.
* @param elseDd The ADD specifying the 'else' part.
* @return The ADD corresponding to the if-then-else of the operands.
*/
InternalAdd<DdType::Sylvan, ValueType> ite(InternalAdd<DdType::Sylvan, ValueType> const& thenAdd, InternalAdd<DdType::Sylvan, ValueType> const& elseAdd) const;
/*!
* Logically inverts the current ADD. That is, all inputs yielding non-zero values will be mapped to zero in
* the result and vice versa.
*
* @return The resulting ADD.
*/
InternalAdd<DdType::Sylvan, ValueType> operator!() const;
/*!
* Performs a logical or of the current and the given ADD. As a prerequisite, the operand ADDs need to be
* 0/1 ADDs.
*
* @param other The second ADD used for the operation.
* @return The logical or of the operands.
*/
InternalAdd<DdType::Sylvan, ValueType> operator||(InternalAdd<DdType::Sylvan, ValueType> const& other) const;
/*!
* Performs a logical or of the current and the given ADD and assigns it to the current ADD. As a
* prerequisite, the operand ADDs need to be 0/1 ADDs.
*
* @param other The second ADD used for the operation.
* @return A reference to the current ADD after the operation
*/
InternalAdd<DdType::Sylvan, ValueType>& operator|=(InternalAdd<DdType::Sylvan, ValueType> const& other);
/*!
* Adds the two ADDs.
*
* @param other The ADD to add to the current one.
* @return The result of the addition.
*/
InternalAdd<DdType::Sylvan, ValueType> operator+(InternalAdd<DdType::Sylvan, ValueType> const& other) const;
/*!
* Adds the given ADD to the current one.
*
* @param other The ADD to add to the current one.
* @return A reference to the current ADD after the operation.
*/
InternalAdd<DdType::Sylvan, ValueType>& operator+=(InternalAdd<DdType::Sylvan, ValueType> const& other);
/*!
* Multiplies the two ADDs.
*
* @param other The ADD to multiply with the current one.
* @return The result of the multiplication.
*/
InternalAdd<DdType::Sylvan, ValueType> operator*(InternalAdd<DdType::Sylvan, ValueType> const& other) const;
/*!
* Multiplies the given ADD with the current one and assigns the result to the current ADD.
*
* @param other The ADD to multiply with the current one.
* @return A reference to the current ADD after the operation.
*/
InternalAdd<DdType::Sylvan, ValueType>& operator*=(InternalAdd<DdType::Sylvan, ValueType> const& other);
/*!
* Subtracts the given ADD from the current one.
*
* @param other The ADD to subtract from the current one.
* @return The result of the subtraction.
*/
InternalAdd<DdType::Sylvan, ValueType> operator-(InternalAdd<DdType::Sylvan, ValueType> const& other) const;
/*!
* Subtracts the given ADD from the current one and assigns the result to the current ADD.
*
* @param other The ADD to subtract from the current one.
* @return A reference to the current ADD after the operation.
*/
InternalAdd<DdType::Sylvan, ValueType>& operator-=(InternalAdd<DdType::Sylvan, ValueType> const& other);
/*!
* Divides the current ADD by the given one.
*
* @param other The ADD by which to divide the current one.
* @return The result of the division.
*/
InternalAdd<DdType::Sylvan, ValueType> operator/(InternalAdd<DdType::Sylvan, ValueType> const& other) const;
/*!
* Divides the current ADD by the given one and assigns the result to the current ADD.
*
* @param other The ADD by which to divide the current one.
* @return A reference to the current ADD after the operation.
*/
InternalAdd<DdType::Sylvan, ValueType>& operator/=(InternalAdd<DdType::Sylvan, ValueType> const& other);
/*!
* Retrieves the function that maps all evaluations to one that have identical function values.
*
* @param other The ADD with which to perform the operation.
* @return The resulting function represented as an ADD.
*/
InternalAdd<DdType::Sylvan, ValueType> equals(InternalAdd<DdType::Sylvan, ValueType> const& other) const;
/*!
* Retrieves the function that maps all evaluations to one that have distinct function values.
*
* @param other The ADD with which to perform the operation.
* @return The resulting function represented as an ADD.
*/
InternalAdd<DdType::Sylvan, ValueType> notEquals(InternalAdd<DdType::Sylvan, ValueType> const& other) const;
/*!
* Retrieves the function that maps all evaluations to one whose function value in the first ADD are less
* than the one in the given ADD.
*
* @param other The ADD with which to perform the operation.
* @return The resulting function represented as an ADD.
*/
InternalAdd<DdType::Sylvan, ValueType> less(InternalAdd<DdType::Sylvan, ValueType> const& other) const;
/*!
* Retrieves the function that maps all evaluations to one whose function value in the first ADD are less or
* equal than the one in the given ADD.
*
* @param other The DD with which to perform the operation.
* @return The resulting function represented as an ADD.
*/
InternalAdd<DdType::Sylvan, ValueType> lessOrEqual(InternalAdd<DdType::Sylvan, ValueType> const& other) const;
/*!
* Retrieves the function that maps all evaluations to one whose function value in the first ADD are greater
* than the one in the given ADD.
*
* @param other The ADD with which to perform the operation.
* @return The resulting function represented as an ADD.
*/
InternalAdd<DdType::Sylvan, ValueType> greater(InternalAdd<DdType::Sylvan, ValueType> const& other) const;
/*!
* Retrieves the function that maps all evaluations to one whose function value in the first ADD are greater
* or equal than the one in the given ADD.
*
* @param other The ADD with which to perform the operation.
* @return The resulting function represented as an ADD.
*/
InternalAdd<DdType::Sylvan, ValueType> greaterOrEqual(InternalAdd<DdType::Sylvan, ValueType> const& other) const;
/*!
* Retrieves the function that represents the current ADD to the power of the given ADD.
*
* @other The exponent function (given as an ADD).
* @retur The resulting ADD.
*/
InternalAdd<DdType::Sylvan, ValueType> pow(InternalAdd<DdType::Sylvan, ValueType> const& other) const;
/*!
* Retrieves the function that represents the current ADD modulo the given ADD.
*
* @other The modul function (given as an ADD).
* @retur The resulting ADD.
*/
InternalAdd<DdType::Sylvan, ValueType> mod(InternalAdd<DdType::Sylvan, ValueType> const& other) const;
/*!
* Retrieves the function that represents the logarithm of the current ADD to the bases given by the second
* ADD.
*
* @other The base function (given as an ADD).
* @retur The resulting ADD.
*/
InternalAdd<DdType::Sylvan, ValueType> logxy(InternalAdd<DdType::Sylvan, ValueType> const& other) const;
/*!
* Retrieves the function that floors all values in the current ADD.
*
* @retur The resulting ADD.
*/
InternalAdd<DdType::Sylvan, ValueType> floor() const;
/*!
* Retrieves the function that ceils all values in the current ADD.
*
* @retur The resulting ADD.
*/
InternalAdd<DdType::Sylvan, ValueType> ceil() const;
/*!
* Retrieves the function that maps all evaluations to the minimum of the function values of the two ADDs.
*
* @param other The ADD with which to perform the operation.
* @return The resulting function represented as an ADD.
*/
InternalAdd<DdType::Sylvan, ValueType> minimum(InternalAdd<DdType::Sylvan, ValueType> const& other) const;
/*!
* Retrieves the function that maps all evaluations to the maximum of the function values of the two ADDs.
*
* @param other The ADD with which to perform the operation.
* @return The resulting function represented as an ADD.
*/
InternalAdd<DdType::Sylvan, ValueType> maximum(InternalAdd<DdType::Sylvan, ValueType> const& other) const;
/*!
* Sum-abstracts from the given cube.
*
* @param cube The cube from which to abstract.
*/
InternalAdd<DdType::Sylvan, ValueType> sumAbstract(InternalBdd<DdType::Sylvan> const& cube) const;
/*!
* Min-abstracts from the given cube.
*
* @param cube The cube from which to abstract.
*/
InternalAdd<DdType::Sylvan, ValueType> minAbstract(InternalBdd<DdType::Sylvan> const& cube) const;
/*!
* Max-abstracts from the given cube.
*
* @param cube The cube from which to abstract.
*/
InternalAdd<DdType::Sylvan, ValueType> maxAbstract(InternalBdd<DdType::Sylvan> const& cube) const;
/*!
* Checks whether the current and the given ADD represent the same function modulo some given precision.
*
* @param other The ADD with which to compare.
* @param precision An upper bound on the maximal difference between any two function values that is to be
* tolerated.
* @param relative If set to true, not the absolute values have to be within the precision, but the relative
* values.
*/
bool equalModuloPrecision(InternalAdd<DdType::Sylvan, ValueType> const& other, double precision, bool relative = true) const;
/*!
* Swaps the given pairs of DD variables in the ADD. The pairs of meta variables have to be represented by
* ADDs must have equal length.
*
* @param from The vector that specifies the 'from' part of the variable renaming.
* @param to The vector that specifies the 'to' part of the variable renaming.
* @return The resulting ADD.
*/
InternalAdd<DdType::Sylvan, ValueType> swapVariables(std::vector<InternalAdd<DdType::Sylvan, ValueType>> const& from, std::vector<InternalAdd<DdType::Sylvan, ValueType>> const& to) const;
/*!
* Multiplies the current ADD (representing a matrix) with the given matrix by summing over the given meta
* variables.
*
* @param otherMatrix The matrix with which to multiply.
* @param summationDdVariables The DD variables (represented as ADDs) over which to sum.
* @return An ADD representing the result of the matrix-matrix multiplication.
*/
InternalAdd<DdType::Sylvan, ValueType> multiplyMatrix(InternalAdd<DdType::Sylvan, ValueType> const& otherMatrix, std::vector<InternalAdd<DdType::Sylvan, ValueType>> const& summationDdVariables) const;
/*!
* Computes a BDD that represents the function in which all assignments with a function value strictly
* larger than the given value are mapped to one and all others to zero.
*
* @param value The value used for the comparison.
* @return The resulting BDD.
*/
InternalBdd<DdType::Sylvan> greater(ValueType const& value) const;
/*!
* Computes a BDD that represents the function in which all assignments with a function value larger or equal
* to the given value are mapped to one and all others to zero.
*
* @param value The value used for the comparison.
* @return The resulting BDD.
*/
InternalBdd<DdType::Sylvan> greaterOrEqual(ValueType const& value) const;
/*!
* Computes a BDD that represents the function in which all assignments with a function value strictly
* lower than the given value are mapped to one and all others to zero.
*
* @param value The value used for the comparison.
* @return The resulting BDD.
*/
InternalBdd<DdType::Sylvan> less(ValueType const& value) const;
/*!
* Computes a BDD that represents the function in which all assignments with a function value less or equal
* to the given value are mapped to one and all others to zero.
*
* @param value The value used for the comparison.
* @return The resulting BDD.
*/
InternalBdd<DdType::Sylvan> lessOrEqual(ValueType const& value) const;
/*!
* Computes a BDD that represents the function in which all assignments with a function value unequal to
* zero are mapped to one and all others to zero.
*
* @return The resulting DD.
*/
InternalBdd<DdType::Sylvan> notZero() const;
/*!
* Computes the constraint of the current ADD with the given constraint. That is, the function value of the
* resulting ADD will be the same as the current ones for all assignments mapping to one in the constraint
* and may be different otherwise.
*
* @param constraint The constraint to use for the operation.
* @return The resulting ADD.
*/
InternalAdd<DdType::Sylvan, ValueType> constrain(InternalAdd<DdType::Sylvan, ValueType> const& constraint) const;
/*!
* Computes the restriction of the current ADD with the given constraint. That is, the function value of the
* resulting DD will be the same as the current ones for all assignments mapping to one in the constraint
* and may be different otherwise.
*
* @param constraint The constraint to use for the operation.
* @return The resulting ADD.
*/
InternalAdd<DdType::Sylvan, ValueType> restrict(InternalAdd<DdType::Sylvan, ValueType> const& constraint) const;
/*!
* Retrieves the support of the current ADD.
*
* @return The support represented as a BDD.
*/
InternalBdd<DdType::Sylvan> getSupport() const;
/*!
* Retrieves the number of encodings that are mapped to a non-zero value.
*
* @param The number of DD variables contained in this ADD.
* @return The number of encodings that are mapped to a non-zero value.
*/
virtual uint_fast64_t getNonZeroCount(uint_fast64_t numberOfDdVariables) const;
/*!
* Retrieves the number of leaves of the ADD.
*
* @return The number of leaves of the ADD.
*/
virtual uint_fast64_t getLeafCount() const;
/*!
* Retrieves the number of nodes necessary to represent the DD.
*
* @return The number of nodes in this DD.
*/
virtual uint_fast64_t getNodeCount() const;
/*!
* Retrieves the lowest function value of any encoding.
*
* @return The lowest function value of any encoding.
*/
ValueType getMin() const;
/*!
* Retrieves the highest function value of any encoding.
*
* @return The highest function value of any encoding.
*/
ValueType getMax() const;
/*!
* Converts the ADD to a BDD by mapping all values unequal to zero to 1. This effectively does the same as
* a call to notZero().
*
* @return The corresponding BDD.
*/
InternalBdd<DdType::Sylvan> toBdd() const;
/*!
* Retrieves whether this ADD represents the constant one function.
*
* @return True if this ADD represents the constant one function.
*/
bool isOne() const;
/*!
* Retrieves whether this ADD represents the constant zero function.
*
* @return True if this ADD represents the constant zero function.
*/
bool isZero() const;
/*!
* Retrieves whether this ADD represents a constant function.
*
* @return True if this ADD represents a constants function.
*/
bool isConstant() const;
/*!
* Retrieves the index of the topmost variable in the DD.
*
* @return The index of the topmost variable in DD.
*/
virtual uint_fast64_t getIndex() const;
/*!
* Exports the DD to the given file in the dot format.
*
* @param filename The name of the file to which the DD is to be exported.
* @param ddVariableNamesAsString The names of the DD variables to display in the dot file.
*/
void exportToDot(std::string const& filename, std::vector<std::string> const& ddVariableNamesAsStrings) const;
/*!
* Retrieves an iterator that points to the first meta variable assignment with a non-zero function value.
*
* @param fullDdManager The DD manager responsible for this ADD.
* @param metaVariables The meta variables contained in the ADD.
* @param enumerateDontCareMetaVariables If set to true, all meta variable assignments are enumerated, even
* if a meta variable does not at all influence the the function value.
* @return An iterator that points to the first meta variable assignment with a non-zero function value.
*/
AddIterator<DdType::Sylvan, ValueType> begin(std::shared_ptr<DdManager<DdType::Sylvan> const> fullDdManager, std::set<storm::expressions::Variable> const& metaVariables, bool enumerateDontCareMetaVariables = true) const;
/*!
* Retrieves an iterator that points past the end of the container.
*
* @param fullDdManager The DD manager responsible for this ADD.
* @param enumerateDontCareMetaVariables If set to true, all meta variable assignments are enumerated, even
* if a meta variable does not at all influence the the function value.
* @return An iterator that points past the end of the container.
*/
AddIterator<DdType::Sylvan, ValueType> end(std::shared_ptr<DdManager<DdType::Sylvan> const> fullDdManager, bool enumerateDontCareMetaVariables = true) const;
/*!
* Composes the ADD with an explicit vector by performing a specified function between the entries of this
* ADD and the explicit vector.
*
* @param odd The ODD to use for the translation from symbolic to explicit positions.
* @param ddVariableIndices The indices of the DD variables present in this ADD.
* @param targetVector The explicit vector that is to be composed with the ADD. The results are written to
* this vector again.
* @param function The function to perform in the composition.
*/
void composeWithExplicitVector(Odd const& odd, std::vector<uint_fast64_t> const& ddVariableIndices, std::vector<ValueType>& targetVector, std::function<ValueType (ValueType const&, ValueType const&)> const& function) const;
/*!
* Composes the (row-grouped) ADD with an explicit vector by performing a specified function between the
* entries of this ADD and the explicit vector.
*
* @param odd The ODD to use for the translation from symbolic to explicit positions.
* @param ddVariableIndices The indices of the DD variables present in this ADD.
* @param offsets The offsets
* @param targetVector The explicit vector that is to be composed with the ADD. The results are written to
* this vector again.
* @param function The function to perform in the composition.
*/
void composeWithExplicitVector(Odd const& odd, std::vector<uint_fast64_t> const& ddVariableIndices, std::vector<uint_fast64_t> const& offsets, std::vector<ValueType>& targetVector, std::function<ValueType (ValueType const&, ValueType const&)> const& function) const;
/*!
* Splits the ADD into several ADDs that differ in the encoding of the given group variables (given via indices).
*
* @param ddGroupVariableIndices The indices of the variables that are used to distinguish the groups.
* @return A vector of ADDs that are the separate groups (wrt. to the encoding of the given variables).
*/
std::vector<InternalAdd<DdType::Sylvan, ValueType>> splitIntoGroups(std::vector<uint_fast64_t> const& ddGroupVariableIndices) const;
/*!
* Simultaneously splits the ADD and the given vector ADD into several ADDs that differ in the encoding of
* the given group variables (given via indices).
*
* @param vector The vector to split (in addition to the current ADD).
* @param ddGroupVariableIndices The indices of the variables that are used to distinguish the groups.
* @return A vector of pairs of ADDs that are the separate groups of the current ADD and the vector,
* respectively (wrt. to the encoding of the given variables).
*/
std::vector<std::pair<InternalAdd<DdType::Sylvan, ValueType>, InternalAdd<DdType::Sylvan, ValueType>>> splitIntoGroups(InternalAdd<DdType::Sylvan, ValueType> vector, std::vector<uint_fast64_t> const& ddGroupVariableIndices) const;
/*!
* Translates the ADD into the components needed for constructing a matrix.
*
* @param rowGroupIndices The row group indices.
* @param rowIndications The vector that is to be filled with the row indications.
* @param columnsAndValues The vector that is to be filled with the non-zero entries of the matrix.
* @param rowOdd The ODD used for translating the rows.
* @param columnOdd The ODD used for translating the columns.
* @param ddRowVariableIndices The variable indices of the row variables.
* @param ddColumnVariableIndices The variable indices of the column variables.
* @param writeValues A flag that indicates whether or not to write to the entry vector. If this is not set,
* only the row indications are modified.
*/
void toMatrixComponents(std::vector<uint_fast64_t> const& rowGroupIndices, std::vector<uint_fast64_t>& rowIndications, std::vector<storm::storage::MatrixEntry<uint_fast64_t, ValueType>>& columnsAndValues, Odd const& rowOdd, Odd const& columnOdd, std::vector<uint_fast64_t> const& ddRowVariableIndices, std::vector<uint_fast64_t> const& ddColumnVariableIndices, bool writeValues) const;
/*!
* Creates an ADD from the given explicit vector.
*
* @param ddManager The manager to use to built the ADD.
* @param values The explicit vector to encode.
* @param odd The ODD to use for the translation.
* @param ddVariableIndices The indices of the variables to use in the ADD.
*/
static InternalAdd<DdType::Sylvan, ValueType> fromVector(InternalDdManager<DdType::Sylvan> const* ddManager, std::vector<ValueType> const& values, storm::dd::Odd const& odd, std::vector<uint_fast64_t> const& ddVariableIndices);
/*!
* Creates an ODD based on the current ADD.
*
* @return The corresponding ODD.
*/
Odd createOdd(std::vector<uint_fast64_t> const& ddVariableIndices) const;
private:
InternalDdManager<DdType::Sylvan> const* ddManager;
};
}
}
#endif /* STORM_STORAGE_DD_CUDD_INTERNALSYLVANADD_H_ */

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

@ -0,0 +1,150 @@
#include "src/storage/dd/sylvan/InternalSylvanBdd.h"
#include "src/storage/dd/sylvan/InternalSylvanAdd.h"
#include "src/storage/dd/sylvan/SylvanAddIterator.h"
#
#include "src/storage/BitVector.h"
#include "src/utility/macros.h"
#include "src/exceptions/NotImplementedException.h"
namespace storm {
namespace dd {
template<typename ValueType>
InternalBdd<DdType::Sylvan> InternalBdd<DdType::Sylvan>::fromVector(InternalDdManager<DdType::Sylvan> const* ddManager, std::vector<ValueType> const& values, Odd const& odd, std::vector<uint_fast64_t> const& sortedDdVariableIndices, std::function<bool (ValueType const&)> const& filter) {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
bool InternalBdd<DdType::Sylvan>::operator==(InternalBdd<DdType::Sylvan> const& other) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
bool InternalBdd<DdType::Sylvan>::operator!=(InternalBdd<DdType::Sylvan> const& other) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
InternalBdd<DdType::Sylvan> InternalBdd<DdType::Sylvan>::ite(InternalBdd<DdType::Sylvan> const& thenDd, InternalBdd<DdType::Sylvan> const& elseDd) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
InternalBdd<DdType::Sylvan> InternalBdd<DdType::Sylvan>::operator||(InternalBdd<DdType::Sylvan> const& other) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
InternalBdd<DdType::Sylvan>& InternalBdd<DdType::Sylvan>::operator|=(InternalBdd<DdType::Sylvan> const& other) {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
InternalBdd<DdType::Sylvan> InternalBdd<DdType::Sylvan>::operator&&(InternalBdd<DdType::Sylvan> const& other) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
InternalBdd<DdType::Sylvan>& InternalBdd<DdType::Sylvan>::operator&=(InternalBdd<DdType::Sylvan> const& other) {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
InternalBdd<DdType::Sylvan> InternalBdd<DdType::Sylvan>::iff(InternalBdd<DdType::Sylvan> const& other) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
InternalBdd<DdType::Sylvan> InternalBdd<DdType::Sylvan>::exclusiveOr(InternalBdd<DdType::Sylvan> const& other) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
InternalBdd<DdType::Sylvan> InternalBdd<DdType::Sylvan>::implies(InternalBdd<DdType::Sylvan> const& other) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
InternalBdd<DdType::Sylvan> InternalBdd<DdType::Sylvan>::operator!() const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
InternalBdd<DdType::Sylvan>& InternalBdd<DdType::Sylvan>::complement() {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
InternalBdd<DdType::Sylvan> InternalBdd<DdType::Sylvan>::existsAbstract(InternalBdd<DdType::Sylvan> const& cube) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
InternalBdd<DdType::Sylvan> InternalBdd<DdType::Sylvan>::universalAbstract(InternalBdd<DdType::Sylvan> const& cube) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
InternalBdd<DdType::Sylvan> InternalBdd<DdType::Sylvan>::andExists(InternalBdd<DdType::Sylvan> const& other, InternalBdd<DdType::Sylvan> const& cube) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
InternalBdd<DdType::Sylvan> InternalBdd<DdType::Sylvan>::constrain(InternalBdd<DdType::Sylvan> const& constraint) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
InternalBdd<DdType::Sylvan> InternalBdd<DdType::Sylvan>::restrict(InternalBdd<DdType::Sylvan> const& constraint) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
InternalBdd<DdType::Sylvan> InternalBdd<DdType::Sylvan>::swapVariables(std::vector<InternalBdd<DdType::Sylvan>> const& from, std::vector<InternalBdd<DdType::Sylvan>> const& to) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
InternalBdd<DdType::Sylvan> InternalBdd<DdType::Sylvan>::getSupport() const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
uint_fast64_t InternalBdd<DdType::Sylvan>::getNonZeroCount(uint_fast64_t numberOfDdVariables) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
uint_fast64_t InternalBdd<DdType::Sylvan>::getLeafCount() const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
uint_fast64_t InternalBdd<DdType::Sylvan>::getNodeCount() const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
bool InternalBdd<DdType::Sylvan>::isOne() const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
bool InternalBdd<DdType::Sylvan>::isZero() const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
uint_fast64_t InternalBdd<DdType::Sylvan>::getIndex() const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
void InternalBdd<DdType::Sylvan>::exportToDot(std::string const& filename, std::vector<std::string> const& ddVariableNamesAsStrings) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
InternalAdd<DdType::Sylvan, ValueType> InternalBdd<DdType::Sylvan>::toAdd() const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
storm::storage::BitVector InternalBdd<DdType::Sylvan>::toVector(storm::dd::Odd const& rowOdd, std::vector<uint_fast64_t> const& ddVariableIndices) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
Odd InternalBdd<DdType::Sylvan>::createOdd(std::vector<uint_fast64_t> const& ddVariableIndices) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
void InternalBdd<DdType::Sylvan>::filterExplicitVector(Odd const& odd, std::vector<uint_fast64_t> const& ddVariableIndices, std::vector<ValueType> const& sourceValues, std::vector<ValueType>& targetValues) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template InternalBdd<DdType::Sylvan> InternalBdd<DdType::Sylvan>::fromVector(InternalDdManager<DdType::Sylvan> const* ddManager, std::vector<double> const& values, Odd const& odd, std::vector<uint_fast64_t> const& sortedDdVariableIndices, std::function<bool (double const&)> const& filter);
template InternalBdd<DdType::Sylvan> InternalBdd<DdType::Sylvan>::fromVector(InternalDdManager<DdType::Sylvan> const* ddManager, std::vector<uint_fast64_t> const& values, Odd const& odd, std::vector<uint_fast64_t> const& sortedDdVariableIndices, std::function<bool (uint_fast64_t const&)> const& filter);
template InternalAdd<DdType::Sylvan, double> InternalBdd<DdType::Sylvan>::toAdd() const;
template InternalAdd<DdType::Sylvan, uint_fast64_t> InternalBdd<DdType::Sylvan>::toAdd() const;
template void InternalBdd<DdType::Sylvan>::filterExplicitVector(Odd const& odd, std::vector<uint_fast64_t> const& ddVariableIndices, std::vector<double> const& sourceValues, std::vector<double>& targetValues) const;
template void InternalBdd<DdType::Sylvan>::filterExplicitVector(Odd const& odd, std::vector<uint_fast64_t> const& ddVariableIndices, std::vector<uint_fast64_t> const& sourceValues, std::vector<uint_fast64_t>& targetValues) const;
}
}

301
src/storage/dd/sylvan/InternalSylvanBdd.h

@ -0,0 +1,301 @@
#ifndef STORM_STORAGE_DD_CUDD_INTERNALSYLVANBDD_H_
#define STORM_STORAGE_DD_CUDD_INTERNALSYLVANBDD_H_
#include <vector>
#include <functional>
#include "src/storage/dd/DdType.h"
#include "src/storage/dd/InternalBdd.h"
#include "src/storage/dd/InternalAdd.h"
namespace storm {
namespace storage {
class BitVector;
}
namespace dd {
template<DdType LibraryType>
class InternalDdManager;
template<DdType LibraryType, typename ValueType>
class InternalAdd;
class Odd;
template<>
class InternalBdd<DdType::Sylvan> {
public:
friend class InternalAdd<DdType::Sylvan, double>;
// Instantiate all copy/move constructors/assignments with the default implementation.
InternalBdd() = default;
InternalBdd(InternalBdd<DdType::Sylvan> const& other) = default;
InternalBdd& operator=(InternalBdd<DdType::Sylvan> const& other) = default;
InternalBdd(InternalBdd<DdType::Sylvan>&& other) = default;
InternalBdd& operator=(InternalBdd<DdType::Sylvan>&& other) = default;
/*!
* Builds a BDD representing the values that make the given filter function evaluate to true.
*
* @param ddManager The manager responsible for the BDD.
* @param values The values that are to be checked against the filter function.
* @param odd The ODD used for the translation.
* @param metaVariables The meta variables used for the translation.
* @param filter The filter that evaluates whether an encoding is to be mapped to 0 or 1.
* @return The resulting BDD.
*/
template<typename ValueType>
static InternalBdd<storm::dd::DdType::Sylvan> fromVector(InternalDdManager<DdType::Sylvan> const* ddManager, std::vector<ValueType> const& values, Odd const& odd, std::vector<uint_fast64_t> const& sortedDdVariableIndices, std::function<bool (ValueType const&)> const& filter);
/*!
* Retrieves whether the two BDDs represent the same function.
*
* @param other The BDD that is to be compared with the current one.
* @return True if the BDDs represent the same function.
*/
bool operator==(InternalBdd<DdType::Sylvan> const& other) const;
/*!
* Retrieves whether the two BDDs represent different functions.
*
* @param other The BDD that is to be compared with the current one.
* @return True if the BDDs represent the different functions.
*/
bool operator!=(InternalBdd<DdType::Sylvan> const& other) const;
/*!
* Performs an if-then-else with the given operands, i.e. maps all valuations that are mapped to a non-zero
* function value to the function values specified by the first DD and all others to the function values
* specified by the second DD.
*
* @param thenBdd The BDD defining the 'then' part.
* @param elseBdd The BDD defining the 'else' part.
* @return The resulting BDD.
*/
InternalBdd<DdType::Sylvan> ite(InternalBdd<DdType::Sylvan> const& thenBdd, InternalBdd<DdType::Sylvan> const& elseBdd) const;
/*!
* Performs a logical or of the current and the given BDD.
*
* @param other The second BDD used for the operation.
* @return The logical or of the operands.
*/
InternalBdd<DdType::Sylvan> operator||(InternalBdd<DdType::Sylvan> const& other) const;
/*!
* Performs a logical or of the current and the given BDD and assigns it to the current BDD.
*
* @param other The second BDD used for the operation.
* @return A reference to the current BDD after the operation
*/
InternalBdd<DdType::Sylvan>& operator|=(InternalBdd<DdType::Sylvan> const& other);
/*!
* Performs a logical and of the current and the given BDD.
*
* @param other The second BDD used for the operation.
* @return The logical and of the operands.
*/
InternalBdd<DdType::Sylvan> operator&&(InternalBdd<DdType::Sylvan> const& other) const;
/*!
* Performs a logical and of the current and the given BDD and assigns it to the current BDD.
*
* @param other The second BDD used for the operation.
* @return A reference to the current BDD after the operation
*/
InternalBdd<DdType::Sylvan>& operator&=(InternalBdd<DdType::Sylvan> const& other);
/*!
* Performs a logical iff of the current and the given BDD.
*
* @param other The second BDD used for the operation.
* @return The logical iff of the operands.
*/
InternalBdd<DdType::Sylvan> iff(InternalBdd<DdType::Sylvan> const& other) const;
/*!
* Performs a logical exclusive-or of the current and the given BDD.
*
* @param other The second BDD used for the operation.
* @return The logical exclusive-or of the operands.
*/
InternalBdd<DdType::Sylvan> exclusiveOr(InternalBdd<DdType::Sylvan> const& other) const;
/*!
* Performs a logical implication of the current and the given BDD.
*
* @param other The second BDD used for the operation.
* @return The logical implication of the operands.
*/
InternalBdd<DdType::Sylvan> implies(InternalBdd<DdType::Sylvan> const& other) const;
/*!
* Logically inverts the current BDD.
*
* @return The resulting BDD.
*/
InternalBdd<DdType::Sylvan> operator!() const;
/*!
* Logically complements the current BDD.
*
* @return A reference to the current BDD after the operation.
*/
InternalBdd<DdType::Sylvan>& complement();
/*!
* Existentially abstracts from the given cube.
*
* @param cube The cube from which to abstract.
*/
InternalBdd<DdType::Sylvan> existsAbstract(InternalBdd<DdType::Sylvan> const& cube) const;
/*!
* Universally abstracts from the given cube.
*
* @param cube The cube from which to abstract.
*/
InternalBdd<DdType::Sylvan> universalAbstract(InternalBdd<DdType::Sylvan> const& cube) const;
/*!
* Swaps the given pairs of DD variables in the BDD. The pairs of meta variables have to be represented by
* BDDs must have equal length.
*
* @param from The vector that specifies the 'from' part of the variable renaming.
* @param to The vector that specifies the 'to' part of the variable renaming.
* @return The resulting BDD.
*/
InternalBdd<DdType::Sylvan> swapVariables(std::vector<InternalBdd<DdType::Sylvan>> const& from, std::vector<InternalBdd<DdType::Sylvan>> const& to) const;
/*!
* Computes the logical and of the current and the given BDD and existentially abstracts from the given cube.
*
* @param other The second BDD for the logical and.
* @param cube The cube to existentially abstract.
* @return A BDD representing the result.
*/
InternalBdd<DdType::Sylvan> andExists(InternalBdd<DdType::Sylvan> const& other, InternalBdd<storm::dd::DdType::Sylvan> const& cube) const;
/*!
* Computes the constraint of the current BDD with the given constraint. That is, the function value of the
* resulting BDD will be the same as the current ones for all assignments mapping to one in the constraint
* and may be different otherwise.
*
* @param constraint The constraint to use for the operation.
* @return The resulting BDD.
*/
InternalBdd<DdType::Sylvan> constrain(InternalBdd<DdType::Sylvan> const& constraint) const;
/*!
* Computes the restriction of the current BDD with the given constraint. That is, the function value of the
* resulting DD will be the same as the current ones for all assignments mapping to one in the constraint
* and may be different otherwise.
*
* @param constraint The constraint to use for the operation.
* @return The resulting BDD.
*/
InternalBdd<DdType::Sylvan> restrict(InternalBdd<DdType::Sylvan> const& constraint) const;
/*!
* Retrieves the support of the current BDD.
*
* @return The support represented as a BDD.
*/
InternalBdd<DdType::Sylvan> getSupport() const;
/*!
* Retrieves the number of encodings that are mapped to a non-zero value.
*
* @param The number of DD variables contained in this BDD.
* @return The number of encodings that are mapped to a non-zero value.
*/
uint_fast64_t getNonZeroCount(uint_fast64_t numberOfDdVariables) const;
/*!
* Retrieves the number of leaves of the DD.
*
* @return The number of leaves of the DD.
*/
uint_fast64_t getLeafCount() const;
/*!
* Retrieves the number of nodes necessary to represent the DD.
*
* @return The number of nodes in this DD.
*/
uint_fast64_t getNodeCount() const;
/*!
* Retrieves whether this DD represents the constant one function.
*
* @return True if this DD represents the constant one function.
*/
bool isOne() const;
/*!
* Retrieves whether this DD represents the constant zero function.
*
* @return True if this DD represents the constant zero function.
*/
bool isZero() const;
/*!
* Retrieves the index of the topmost variable in the BDD.
*
* @return The index of the topmost variable in BDD.
*/
uint_fast64_t getIndex() const;
/*!
* Exports the BDD to the given file in the dot format.
*
* @param filename The name of the file to which the BDD is to be exported.
* @param ddVariableNamesAsStrings The names of the variables to display in the dot file.
*/
void exportToDot(std::string const& filename, std::vector<std::string> const& ddVariableNamesAsStrings) const;
/*!
* Converts a BDD to an equivalent ADD.
*
* @return The corresponding ADD.
*/
template<typename ValueType>
InternalAdd<DdType::Sylvan, ValueType> toAdd() const;
/*!
* Converts the BDD to a bit vector. The given offset-labeled DD is used to determine the correct row of
* each entry.
*
* @param rowOdd The ODD used for determining the correct row.
* @param ddVariableIndices The indices of the DD variables contained in this BDD.
* @return The bit vector that is represented by this BDD.
*/
storm::storage::BitVector toVector(storm::dd::Odd const& rowOdd, std::vector<uint_fast64_t> const& ddVariableIndices) const;
/*!
* Creates an ODD based on the current BDD.
*
* @param ddVariableIndices The indices of the DD variables contained in this BDD.
* @return The corresponding ODD.
*/
Odd createOdd(std::vector<uint_fast64_t> const& ddVariableIndices) const;
/*!
* Uses the current BDD to filter values from the explicit vector.
*
* @param odd The ODD used to determine which entries to select.
* @param ddVariableIndices The indices of the DD variables contained in this BDD.
* @param sourceValues The source vector.
* @param targetValues The vector to which to write the selected values.
*/
template<typename ValueType>
void filterExplicitVector(Odd const& odd, std::vector<uint_fast64_t> const& ddVariableIndices, std::vector<ValueType> const& sourceValues, std::vector<ValueType>& targetValues) const;
private:
InternalDdManager<DdType::Sylvan> const* ddManager;
};
}
}
#endif /* STORM_STORAGE_DD_CUDD_INTERNALSYLVANBDD_H_ */

61
src/storage/dd/sylvan/InternalSylvanDdManager.cpp

@ -0,0 +1,61 @@
#include "src/storage/dd/sylvan/InternalSylvanDdManager.h"
#include "src/utility/macros.h"
#include "src/exceptions/NotImplementedException.h"
namespace storm {
namespace dd {
InternalDdManager<DdType::Sylvan>::InternalDdManager() {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
InternalBdd<DdType::Sylvan> InternalDdManager<DdType::Sylvan>::getBddOne() const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
InternalAdd<DdType::Sylvan, ValueType> InternalDdManager<DdType::Sylvan>::getAddOne() const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
InternalBdd<DdType::Sylvan> InternalDdManager<DdType::Sylvan>::getBddZero() const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
InternalAdd<DdType::Sylvan, ValueType> InternalDdManager<DdType::Sylvan>::getAddZero() const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
InternalAdd<DdType::Sylvan, ValueType> InternalDdManager<DdType::Sylvan>::getConstant(ValueType const& value) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
std::pair<InternalBdd<DdType::Sylvan>, InternalBdd<DdType::Sylvan>> InternalDdManager<DdType::Sylvan>::createNewDdVariablePair() {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
void InternalDdManager<DdType::Sylvan>::allowDynamicReordering(bool value) {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
bool InternalDdManager<DdType::Sylvan>::isDynamicReorderingAllowed() const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
void InternalDdManager<DdType::Sylvan>::triggerReordering() {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template InternalAdd<DdType::Sylvan, double> InternalDdManager<DdType::Sylvan>::getAddOne() const;
template InternalAdd<DdType::Sylvan, uint_fast64_t> InternalDdManager<DdType::Sylvan>::getAddOne() const;
template InternalAdd<DdType::Sylvan, double> InternalDdManager<DdType::Sylvan>::getAddZero() const;
template InternalAdd<DdType::Sylvan, uint_fast64_t> InternalDdManager<DdType::Sylvan>::getAddZero() const;
template InternalAdd<DdType::Sylvan, double> InternalDdManager<DdType::Sylvan>::getConstant(double const& value) const;
template InternalAdd<DdType::Sylvan, uint_fast64_t> InternalDdManager<DdType::Sylvan>::getConstant(uint_fast64_t const& value) const;
}
}

101
src/storage/dd/sylvan/InternalSylvanDdManager.h

@ -0,0 +1,101 @@
#ifndef STORM_STORAGE_DD_INTERNALSYLVANDDMANAGER_H_
#define STORM_STORAGE_DD_INTERNALSYLVANDDMANAGER_H_
#include "src/storage/dd/DdType.h"
#include "src/storage/dd/InternalDdManager.h"
#include "src/storage/dd/sylvan/InternalSylvanBdd.h"
#include "src/storage/dd/sylvan/InternalSylvanAdd.h"
namespace storm {
namespace dd {
template<DdType LibraryType, typename ValueType>
class InternalAdd;
template<DdType LibraryType>
class InternalBdd;
template<>
class InternalDdManager<DdType::Sylvan> {
public:
friend class InternalBdd<DdType::Sylvan>;
template<DdType LibraryType, typename ValueType>
friend class InternalAdd;
/*!
* Creates a new internal manager for CUDD DDs.
*/
InternalDdManager();
/*!
* Retrieves a BDD representing the constant one function.
*
* @return A BDD representing the constant one function.
*/
InternalBdd<DdType::Sylvan> getBddOne() const;
/*!
* Retrieves an ADD representing the constant one function.
*
* @return An ADD representing the constant one function.
*/
template<typename ValueType>
InternalAdd<DdType::Sylvan, ValueType> getAddOne() const;
/*!
* Retrieves a BDD representing the constant zero function.
*
* @return A BDD representing the constant zero function.
*/
InternalBdd<DdType::Sylvan> getBddZero() const;
/*!
* Retrieves an ADD representing the constant zero function.
*
* @return An ADD representing the constant zero function.
*/
template<typename ValueType>
InternalAdd<DdType::Sylvan, ValueType> getAddZero() const;
/*!
* Retrieves an ADD representing the constant function with the given value.
*
* @return An ADD representing the constant function with the given value.
*/
template<typename ValueType>
InternalAdd<DdType::Sylvan, ValueType> getConstant(ValueType const& value) const;
/*!
* Creates a new pair of DD variables and returns the two cubes as a result.
*
* @return The two cubes belonging to the DD variables.
*/
std::pair<InternalBdd<DdType::Sylvan>, InternalBdd<DdType::Sylvan>> createNewDdVariablePair();
/*!
* Sets whether or not dynamic reordering is allowed for the DDs managed by this manager.
*
* @param value If set to true, dynamic reordering is allowed and forbidden otherwise.
*/
void allowDynamicReordering(bool value);
/*!
* Retrieves whether dynamic reordering is currently allowed.
*
* @return True iff dynamic reordering is currently allowed.
*/
bool isDynamicReorderingAllowed() const;
/*!
* Triggers a reordering of the DDs managed by this manager.
*/
void triggerReordering();
private:
};
}
}
#endif /* STORM_STORAGE_DD_INTERNALSYLVANDDMANAGER_H_ */

36
src/storage/dd/sylvan/SylvanAddIterator.cpp

@ -0,0 +1,36 @@
#include "src/storage/dd/sylvan/SylvanAddIterator.h"
#include "src/utility/macros.h"
#include "src/exceptions/NotImplementedException.h"
namespace storm {
namespace dd {
template<typename ValueType>
AddIterator<DdType::Sylvan, ValueType>::AddIterator() {
// Intentionally left empty.
}
template<typename ValueType>
AddIterator<DdType::Sylvan, ValueType>& AddIterator<DdType::Sylvan, ValueType>::operator++() {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
bool AddIterator<DdType::Sylvan, ValueType>::operator==(AddIterator<DdType::Sylvan, ValueType> const& other) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
bool AddIterator<DdType::Sylvan, ValueType>::operator!=(AddIterator<DdType::Sylvan, ValueType> const& other) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template<typename ValueType>
std::pair<storm::expressions::SimpleValuation, ValueType> AddIterator<DdType::Sylvan, ValueType>::operator*() const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented.");
}
template class AddIterator<DdType::Sylvan, double>;
template class AddIterator<DdType::Sylvan, uint_fast64_t>;
}
}

69
src/storage/dd/sylvan/SylvanAddIterator.h

@ -0,0 +1,69 @@
#ifndef STORM_STORAGE_DD_SYLVANADDITERATOR_H_
#define STORM_STORAGE_DD_SYLVANADDITERATOR_H_
#include "src/storage/dd/AddIterator.h"
#include "src/storage/expressions/SimpleValuation.h"
namespace storm {
namespace dd {
// Forward-declare the DdManager class.
template<DdType Type>
class DdManager;
template<DdType Type, typename ValueType>
class InternalAdd;
template<typename ValueType>
class AddIterator<DdType::Sylvan, ValueType> {
public:
friend class InternalAdd<DdType::Sylvan, ValueType>;
// Default-instantiate the constructor.
AddIterator();
// Forbid copy-construction and copy assignment, because ownership of the internal pointer is unclear then.
AddIterator(AddIterator<DdType::Sylvan, ValueType> const& other) = delete;
AddIterator& operator=(AddIterator<DdType::Sylvan, ValueType> const& other) = delete;
// Provide move-construction and move-assignment, though.
AddIterator(AddIterator<DdType::Sylvan, ValueType>&& other) = default;
AddIterator& operator=(AddIterator<DdType::Sylvan, ValueType>&& other) = default;
/*!
* Moves the iterator one position forward.
*/
AddIterator<DdType::Sylvan, ValueType>& operator++();
/*!
* Returns a pair consisting of a valuation of meta variables and the value to which this valuation is
* mapped. Note that the result is returned by value.
*
* @return A pair of a valuation and the function value.
*/
std::pair<storm::expressions::SimpleValuation, ValueType> operator*() const;
/*!
* Compares the iterator with the given one. Two iterators are considered equal when all their underlying
* data members are the same or they both are at their end.
*
* @param other The iterator with which to compare.
* @return True if the two iterators are considered equal.
*/
bool operator==(AddIterator<DdType::Sylvan, ValueType> const& other) const;
/*!
* Compares the iterator with the given one. Two iterators are considered unequal iff they are not
* considered equal.
*
* @param other The iterator with which to compare.
* @return True if the two iterators are considered unequal.
*/
bool operator!=(AddIterator<DdType::Sylvan, ValueType> const& other) const;
private:
};
}
}
#endif /* STORM_STORAGE_DD_SYLVANADDITERATOR_H_ */
Loading…
Cancel
Save