13template<
typename ValueType,
typename RewardModelType>
15 std::unordered_map<std::string, RewardModelType>
const& rewardModels)
20template<
typename ValueType,
typename RewardModelType>
22 std::unordered_map<std::string, RewardModelType>&& rewardModels)
28template<
typename ValueType,
typename RewardModelType>
32 exitRates = components.exitRates.get();
34 STORM_LOG_ASSERT(components.rateTransitions,
"No rate information given for CTMC.");
35 exitRates = createExitRateVector(this->getTransitionMatrix());
39 this->getTransitionMatrix().scaleRowsInPlace(exitRates);
43template<
typename ValueType,
typename RewardModelType>
46 if (components.exitRates) {
47 exitRates = std::move(components.exitRates.get());
49 STORM_LOG_ASSERT(components.rateTransitions,
"No rate information given for CTMC.");
50 exitRates = createExitRateVector(this->getTransitionMatrix());
53 if (!components.rateTransitions) {
54 this->getTransitionMatrix().scaleRowsInPlace(exitRates);
58template<
typename ValueType,
typename RewardModelType>
63template<
typename ValueType,
typename RewardModelType>
68template<
typename ValueType,
typename RewardModelType>
70 std::vector<ValueType> exitRates(rateMatrix.
getRowCount());
71 for (uint_fast64_t row = 0; row < rateMatrix.
getRowCount(); ++row) {
72 exitRates[row] = rateMatrix.
getRowSum(row);
77template<
typename ValueType,
typename RewardModelType>
84template<
typename ValueType,
typename RewardModelType>
88 for (uint_fast64_t row = 0; row < result.
getRowCount(); ++row) {
89 for (
auto& entry : result.
getRow(row)) {
90 entry.setValue(entry.getValue() / exitRates[row]);
This class represents a continuous-time Markov chain.
storm::storage::SparseMatrix< ValueType > computeProbabilityMatrix() const
virtual void reduceToStateBasedRewards() override
Converts the transition rewards of all reward models to state-based rewards.
Ctmc(storm::storage::SparseMatrix< ValueType > const &rateMatrix, storm::models::sparse::StateLabeling const &stateLabeling, std::unordered_map< std::string, RewardModelType > const &rewardModels=std::unordered_map< std::string, RewardModelType >())
Constructs a model from the given data.
std::vector< ValueType > const & getExitRateVector() const
Retrieves the vector of exit rates of the model.
DeterministicModel(ModelType modelType, storm::storage::sparse::ModelComponents< ValueType, RewardModelType > const &components)
Constructs a model from the given data.
storm::storage::SparseMatrix< ValueType > const & getTransitionMatrix() const
Retrieves the matrix representing the transitions of the model.
std::unordered_map< std::string, RewardModelType > const & getRewardModels() const
Retrieves the reward models.
RewardModelType & rewardModel(std::string const &rewardModelName)
CRewardModelType RewardModelType
This class manages the labeling of the state space with a number of (atomic) labels.
A class that holds a possibly non-square matrix in the compressed row storage format.
const_rows getRow(index_type row) const
Returns an object representing the given row.
value_type getRowSum(index_type row) const
Computes the sum of the entries in a given row.
index_type getRowCount() const
Returns the number of rows of the matrix.
boost::optional< std::vector< ValueType > > exitRates