dehnert
7 years ago
19 changed files with 674 additions and 155 deletions
-
4resources/3rdparty/sylvan/src/sylvan_mtbdd_storm.h
-
2resources/3rdparty/sylvan/src/sylvan_storm_rational_function.h
-
18resources/3rdparty/sylvan/src/sylvan_storm_rational_number.c
-
14resources/3rdparty/sylvan/src/sylvan_storm_rational_number.h
-
10src/storm/modelchecker/prctl/helper/SymbolicDtmcPrctlHelper.cpp
-
4src/storm/modelchecker/prctl/helper/SymbolicMdpPrctlHelper.cpp
-
6src/storm/modelchecker/results/SymbolicQuantitativeCheckResult.cpp
-
117src/storm/solver/SymbolicEliminationLinearEquationSolver.cpp
-
15src/storm/solver/SymbolicEliminationLinearEquationSolver.h
-
94src/storm/solver/SymbolicEquationSolver.cpp
-
54src/storm/solver/SymbolicEquationSolver.h
-
83src/storm/solver/SymbolicLinearEquationSolver.cpp
-
48src/storm/solver/SymbolicLinearEquationSolver.h
-
35src/storm/solver/SymbolicMinMaxLinearEquationSolver.cpp
-
12src/storm/solver/SymbolicMinMaxLinearEquationSolver.h
-
238src/storm/solver/SymbolicNativeLinearEquationSolver.cpp
-
64src/storm/solver/SymbolicNativeLinearEquationSolver.h
-
6src/storm/storage/dd/bisimulation/QuotientExtractor.cpp
-
5src/storm/utility/constants.cpp
@ -0,0 +1,94 @@ |
|||
#include "storm/solver/SymbolicEquationSolver.h"
|
|||
|
|||
#include "storm/adapters/RationalNumberAdapter.h"
|
|||
#include "storm/adapters/RationalFunctionAdapter.h"
|
|||
|
|||
#include "storm/utility/macros.h"
|
|||
#include "storm/exceptions/UnmetRequirementException.h"
|
|||
|
|||
namespace storm { |
|||
namespace solver { |
|||
|
|||
template<storm::dd::DdType DdType, typename ValueType> |
|||
SymbolicEquationSolver<DdType, ValueType>::SymbolicEquationSolver(storm::dd::Bdd<DdType> const& allRows) : allRows(allRows) { |
|||
// Intentionally left empty.
|
|||
} |
|||
|
|||
template<storm::dd::DdType DdType, typename ValueType> |
|||
storm::dd::DdManager<DdType>& SymbolicEquationSolver<DdType, ValueType>::getDdManager() const { |
|||
return this->allRows.getDdManager(); |
|||
} |
|||
|
|||
template<storm::dd::DdType DdType, typename ValueType> |
|||
void SymbolicEquationSolver<DdType, ValueType>::setAllRows(storm::dd::Bdd<DdType> const& allRows) { |
|||
this->allRows = allRows; |
|||
} |
|||
|
|||
template<storm::dd::DdType DdType, typename ValueType> |
|||
storm::dd::Bdd<DdType> const& SymbolicEquationSolver<DdType, ValueType>::getAllRows() const { |
|||
return this->allRows; |
|||
} |
|||
|
|||
template<storm::dd::DdType DdType, typename ValueType> |
|||
void SymbolicEquationSolver<DdType, ValueType>::setLowerBounds(storm::dd::Add<DdType, ValueType> const& lowerBounds) { |
|||
this->lowerBounds = lowerBounds; |
|||
} |
|||
|
|||
template<storm::dd::DdType DdType, typename ValueType> |
|||
void SymbolicEquationSolver<DdType, ValueType>::setLowerBound(ValueType const& lowerBound) { |
|||
this->lowerBound = lowerBound; |
|||
} |
|||
|
|||
template<storm::dd::DdType DdType, typename ValueType> |
|||
void SymbolicEquationSolver<DdType, ValueType>::setUpperBounds(storm::dd::Add<DdType, ValueType> const& upperBounds) { |
|||
this->upperBounds = upperBounds; |
|||
} |
|||
|
|||
template<storm::dd::DdType DdType, typename ValueType> |
|||
void SymbolicEquationSolver<DdType, ValueType>::setUpperBound(ValueType const& upperBound) { |
|||
this->upperBound = upperBound; |
|||
} |
|||
|
|||
template<storm::dd::DdType DdType, typename ValueType> |
|||
void SymbolicEquationSolver<DdType, ValueType>::setBounds(ValueType const& lowerBound, ValueType const& upperBound) { |
|||
setLowerBound(lowerBound); |
|||
setUpperBound(upperBound); |
|||
} |
|||
|
|||
template<storm::dd::DdType DdType, typename ValueType> |
|||
void SymbolicEquationSolver<DdType, ValueType>::setBounds(storm::dd::Add<DdType, ValueType> const& lowerBounds, storm::dd::Add<DdType, ValueType> const& upperBounds) { |
|||
setLowerBounds(lowerBounds); |
|||
setUpperBounds(upperBounds); |
|||
} |
|||
|
|||
template<storm::dd::DdType DdType, typename ValueType> |
|||
storm::dd::Add<DdType, ValueType> SymbolicEquationSolver<DdType, ValueType>::getLowerBounds() const { |
|||
STORM_LOG_THROW(lowerBound || lowerBounds, storm::exceptions::UnmetRequirementException, "Requiring lower bounds, but did not get any."); |
|||
if (lowerBounds) { |
|||
return lowerBounds.get(); |
|||
} else { |
|||
return this->allRows.ite(this->allRows.getDdManager().getConstant(lowerBound.get()), this->allRows.getDdManager().template getAddZero<ValueType>()); |
|||
} |
|||
} |
|||
|
|||
template<storm::dd::DdType DdType, typename ValueType> |
|||
storm::dd::Add<DdType, ValueType> SymbolicEquationSolver<DdType, ValueType>::getUpperBounds() const { |
|||
STORM_LOG_THROW(upperBound || upperBounds, storm::exceptions::UnmetRequirementException, "Requiring upper bounds, but did not get any."); |
|||
if (upperBounds) { |
|||
return upperBounds.get(); |
|||
} else { |
|||
return this->allRows.ite(this->allRows.getDdManager().getConstant(upperBound.get()), this->allRows.getDdManager().template getAddZero<ValueType>()); |
|||
} |
|||
} |
|||
|
|||
template class SymbolicEquationSolver<storm::dd::DdType::CUDD, double>; |
|||
template class SymbolicEquationSolver<storm::dd::DdType::Sylvan, double>; |
|||
|
|||
#ifdef STORM_HAVE_CARL
|
|||
template class SymbolicEquationSolver<storm::dd::DdType::CUDD, storm::RationalNumber>; |
|||
template class SymbolicEquationSolver<storm::dd::DdType::Sylvan, storm::RationalNumber>; |
|||
|
|||
template class SymbolicEquationSolver<storm::dd::DdType::Sylvan, storm::RationalFunction>; |
|||
#endif
|
|||
} |
|||
} |
@ -0,0 +1,54 @@ |
|||
#pragma once |
|||
|
|||
#include "storm/storage/dd/DdType.h" |
|||
|
|||
#include "storm/storage/dd/DdManager.h" |
|||
#include "storm/storage/dd/Bdd.h" |
|||
|
|||
namespace storm { |
|||
namespace solver { |
|||
|
|||
template<storm::dd::DdType DdType, typename ValueType = double> |
|||
class SymbolicEquationSolver { |
|||
public: |
|||
SymbolicEquationSolver() = default; |
|||
SymbolicEquationSolver(storm::dd::Bdd<DdType> const& allRows); |
|||
|
|||
void setLowerBounds(storm::dd::Add<DdType, ValueType> const& lowerBounds); |
|||
void setLowerBound(ValueType const& lowerBound); |
|||
void setUpperBounds(storm::dd::Add<DdType, ValueType> const& upperBounds); |
|||
void setUpperBound(ValueType const& lowerBound); |
|||
void setBounds(ValueType const& lowerBound, ValueType const& upperBound); |
|||
void setBounds(storm::dd::Add<DdType, ValueType> const& lowerBounds, storm::dd::Add<DdType, ValueType> const& upperBounds); |
|||
|
|||
/*! |
|||
* Retrieves a vector of lower bounds for all values (if any lower bounds are known). |
|||
*/ |
|||
storm::dd::Add<DdType, ValueType> getLowerBounds() const; |
|||
|
|||
/*! |
|||
* Retrieves a vector of upper bounds for all values (if any lower bounds are known). |
|||
*/ |
|||
storm::dd::Add<DdType, ValueType> getUpperBounds() const; |
|||
|
|||
protected: |
|||
storm::dd::DdManager<DdType>& getDdManager() const; |
|||
|
|||
void setAllRows(storm::dd::Bdd<DdType> const& allRows); |
|||
storm::dd::Bdd<DdType> const& getAllRows() const; |
|||
|
|||
// The relevant rows to this equation solver. |
|||
storm::dd::Bdd<DdType> allRows; |
|||
|
|||
private: |
|||
// Lower bounds (if given). |
|||
boost::optional<storm::dd::Add<DdType, ValueType>> lowerBounds; |
|||
boost::optional<ValueType> lowerBound; |
|||
|
|||
// Upper bounds (if given). |
|||
boost::optional<storm::dd::Add<DdType, ValueType>> upperBounds; |
|||
boost::optional<ValueType> upperBound; |
|||
}; |
|||
|
|||
} |
|||
} |
Reference in new issue
xxxxxxxxxx