15template<
typename ValueType,
typename RewardValueType>
16storm::storage::sparse::ModelComponents<ValueType, storm::models::sparse::StandardRewardModel<RewardValueType>>
17NondeterministicModelParser<ValueType, RewardValueType>::parseNondeterministicModel(std::string
const& transitionsFilename, std::string
const& labelingFilename,
18 std::string
const& stateRewardFilename,
19 std::string
const& transitionRewardFilename,
20 std::string
const& choiceLabelingFilename) {
22 storm::storage::SparseMatrix<ValueType> transitions(
25 uint_fast64_t stateCount = transitions.getColumnCount();
31 storm::storage::sparse::ModelComponents<ValueType, storm::models::sparse::StandardRewardModel<RewardValueType>> result(std::move(transitions),
35 std::optional<std::vector<RewardValueType>> stateRewards;
36 if (!stateRewardFilename.empty()) {
41 std::optional<storm::storage::SparseMatrix<RewardValueType>> transitionRewards;
42 if (!transitionRewardFilename.empty()) {
44 transitionRewardFilename, result.transitionMatrix));
47 if (stateRewards || transitionRewards) {
48 result.rewardModels.insert(std::make_pair(
49 "", storm::models::sparse::StandardRewardModel<RewardValueType>(std::move(stateRewards), std::nullopt, std::move(transitionRewards))));
53 std::optional<storm::models::sparse::ChoiceLabeling> choiceLabeling;
54 if (!choiceLabelingFilename.empty()) {
56 result.transitionMatrix.getRowGroupIndices());
62template<
typename ValueType,
typename RewardValueType>
63storm::models::sparse::Mdp<ValueType, storm::models::sparse::StandardRewardModel<RewardValueType>>
65 std::string
const& stateRewardFilename, std::string
const& transitionRewardFilename,
66 std::string
const& choiceLabelingFilename) {
68 parseNondeterministicModel(transitionsFilename, labelingFilename, stateRewardFilename, transitionRewardFilename, choiceLabelingFilename);
This class represents a (discrete-time) Markov decision process.
Loads a nondeterministic model (Mdp or Ctmdp) from files.
static storm::models::sparse::Mdp< ValueType, storm::models::sparse::StandardRewardModel< RewardValueType > > parseMdp(std::string const &transitionsFilename, std::string const &labelingFilename, std::string const &stateRewardFilename="", std::string const &transitionRewardFilename="", std::string const &choiceLabelingFilename="")
Parse a Mdp.
static storm::storage::SparseMatrix< ValueType > parseNondeterministicTransitions(std::string const &filename)
Load a nondeterministic transition system from file and create a sparse adjacency matrix whose entrie...
static storm::storage::SparseMatrix< ValueType > parseNondeterministicTransitionRewards(std::string const &filename, storm::storage::SparseMatrix< MatrixValueType > const &modelInformation)
Load a nondeterministic transition system from file and create a sparse adjacency matrix whose entrie...
static storm::models::sparse::ChoiceLabeling parseChoiceLabeling(uint_fast64_t choiceCount, std::string const &filename, boost::optional< std::vector< uint_fast64_t > > const &nondeterministicChoiceIndices=boost::none)
Parses the given file and returns the resulting choice labeling.
static storm::models::sparse::StateLabeling parseAtomicPropositionLabeling(uint_fast64_t stateCount, std::string const &filename)
Parses the given file and returns the resulting state labeling.
static std::vector< ValueType > parseSparseStateReward(uint_fast64_t stateCount, std::string const &filename)
Reads a state reward file and puts the result in a state reward vector.
Contains all file parsers and helper classes.