Browse Source

fixed parser tests

tempestpy_adaptions
TimQu 8 years ago
parent
commit
b4ad2718b0
  1. 1
      src/storm/parser/DeterministicModelParser.cpp
  2. 6
      src/storm/parser/MarkovAutomatonParser.cpp

1
src/storm/parser/DeterministicModelParser.cpp

@ -64,6 +64,7 @@ namespace storm {
storm::models::sparse::Ctmc<ValueType, storm::models::sparse::StandardRewardModel<RewardValueType>> DeterministicModelParser<ValueType, RewardValueType>::parseCtmc(std::string const& transitionsFilename, std::string const& labelingFilename, std::string const& stateRewardFilename, std::string const& transitionRewardFilename, std::string const& choiceLabelingFilename) { storm::models::sparse::Ctmc<ValueType, storm::models::sparse::StandardRewardModel<RewardValueType>> DeterministicModelParser<ValueType, RewardValueType>::parseCtmc(std::string const& transitionsFilename, std::string const& labelingFilename, std::string const& stateRewardFilename, std::string const& transitionRewardFilename, std::string const& choiceLabelingFilename) {
auto parserResult = parseDeterministicModel(transitionsFilename, labelingFilename, stateRewardFilename, transitionRewardFilename, choiceLabelingFilename); auto parserResult = parseDeterministicModel(transitionsFilename, labelingFilename, stateRewardFilename, transitionRewardFilename, choiceLabelingFilename);
parserResult.rateTransitions = true;
return storm::models::sparse::Ctmc<ValueType, storm::models::sparse::StandardRewardModel<RewardValueType>>(std::move(parserResult)); return storm::models::sparse::Ctmc<ValueType, storm::models::sparse::StandardRewardModel<RewardValueType>>(std::move(parserResult));
} }

6
src/storm/parser/MarkovAutomatonParser.cpp

@ -34,13 +34,13 @@ namespace storm {
// If given, parse the state rewards file. // If given, parse the state rewards file.
boost::optional<std::vector<RewardValueType>> stateRewards; boost::optional<std::vector<RewardValueType>> stateRewards;
if (!stateRewardFilename.empty()) { if (!stateRewardFilename.empty()) {
stateRewards.reset(storm::parser::SparseStateRewardParser<RewardValueType>::parseSparseStateReward(transitionMatrix.getColumnCount(), stateRewardFilename));
stateRewards.reset(storm::parser::SparseStateRewardParser<RewardValueType>::parseSparseStateReward(componets.transitionMatrix.getColumnCount(), stateRewardFilename));
} }
// Only parse transition rewards if a file is given. // Only parse transition rewards if a file is given.
boost::optional<storm::storage::SparseMatrix<RewardValueType>> transitionRewards; boost::optional<storm::storage::SparseMatrix<RewardValueType>> transitionRewards;
if (!transitionRewardFilename.empty()) { if (!transitionRewardFilename.empty()) {
transitionRewards = std::move(storm::parser::NondeterministicSparseTransitionParser<RewardValueType>::parseNondeterministicTransitionRewards(transitionRewardFilename, transitionMatrix));
transitionRewards = std::move(storm::parser::NondeterministicSparseTransitionParser<RewardValueType>::parseNondeterministicTransitionRewards(transitionRewardFilename, componets.transitionMatrix));
} }
if (stateRewards || transitionRewards) { if (stateRewards || transitionRewards) {
@ -50,7 +50,7 @@ namespace storm {
// Only parse choice labeling if a file is given. // Only parse choice labeling if a file is given.
boost::optional<storm::models::sparse::ChoiceLabeling> choiceLabeling; boost::optional<storm::models::sparse::ChoiceLabeling> choiceLabeling;
if (!choiceLabelingFilename.empty()) { if (!choiceLabelingFilename.empty()) {
componets.choiceLabeling = storm::parser::SparseItemLabelingParser::parseChoiceLabeling(transitionMatrix.getRowCount(), choiceLabelingFilename, transitionMatrix.getRowGroupIndices());
componets.choiceLabeling = storm::parser::SparseItemLabelingParser::parseChoiceLabeling(componets.transitionMatrix.getRowCount(), choiceLabelingFilename, componets.transitionMatrix.getRowGroupIndices());
} }
// generate the Markov Automaton. // generate the Markov Automaton.

Loading…
Cancel
Save