|
|
@ -1,18 +1,25 @@ |
|
|
|
#include "src/storage/dd/sylvan/InternalSylvanAdd.h"
|
|
|
|
|
|
|
|
#include "src/storage/dd/sylvan/InternalSylvanDdManager.h"
|
|
|
|
|
|
|
|
#include "src/utility/macros.h"
|
|
|
|
#include "src/exceptions/NotImplementedException.h"
|
|
|
|
|
|
|
|
namespace storm { |
|
|
|
namespace dd { |
|
|
|
template<typename ValueType> |
|
|
|
InternalAdd<DdType::Sylvan, ValueType>::InternalAdd(InternalDdManager<DdType::Sylvan> const* ddManager, sylvan::Mtbdd const& sylvanMtbdd) : ddManager(ddManager), sylvanMtbdd(sylvanMtbdd) { |
|
|
|
// Intentionally left empty.
|
|
|
|
} |
|
|
|
|
|
|
|
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."); |
|
|
|
return this->sylvanMtbdd == other.sylvanMtbdd; |
|
|
|
} |
|
|
|
|
|
|
|
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."); |
|
|
|
return this->sylvanMtbdd != other.sylvanMtbdd; |
|
|
|
} |
|
|
|
|
|
|
|
template<typename ValueType> |
|
|
@ -33,37 +40,39 @@ namespace storm { |
|
|
|
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."); |
|
|
|
return InternalAdd<DdType::Sylvan, ValueType>(ddManager, this->sylvanMtbdd.Plus(other.sylvanMtbdd)); |
|
|
|
} |
|
|
|
|
|
|
|
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."); |
|
|
|
this->sylvanMtbdd = this->sylvanMtbdd.Plus(other.sylvanMtbdd); |
|
|
|
return *this; |
|
|
|
} |
|
|
|
|
|
|
|
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."); |
|
|
|
return InternalAdd<DdType::Sylvan, ValueType>(ddManager, this->sylvanMtbdd.Times(other.sylvanMtbdd)); |
|
|
|
} |
|
|
|
|
|
|
|
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."); |
|
|
|
this->sylvanMtbdd = this->sylvanMtbdd.Times(other.sylvanMtbdd); |
|
|
|
return *this; |
|
|
|
} |
|
|
|
|
|
|
|
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."); |
|
|
|
return InternalAdd<DdType::Sylvan, ValueType>(ddManager, this->sylvanMtbdd.Minus(other.sylvanMtbdd)); |
|
|
|
} |
|
|
|
|
|
|
|
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."); |
|
|
|
this->sylvanMtbdd = this->sylvanMtbdd.Plus(other.sylvanMtbdd.Negate()); |
|
|
|
return *this; |
|
|
|
} |
|
|
|
|
|
|
|
template<typename ValueType> |
|
|
@ -133,27 +142,27 @@ namespace storm { |
|
|
|
|
|
|
|
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."); |
|
|
|
return InternalAdd<DdType::Sylvan, ValueType>(ddManager, this->sylvanMtbdd.Min(other.sylvanMtbdd)); |
|
|
|
} |
|
|
|
|
|
|
|
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."); |
|
|
|
return InternalAdd<DdType::Sylvan, ValueType>(ddManager, this->sylvanMtbdd.Max(other.sylvanMtbdd)); |
|
|
|
} |
|
|
|
|
|
|
|
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."); |
|
|
|
return InternalAdd<DdType::Sylvan, ValueType>(ddManager, this->sylvanMtbdd.AbstractPlus(static_cast<MTBDD>(cube.sylvanBdd.GetBDD()))); |
|
|
|
} |
|
|
|
|
|
|
|
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."); |
|
|
|
return InternalAdd<DdType::Sylvan, ValueType>(ddManager, this->sylvanMtbdd.AbstractMin(static_cast<MTBDD>(cube.sylvanBdd.GetBDD()))); |
|
|
|
} |
|
|
|
|
|
|
|
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."); |
|
|
|
return InternalAdd<DdType::Sylvan, ValueType>(ddManager, this->sylvanMtbdd.AbstractMax(static_cast<MTBDD>(cube.sylvanBdd.GetBDD()))); |
|
|
|
} |
|
|
|
|
|
|
|
template<typename ValueType> |
|
|
@ -168,27 +177,31 @@ namespace storm { |
|
|
|
|
|
|
|
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."); |
|
|
|
sylvan::Mtbdd summationVariables = sylvan::Mtbdd::mtbddOne(); |
|
|
|
for (auto const& ddVariable : summationDdVariables) { |
|
|
|
summationVariables *= ddVariable.sylvanMtbdd; |
|
|
|
} |
|
|
|
return InternalAdd<DdType::Sylvan, ValueType>(ddManager, this->sylvanMtbdd.AndExists(otherMatrix.sylvanMtbdd, summationVariables)); |
|
|
|
} |
|
|
|
|
|
|
|
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."); |
|
|
|
return InternalBdd<DdType::Sylvan>(ddManager, this->sylvanMtbdd.BddStrictThreshold(value)); |
|
|
|
} |
|
|
|
|
|
|
|
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."); |
|
|
|
return InternalBdd<DdType::Sylvan>(ddManager, this->sylvanMtbdd.BddThreshold(value)); |
|
|
|
} |
|
|
|
|
|
|
|
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."); |
|
|
|
return !this->greaterOrEqual(value); |
|
|
|
} |
|
|
|
|
|
|
|
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."); |
|
|
|
return !this->greater(value); |
|
|
|
} |
|
|
|
|
|
|
|
template<typename ValueType> |
|
|
@ -208,12 +221,12 @@ namespace storm { |
|
|
|
|
|
|
|
template<typename ValueType> |
|
|
|
InternalBdd<DdType::Sylvan> InternalAdd<DdType::Sylvan, ValueType>::getSupport() const { |
|
|
|
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented."); |
|
|
|
return InternalBdd<DdType::Sylvan>(ddManager, sylvan::Bdd(static_cast<BDD>(this->sylvanMtbdd.Support().GetMTBDD()))); |
|
|
|
} |
|
|
|
|
|
|
|
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."); |
|
|
|
uint_fast64_t InternalAdd<DdType::Sylvan, ValueType>::getNonZeroCount(InternalBdd<DdType::Sylvan> const& cube, uint_fast64_t numberOfDdVariables) const { |
|
|
|
return static_cast<uint_fast64_t>(this->sylvanMtbdd.SatCount(cube.sylvanBdd)); |
|
|
|
} |
|
|
|
|
|
|
|
template<typename ValueType> |
|
|
@ -223,7 +236,7 @@ namespace storm { |
|
|
|
|
|
|
|
template<typename ValueType> |
|
|
|
uint_fast64_t InternalAdd<DdType::Sylvan, ValueType>::getNodeCount() const { |
|
|
|
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented."); |
|
|
|
return static_cast<uint_fast64_t>(this->sylvanMtbdd.NodeCount()) + this->getLeafCount(); |
|
|
|
} |
|
|
|
|
|
|
|
template<typename ValueType> |
|
|
@ -243,27 +256,30 @@ namespace storm { |
|
|
|
|
|
|
|
template<typename ValueType> |
|
|
|
bool InternalAdd<DdType::Sylvan, ValueType>::isOne() const { |
|
|
|
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented."); |
|
|
|
return *this == ddManager->getAddOne<ValueType>(); |
|
|
|
} |
|
|
|
|
|
|
|
template<typename ValueType> |
|
|
|
bool InternalAdd<DdType::Sylvan, ValueType>::isZero() const { |
|
|
|
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented."); |
|
|
|
return *this == ddManager->getAddZero<ValueType>(); |
|
|
|
} |
|
|
|
|
|
|
|
template<typename ValueType> |
|
|
|
bool InternalAdd<DdType::Sylvan, ValueType>::isConstant() const { |
|
|
|
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented."); |
|
|
|
return this->sylvanMtbdd.isTerminal(); |
|
|
|
} |
|
|
|
|
|
|
|
template<typename ValueType> |
|
|
|
uint_fast64_t InternalAdd<DdType::Sylvan, ValueType>::getIndex() const { |
|
|
|
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Not yet implemented."); |
|
|
|
return static_cast<uint_fast64_t>(this->sylvanMtbdd.TopVar()); |
|
|
|
} |
|
|
|
|
|
|
|
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."); |
|
|
|
// Open the file, dump the DD and close it again.
|
|
|
|
FILE* filePointer = fopen(filename.c_str() , "w"); |
|
|
|
mtbdd_fprintdot(filePointer, this->sylvanMtbdd.GetMTBDD(), nullptr); |
|
|
|
fclose(filePointer); |
|
|
|
} |
|
|
|
|
|
|
|
template<typename ValueType> |
|
|
|