Browse Source

fixed continuous to discrete time transformation

tempestpy_adaptions
TimQu 8 years ago
parent
commit
57490a7947
  1. 4
      src/storm/api/transformation.h
  2. 12
      src/storm/transformer/ContinuousToDiscreteTimeModelTransformer.cpp

4
src/storm/api/transformation.h

@ -48,9 +48,9 @@ namespace storm {
}
if (model.isOfType(storm::models::ModelType::Ctmc)) {
transformer.transform(std::move(*model.template as<storm::models::sparse::Ctmc<ValueType>>()));
return transformer.transform(std::move(*model.template as<storm::models::sparse::Ctmc<ValueType>>()));
} else if (model.isOfType(storm::models::ModelType::MarkovAutomaton)) {
transformer.transform(std::move(*model.template as<storm::models::sparse::MarkovAutomaton<ValueType>>()));
return transformer.transform(std::move(*model.template as<storm::models::sparse::MarkovAutomaton<ValueType>>()));
} else {
STORM_LOG_THROW(false, storm::exceptions::NotSupportedException, "Transformation of a " << model.getType() << " to a discrete time model is not supported.");
}

12
src/storm/transformer/ContinuousToDiscreteTimeModelTransformer.cpp

@ -112,8 +112,12 @@ namespace storm {
for (auto& rewardModel : mdpComponents.rewardModels) {
if (rewardModel.second.hasStateRewards()) {
auto& stateRewards = rewardModel.second.getStateRewardVector();
for (auto state : ma.getMarkovianStates()) {
for (uint_fast64_t state = 0; state < stateRewards.size(); ++state) {
if (ma.getMarkovianStates().get(state)) {
stateRewards[state] /= exitRates[state];
} else {
stateRewards[state] = storm::utility::zero<ValueType>();
}
}
}
}
@ -149,8 +153,12 @@ namespace storm {
for (auto& rewardModel : mdpComponents.rewardModels) {
if (rewardModel.second.hasStateRewards()) {
auto& stateRewards = rewardModel.second.getStateRewardVector();
for (auto state : ma.getMarkovianStates()) {
for (uint_fast64_t state = 0; state < stateRewards.size(); ++state) {
if (ma.getMarkovianStates().get(state)) {
stateRewards[state] /= exitRates[state];
} else {
stateRewards[state] = storm::utility::zero<ValueType>();
}
}
}
}

Loading…
Cancel
Save