Browse Source

CTMC constructor with exitRates

Former-commit-id: 2f1afe1d5b
tempestpy_adaptions
Mavo 9 years ago
parent
commit
380d3f1897
  1. 2
      src/builder/ExplicitDFTModelBuilder.cpp
  2. 7
      src/models/sparse/Ctmc.cpp
  3. 14
      src/models/sparse/Ctmc.h

2
src/builder/ExplicitDFTModelBuilder.cpp

@ -120,7 +120,7 @@ namespace storm {
} }
} }
} }
model = std::make_shared<storm::models::sparse::Ctmc<ValueType>>(std::move(rateMatrix), std::move(modelComponents.stateLabeling));
model = std::make_shared<storm::models::sparse::Ctmc<ValueType>>(std::move(rateMatrix), std::move(modelComponents.exitRates), std::move(modelComponents.stateLabeling));
} else { } else {
std::shared_ptr<storm::models::sparse::MarkovAutomaton<ValueType>> ma = std::make_shared<storm::models::sparse::MarkovAutomaton<ValueType>>(std::move(modelComponents.transitionMatrix), std::move(modelComponents.stateLabeling), std::move(modelComponents.markovianStates), std::move(modelComponents.exitRates), true); std::shared_ptr<storm::models::sparse::MarkovAutomaton<ValueType>> ma = std::make_shared<storm::models::sparse::MarkovAutomaton<ValueType>>(std::move(modelComponents.transitionMatrix), std::move(modelComponents.stateLabeling), std::move(modelComponents.markovianStates), std::move(modelComponents.exitRates), true);
if (ma->hasOnlyTrivialNondeterminism()) { if (ma->hasOnlyTrivialNondeterminism()) {

7
src/models/sparse/Ctmc.cpp

@ -24,6 +24,13 @@ namespace storm {
exitRates = createExitRateVector(this->getTransitionMatrix()); exitRates = createExitRateVector(this->getTransitionMatrix());
} }
template <typename ValueType, typename RewardModelType>
Ctmc<ValueType, RewardModelType>::Ctmc(storm::storage::SparseMatrix<ValueType> const& rateMatrix, std::vector<ValueType> const& exitRates, storm::models::sparse::StateLabeling const& stateLabeling,
std::unordered_map<std::string, RewardModelType> const& rewardModels,
boost::optional<std::vector<LabelSet>> const& optionalChoiceLabeling)
: DeterministicModel<ValueType, RewardModelType>(storm::models::ModelType::Ctmc, std::move(rateMatrix), std::move(stateLabeling), std::move(rewardModels), std::move(optionalChoiceLabeling)), exitRates(exitRates) {
}
template <typename ValueType, typename RewardModelType> template <typename ValueType, typename RewardModelType>
std::vector<ValueType> const& Ctmc<ValueType, RewardModelType>::getExitRateVector() const { std::vector<ValueType> const& Ctmc<ValueType, RewardModelType>::getExitRateVector() const {
return exitRates; return exitRates;

14
src/models/sparse/Ctmc.h

@ -38,6 +38,20 @@ namespace storm {
std::unordered_map<std::string, RewardModelType>&& rewardModels = std::unordered_map<std::string, RewardModelType>(), std::unordered_map<std::string, RewardModelType>&& rewardModels = std::unordered_map<std::string, RewardModelType>(),
boost::optional<std::vector<LabelSet>>&& optionalChoiceLabeling = boost::optional<std::vector<LabelSet>>()); boost::optional<std::vector<LabelSet>>&& optionalChoiceLabeling = boost::optional<std::vector<LabelSet>>());
/*!
* Constructs a model from the given data.
*
* @param rateMatrix The matrix representing the transitions in the model.
* @param exitRates The exit rates of all states.
* @param stateLabeling The labeling of the states.
* @param rewardModels A mapping of reward model names to reward models.
* @param optionalChoiceLabeling A vector that represents the labels associated with the choices of each state.
*/
Ctmc(storm::storage::SparseMatrix<ValueType> const& rateMatrix, std::vector<ValueType> const& exitRates, storm::models::sparse::StateLabeling const& stateLabeling,
std::unordered_map<std::string, RewardModelType> const& rewardModels = std::unordered_map<std::string, RewardModelType>(),
boost::optional<std::vector<LabelSet>> const& optionalChoiceLabeling = boost::optional<std::vector<LabelSet>>());
Ctmc(Ctmc<ValueType, RewardModelType> const& ctmc) = default; Ctmc(Ctmc<ValueType, RewardModelType> const& ctmc) = default;
Ctmc& operator=(Ctmc<ValueType, RewardModelType> const& ctmc) = default; Ctmc& operator=(Ctmc<ValueType, RewardModelType> const& ctmc) = default;

Loading…
Cancel
Save