Browse Source

Quick fix for CTMC instantiation

tempestpy_adaptions
Matthias Volk 8 years ago
parent
commit
a18161b6e3
  1. 5
      src/storm/models/sparse/Ctmc.cpp
  2. 7
      src/storm/models/sparse/Ctmc.h
  3. 17
      src/storm/utility/ModelInstantiator.h

5
src/storm/models/sparse/Ctmc.cpp

@ -36,6 +36,11 @@ namespace storm {
return exitRates;
}
template <typename ValueType, typename RewardModelType>
std::vector<ValueType>& Ctmc<ValueType, RewardModelType>::getExitRateVector() {
return exitRates;
}
template <typename ValueType, typename RewardModelType>
std::vector<ValueType> Ctmc<ValueType, RewardModelType>::createExitRateVector(storm::storage::SparseMatrix<ValueType> const& rateMatrix) {
std::vector<ValueType> exitRates(rateMatrix.getRowCount());

7
src/storm/models/sparse/Ctmc.h

@ -66,6 +66,13 @@ namespace storm {
*/
std::vector<ValueType> const& getExitRateVector() const;
/*!
* Retrieves the vector of exit rates of the model.
*
* @return The exit rate vector.
*/
std::vector<ValueType>& getExitRateVector();
private:
/*!
* Computes the exit rate vector based on the given rate matrix.

17
src/storm/utility/ModelInstantiator.h

@ -67,8 +67,7 @@ namespace storm {
template<typename PMT = ParametricSparseModelType>
typename std::enable_if<
std::is_same<PMT,storm::models::sparse::Dtmc<typename ParametricSparseModelType::ValueType>>::value ||
std::is_same<PMT,storm::models::sparse::Mdp<typename ParametricSparseModelType::ValueType>>::value ||
std::is_same<PMT,storm::models::sparse::Ctmc<typename ParametricSparseModelType::ValueType>>::value
std::is_same<PMT,storm::models::sparse::Mdp<typename ParametricSparseModelType::ValueType>>::value
>::type
initializeModelSpecificData(PMT const& parametricModel) {
auto stateLabelingCopy = parametricModel.getStateLabeling();
@ -76,6 +75,20 @@ namespace storm {
this->instantiatedModel = std::make_shared<ConstantSparseModelType>(buildDummyMatrix(parametricModel.getTransitionMatrix()), std::move(stateLabelingCopy), buildDummyRewardModels(parametricModel.getRewardModels()), std::move(choiceLabelingCopy));
}
template<typename PMT = ParametricSparseModelType>
typename std::enable_if<
std::is_same<PMT,storm::models::sparse::Ctmc<typename ParametricSparseModelType::ValueType>>::value
>::type
initializeModelSpecificData(PMT const& parametricModel) {
auto stateLabelingCopy = parametricModel.getStateLabeling();
auto choiceLabelingCopy = parametricModel.getOptionalChoiceLabeling();
std::vector<ConstantType> exitRates(parametricModel.getExitRateVector().size(), storm::utility::one<ConstantType>());
this->instantiatedModel = std::make_shared<ConstantSparseModelType>(buildDummyMatrix(parametricModel.getTransitionMatrix()), std::move(exitRates), std::move(stateLabelingCopy), buildDummyRewardModels(parametricModel.getRewardModels()), std::move(choiceLabelingCopy));
initializeVectorMapping(this->instantiatedModel->getExitRateVector(), this->functions, this->vectorMapping, parametricModel.getExitRateVector());
}
template<typename PMT = ParametricSparseModelType>
typename std::enable_if<
std::is_same<PMT,storm::models::sparse::MarkovAutomaton<typename ParametricSparseModelType::ValueType>>::value

Loading…
Cancel
Save