Browse Source

Made sure that model::getAllParameters also returns the parameters occurring at rates.

tempestpy_adaptions
Tim Quatmann 6 years ago
parent
commit
6faf074fc5
  1. 16
      src/storm/models/sparse/Model.cpp
  2. 9
      src/storm/models/sparse/Model.h

16
src/storm/models/sparse/Model.cpp

@ -10,6 +10,8 @@
#include "storm/exceptions/IllegalArgumentException.h"
#include "storm/exceptions/IllegalFunctionCallException.h"
#include "storm/models/sparse/Ctmc.h"
#include "storm/models/sparse/MarkovAutomaton.h"
namespace storm {
namespace models {
@ -474,10 +476,24 @@ namespace storm {
return result;
}
std::set<storm::RationalFunctionVariable> getRateParameters(Model<storm::RationalFunction> const& model) {
if (model.isOfType(storm::models::ModelType::Ctmc)) {
auto const& ctmc = model.template as<storm::models::sparse::Ctmc<storm::RationalFunction>>();
return storm::utility::vector::getVariables(ctmc->getExitRateVector());
} else if (model.isOfType(storm::models::ModelType::MarkovAutomaton)) {
auto const& ma = model.template as<storm::models::sparse::MarkovAutomaton<storm::RationalFunction>>();
return storm::utility::vector::getVariables(ma->getExitRates());
} else {
return {};
}
}
std::set<storm::RationalFunctionVariable> getAllParameters(Model<storm::RationalFunction> const& model) {
std::set<storm::RationalFunctionVariable> parameters = getProbabilityParameters(model);
std::set<storm::RationalFunctionVariable> rewardParameters = getRewardParameters(model);
parameters.insert(rewardParameters.begin(), rewardParameters.end());
std::set<storm::RationalFunctionVariable> rateParameters = getRewardParameters(model);
parameters.insert(rateParameters.begin(), rateParameters.end());
return parameters;
}
#endif

9
src/storm/models/sparse/Model.h

@ -436,7 +436,14 @@ namespace storm {
std::set<storm::RationalFunctionVariable> getRewardParameters(Model<storm::RationalFunction> const& model);
/*!
* Get all parameters (probability and rewards) occurring in the model.
* Get all parameters occurring in rates.
* @param model Model.
* @return Set of parameters. If model is not a continuous time model, the returned set is empty.
*/
std::set<storm::RationalFunctionVariable> getRateParameters(Model<storm::RationalFunction> const& model);
/*!
* Get all parameters (probability, rewards, and rates) occurring in the model.
* @param model Model.
* @return Set of parameters.
*/

Loading…
Cancel
Save