Browse Source

Added hasParameters() and supportsParameters() for symbolic models

tempestpy_adaptions
Matthias Volk 7 years ago
parent
commit
2ba70e964c
  1. 4
      src/storm/models/sparse/Model.cpp
  2. 21
      src/storm/models/symbolic/Model.cpp
  3. 10
      src/storm/models/symbolic/Model.h

4
src/storm/models/sparse/Model.cpp

@ -423,11 +423,7 @@ namespace storm {
template<typename ValueType, typename RewardModelType>
bool Model<ValueType, RewardModelType>::supportsParameters() const {
#ifdef STORM_HAVE_CARL
return std::is_same<ValueType, storm::RationalFunction>::value;
#else
return false;
#endif
}
template<typename ValueType, typename RewardModelType>

21
src/storm/models/symbolic/Model.cpp

@ -15,6 +15,7 @@
#include "storm/models/symbolic/StandardRewardModel.h"
#include "storm/utility/constants.h"
#include "storm/utility/macros.h"
#include "storm/utility/dd.h"
@ -362,6 +363,26 @@ namespace storm {
bool Model<Type, ValueType>::isSymbolicModel() const {
return true;
}
template<storm::dd::DdType Type, typename ValueType>
bool Model<Type, ValueType>::supportsParameters() const {
return std::is_same<ValueType, storm::RationalFunction>::value;
}
template<storm::dd::DdType Type, typename ValueType>
bool Model<Type, ValueType>::hasParameters() const {
if (!this->supportsParameters()) {
return false;
}
// Check for parameters
for (auto it = this->getTransitionMatrix().begin(false); it != this->getTransitionMatrix().end(); ++it) {
if (!storm::utility::isConstant((*it).second)) {
return true;
}
}
// Only constant values present
return false;
}
template<storm::dd::DdType Type, typename ValueType>
void Model<Type, ValueType>::addParameters(std::set<storm::RationalFunctionVariable> const& parameters) {

10
src/storm/models/symbolic/Model.h

@ -321,6 +321,16 @@ namespace storm {
virtual bool isSymbolicModel() const override;
virtual bool supportsParameters() const override;
/*!
* Checks whether the model has parameters.
* Performance warning: the worst-case complexity is linear in the number of transitions.
*
* @return True iff the model has parameters.
*/
virtual bool hasParameters() const override;
std::vector<std::string> getLabels() const;
void addParameters(std::set<storm::RationalFunctionVariable> const& parameters);

Loading…
Cancel
Save