diff --git a/src/abstraction/prism/AbstractCommand.cpp b/src/abstraction/prism/AbstractCommand.cpp index 22c476eec..a6b9c4599 100644 --- a/src/abstraction/prism/AbstractCommand.cpp +++ b/src/abstraction/prism/AbstractCommand.cpp @@ -11,6 +11,8 @@ #include "src/storage/prism/Command.h" #include "src/storage/prism/Update.h" +#include "src/storage/expressions/ExpressionEvaluator.h" + #include "src/utility/solver.h" #include "src/utility/macros.h" @@ -72,8 +74,10 @@ namespace storm { // Create a mapping from source state DDs to their distributions. std::unordered_map, std::vector>> sourceToDistributionsMap; - uint_fast64_t modelCounter = 0; - smtSolver->allSat(decisionVariables, [&sourceToDistributionsMap,this,&modelCounter] (storm::solver::SmtSolver::ModelReference const& model) { sourceToDistributionsMap[getSourceStateBdd(model)].push_back(getDistributionBdd(model)); return true; } ); + smtSolver->allSat(decisionVariables, [&sourceToDistributionsMap,this] (storm::solver::SmtSolver::ModelReference const& model) { + sourceToDistributionsMap[getSourceStateBdd(model)].push_back(getDistributionBdd(model)); + return true; + }); // Now we search for the maximal number of choices of player 2 to determine how many DD variables we // need to encode the nondeterminism. @@ -102,9 +106,7 @@ namespace storm { STORM_LOG_ASSERT(!resultBdd.isZero(), "The BDD must not be empty."); } - STORM_LOG_ASSERT(sourceToDistributionsMap.empty() || !resultBdd.isZero(), "The BDD must not be empty, if there were distributions."); resultBdd &= computeMissingIdentities(); - STORM_LOG_ASSERT(sourceToDistributionsMap.empty() || !resultBdd.isZero(), "The BDD must not be empty, if there were distributions."); resultBdd &= ddInformation.manager->getEncoding(ddInformation.commandDdVariable, command.get().getGlobalIndex()); STORM_LOG_ASSERT(sourceToDistributionsMap.empty() || !resultBdd.isZero(), "The BDD must not be empty, if there were distributions."); @@ -294,9 +296,10 @@ namespace storm { template storm::dd::Add AbstractCommand::getCommandUpdateProbabilitiesAdd() const { + storm::expressions::ExpressionEvaluator evaluator(globalExpressionInformation.getManager()); storm::dd::Add result = ddInformation.manager->template getAddZero(); for (uint_fast64_t updateIndex = 0; updateIndex < command.get().getNumberOfUpdates(); ++updateIndex) { - result += ddInformation.manager->getEncoding(ddInformation.updateDdVariable, updateIndex).template toAdd() * ddInformation.manager->getConstant(command.get().getUpdate(updateIndex).getLikelihoodExpression().evaluateAsDouble()); + result += ddInformation.manager->getEncoding(ddInformation.updateDdVariable, updateIndex).template toAdd() * ddInformation.manager->getConstant(evaluator.asRational(command.get().getUpdate(updateIndex).getLikelihoodExpression())); } result *= ddInformation.manager->getEncoding(ddInformation.commandDdVariable, command.get().getGlobalIndex()).template toAdd(); return result;