|
|
@ -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<storm::models::AbstractModel<ValueType>> translateProgram(storm::prism::Program program, storm::prism::RewardModel const& rewardModel = storm::prism::RewardModel(), std::string const& constantDefinitionString = "") { |
|
|
|
static std::unique_ptr<storm::models::AbstractModel<ValueType>> 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<std::string, storm::expressions::Expression> 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))); |
|
|
|
} |
|
|
|