|
@ -17,7 +17,7 @@ namespace storm { |
|
|
namespace menu_games { |
|
|
namespace menu_games { |
|
|
|
|
|
|
|
|
template <storm::dd::DdType DdType, typename ValueType> |
|
|
template <storm::dd::DdType DdType, typename ValueType> |
|
|
AbstractProgram<DdType, ValueType>::AbstractProgram(storm::expressions::ExpressionManager& expressionManager, storm::prism::Program const& program, std::vector<storm::expressions::Expression> const& initialPredicates, std::unique_ptr<storm::utility::solver::SmtSolverFactory>&& smtSolverFactory, bool addAllGuards) : smtSolverFactory(std::move(smtSolverFactory)), ddInformation(std::make_shared<storm::dd::DdManager<DdType>>()), expressionInformation(expressionManager, initialPredicates, program.getAllExpressionVariables(), program.getAllRangeExpressions()), modules(), program(program), initialStateAbstractor(expressionInformation, ddInformation, *this->smtSolverFactory), currentGame(nullptr) { |
|
|
|
|
|
|
|
|
AbstractProgram<DdType, ValueType>::AbstractProgram(storm::expressions::ExpressionManager& expressionManager, storm::prism::Program const& program, std::vector<storm::expressions::Expression> const& initialPredicates, std::unique_ptr<storm::utility::solver::SmtSolverFactory>&& smtSolverFactory, bool addAllGuards) : smtSolverFactory(std::move(smtSolverFactory)), ddInformation(std::make_shared<storm::dd::DdManager<DdType>>()), expressionInformation(expressionManager, initialPredicates, program.getAllExpressionVariables(), program.getAllRangeExpressions()), modules(), program(program), initialStateAbstractor(expressionInformation, ddInformation, *this->smtSolverFactory), addedAllGuards(addAllGuards), bottomStateAbstractor(expressionInformation, ddInformation, *this->smtSolverFactory), currentGame(nullptr) { |
|
|
|
|
|
|
|
|
// For now, we assume that there is a single module. If the program has more than one module, it needs
|
|
|
// For now, we assume that there is a single module. If the program has more than one module, it needs
|
|
|
// to be flattened before the procedure.
|
|
|
// to be flattened before the procedure.
|
|
@ -30,6 +30,10 @@ namespace storm { |
|
|
for (auto const& command : module.getCommands()) { |
|
|
for (auto const& command : module.getCommands()) { |
|
|
if (addAllGuards) { |
|
|
if (addAllGuards) { |
|
|
expressionInformation.predicates.push_back(command.getGuardExpression()); |
|
|
expressionInformation.predicates.push_back(command.getGuardExpression()); |
|
|
|
|
|
} else { |
|
|
|
|
|
// If not all guards were added, we also need to populate the bottom state abstractor.
|
|
|
|
|
|
std::cout << "adding " << !command.getGuardExpression() << std::endl; |
|
|
|
|
|
bottomStateAbstractor.addPredicate(!command.getGuardExpression()); |
|
|
} |
|
|
} |
|
|
maximalUpdateCount = std::max(maximalUpdateCount, static_cast<uint_fast64_t>(command.getNumberOfUpdates())); |
|
|
maximalUpdateCount = std::max(maximalUpdateCount, static_cast<uint_fast64_t>(command.getNumberOfUpdates())); |
|
|
} |
|
|
} |
|
@ -100,7 +104,10 @@ namespace storm { |
|
|
// Refine initial state abstractor.
|
|
|
// Refine initial state abstractor.
|
|
|
initialStateAbstractor.refine(newPredicateIndices); |
|
|
initialStateAbstractor.refine(newPredicateIndices); |
|
|
|
|
|
|
|
|
// Finally, we rebuild the game.
|
|
|
|
|
|
|
|
|
// Refine bottom state abstractor.
|
|
|
|
|
|
bottomStateAbstractor.refine(newPredicateIndices); |
|
|
|
|
|
|
|
|
|
|
|
// Finally, we rebuild the game..
|
|
|
currentGame = buildGame(); |
|
|
currentGame = buildGame(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -139,6 +146,16 @@ namespace storm { |
|
|
storm::dd::Bdd<DdType> initialStates = initialStateAbstractor.getAbstractStates(); |
|
|
storm::dd::Bdd<DdType> initialStates = initialStateAbstractor.getAbstractStates(); |
|
|
storm::dd::Bdd<DdType> reachableStates = this->getReachableStates(initialStates, transitionRelation); |
|
|
storm::dd::Bdd<DdType> reachableStates = this->getReachableStates(initialStates, transitionRelation); |
|
|
|
|
|
|
|
|
|
|
|
// Determine the bottom states.
|
|
|
|
|
|
storm::dd::Bdd<DdType> bottomStates; |
|
|
|
|
|
if (addedAllGuards) { |
|
|
|
|
|
bottomStates = ddInformation.manager->getBddZero(); |
|
|
|
|
|
} else { |
|
|
|
|
|
bottomStates = bottomStateAbstractor.getAbstractStates(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
std::cout << "found " << (reachableStates && bottomStates).getNonZeroCount() << " reachable bottom states" << std::endl; |
|
|
|
|
|
|
|
|
// Find the deadlock states in the model.
|
|
|
// Find the deadlock states in the model.
|
|
|
storm::dd::Bdd<DdType> deadlockStates = transitionRelation.existsAbstract(ddInformation.successorVariables); |
|
|
storm::dd::Bdd<DdType> deadlockStates = transitionRelation.existsAbstract(ddInformation.successorVariables); |
|
|
deadlockStates = reachableStates && !deadlockStates; |
|
|
deadlockStates = reachableStates && !deadlockStates; |
|
@ -160,7 +177,7 @@ namespace storm { |
|
|
std::set<storm::expressions::Variable> allNondeterminismVariables = usedPlayer2Variables; |
|
|
std::set<storm::expressions::Variable> allNondeterminismVariables = usedPlayer2Variables; |
|
|
allNondeterminismVariables.insert(ddInformation.commandDdVariable); |
|
|
allNondeterminismVariables.insert(ddInformation.commandDdVariable); |
|
|
|
|
|
|
|
|
return std::unique_ptr<MenuGame<DdType>>(new MenuGame<DdType>(ddInformation.manager, reachableStates, initialStates, transitionMatrix, ddInformation.sourceVariables, ddInformation.successorVariables, ddInformation.predicateDdVariables, {ddInformation.commandDdVariable}, usedPlayer2Variables, allNondeterminismVariables, ddInformation.updateDdVariable, ddInformation.expressionToBddMap)); |
|
|
|
|
|
|
|
|
return std::unique_ptr<MenuGame<DdType>>(new MenuGame<DdType>(ddInformation.manager, reachableStates, initialStates, transitionMatrix, bottomStates, ddInformation.sourceVariables, ddInformation.successorVariables, ddInformation.predicateDdVariables, {ddInformation.commandDdVariable}, usedPlayer2Variables, allNondeterminismVariables, ddInformation.updateDdVariable, ddInformation.expressionToBddMap)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
template <storm::dd::DdType DdType, typename ValueType> |
|
|
template <storm::dd::DdType DdType, typename ValueType> |
|
|