Browse Source

Ctmc: added a method that returns the probabilistic transition matrix.

tempestpy_adaptions
Tim Quatmann 4 years ago
parent
commit
462ce5dce3
  1. 12
      src/storm/models/sparse/Ctmc.cpp
  2. 6
      src/storm/models/sparse/Ctmc.h

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

@ -79,6 +79,18 @@ namespace storm {
}
}
template<typename ValueType, typename RewardModelType>
storm::storage::SparseMatrix<ValueType> Ctmc<ValueType, RewardModelType>::computeProbabilityMatrix() const {
// Turn the rates into probabilities by scaling each row with the exit rate of the state.
storm::storage::SparseMatrix<ValueType> result(this->getTransitionMatrix());
for (uint_fast64_t row = 0; row < result.getRowCount(); ++row) {
for (auto& entry : result.getRow(row)) {
entry.setValue(entry.getValue() / exitRates[row]);
}
}
return result;
}
template class Ctmc<double>;
#ifdef STORM_HAVE_CARL

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

@ -64,6 +64,12 @@ namespace storm {
virtual void reduceToStateBasedRewards() override;
/*!
* @return the probabilistic transition matrix P
* @note getTransitionMatrix() retrieves the exit rate matrix R, where R(s,s') = r(s) * P(s,s')
*/
storm::storage::SparseMatrix<ValueType> computeProbabilityMatrix() const;
private:
/*!
* Computes the exit rate vector based on the given rate matrix.

Loading…
Cancel
Save