#include "src/abstraction/prism/AbstractModule.h" #include "src/abstraction/AbstractionInformation.h" #include "src/storage/dd/DdManager.h" #include "src/storage/dd/Add.h" #include "src/storage/prism/Module.h" namespace storm { namespace abstraction { namespace prism { template AbstractModule::AbstractModule(storm::prism::Module const& module, AbstractionInformation& abstractionInformation, storm::utility::solver::SmtSolverFactory const& smtSolverFactory) : smtSolverFactory(smtSolverFactory), abstractionInformation(abstractionInformation), commands(), module(module) { // For each concrete command, we create an abstract counterpart. for (auto const& command : module.getCommands()) { commands.emplace_back(command, abstractionInformation, smtSolverFactory); } } template void AbstractModule::refine(std::vector const& predicates) { for (auto& command : commands) { command.refine(predicates); } } template AbstractModule::~AbstractModule() { std::cout << "destructing abs module at " << this << std::endl; } template std::pair, uint_fast64_t> AbstractModule::getAbstractBdd() { // First, we retrieve the abstractions of all commands. std::vector, uint_fast64_t>> commandDdsAndUsedOptionVariableCounts; uint_fast64_t maximalNumberOfUsedOptionVariables = 0; for (auto& command : commands) { commandDdsAndUsedOptionVariableCounts.push_back(command.getAbstractBdd()); maximalNumberOfUsedOptionVariables = std::max(maximalNumberOfUsedOptionVariables, commandDdsAndUsedOptionVariableCounts.back().second); } // Then, we build the module BDD by adding the single command DDs. We need to make sure that all command // DDs use the same amount DD variable encoding the choices of player 2. storm::dd::Bdd result = this->getAbstractionInformation().getDdManager().getBddZero(); for (auto const& commandDd : commandDdsAndUsedOptionVariableCounts) { result |= commandDd.first && this->getAbstractionInformation().getPlayer2ZeroCube(maximalNumberOfUsedOptionVariables, commandDd.second); } return std::make_pair(result, maximalNumberOfUsedOptionVariables); } template storm::dd::Add AbstractModule::getCommandUpdateProbabilitiesAdd() const { storm::dd::Add result = this->getAbstractionInformation().getDdManager().template getAddZero(); for (auto const& command : commands) { result += command.getCommandUpdateProbabilitiesAdd(); } return result; } template AbstractionInformation const& AbstractModule::getAbstractionInformation() const { return abstractionInformation.get(); } template class AbstractModule; template class AbstractModule; } } }