diff --git a/src/adapters/ExplicitModelAdapter.h b/src/adapters/ExplicitModelAdapter.h index 38758fce7..803f897a1 100644 --- a/src/adapters/ExplicitModelAdapter.h +++ b/src/adapters/ExplicitModelAdapter.h @@ -98,7 +98,7 @@ namespace storm { * @param rewardModel The reward model that is to be built. * @return The explicit model that was given by the probabilistic program. */ - static std::unique_ptr> translateProgram(storm::prism::Program program, storm::prism::RewardModel const& rewardModel = storm::prism::RewardModel(), std::string const& constantDefinitionString = "") { + static std::unique_ptr> translateProgram(storm::prism::Program program, std::string const& rewardModelName = "", std::string const& constantDefinitionString = "") { // Start by defining the undefined constants in the model. // First, we need to parse the constant definition string. std::map constantDefinitions = storm::utility::prism::parseConstantDefinitionString(program, constantDefinitionString); @@ -110,6 +110,7 @@ namespace storm { // all expressions in the program so we can then evaluate them without having to store the values of the // constants in the state (i.e., valuation). preparedProgram = preparedProgram.substituteConstants(); + storm::prism::RewardModel const& rewardModel = rewardModelName != "" ? preparedProgram.getRewardModel(rewardModelName) : storm::prism::RewardModel(); ModelComponents modelComponents = buildModelComponents(preparedProgram, rewardModel); @@ -525,6 +526,7 @@ namespace storm { // Now add all rewards that match this choice. for (auto const& transitionReward : transitionRewards) { + std::cout << transitionReward.getStatePredicateExpression() << std::endl; if (transitionReward.getActionName() == "" && transitionReward.getStatePredicateExpression().evaluateAsBool(stateInformation.reachableStates.at(currentState))) { stateToRewardMap[stateProbabilityPair.first] += ValueType(transitionReward.getRewardValueExpression().evaluateAsDouble(stateInformation.reachableStates.at(currentState))); } diff --git a/src/storage/prism/RewardModel.cpp b/src/storage/prism/RewardModel.cpp index 3576dece9..7f9b8107a 100644 --- a/src/storage/prism/RewardModel.cpp +++ b/src/storage/prism/RewardModel.cpp @@ -46,7 +46,11 @@ namespace storm { } std::ostream& operator<<(std::ostream& stream, RewardModel const& rewardModel) { - stream << "rewards \"" << rewardModel.getName() << "\"" << std::endl; + stream << "rewards"; + if (rewardModel.getName() != "") { + std::cout << " \"" << rewardModel.getName() << "\""; + } + std::cout << std::endl; for (auto const& reward : rewardModel.getStateRewards()) { stream << reward << std::endl; } diff --git a/src/utility/cli.h b/src/utility/cli.h index 1051d22b6..e0736efbc 100644 --- a/src/utility/cli.h +++ b/src/utility/cli.h @@ -258,7 +258,7 @@ namespace storm { storm::prism::Program program = storm::parser::PrismParser::parse(programFile); // Then, build the model from the symbolic description. - result = storm::adapters::ExplicitModelAdapter::translateProgram(program, settings.isSymbolicRewardModelNameSet() ? program.getRewardModel(settings.getSymbolicRewardModelName()) : storm::prism::RewardModel(), constants); + result = storm::adapters::ExplicitModelAdapter::translateProgram(program, settings.isSymbolicRewardModelNameSet() ? settings.getSymbolicRewardModelName() : "", constants); } else { STORM_LOG_THROW(false, storm::exceptions::InvalidSettingsException, "No input model."); }