#pragma once #include #include #include #include #include #include "src/storage/dd/DdType.h" #include "src/storage/expressions/Variable.h" namespace storm { namespace dd { template class DdManager; template class Bdd; } namespace expressions { class Expression; } namespace abstraction { template struct AbstractionDdInformation { public: /*! * Creates a new DdInformation that uses the given manager. * * @param manager The manager to use. * @param initialPredicates The initially considered predicates. */ AbstractionDdInformation(std::shared_ptr> const& manager, std::vector const& initialPredicates = std::vector()); /*! * Encodes the given distribution index by using the given number of variables from the optionDdVariables * vector. * * @param numberOfVariables The number of variables to use. * @param distributionIndex The distribution index to encode. * @return The encoded distribution index. */ storm::dd::Bdd encodeDistributionIndex(uint_fast64_t numberOfVariables, uint_fast64_t distributionIndex) const; /*! * Adds the given predicate and creates all associated ressources. * * @param predicate The predicate to add. */ void addPredicate(storm::expressions::Expression const& predicate); /*! * Retrieves the cube of option variables in the range [begin, end) the given indices. * * @param begin The first variable of the range to return. * @param end One past the last variable of the range to return. * @return The cube of variables in the given range. */ storm::dd::Bdd getMissingOptionVariableCube(uint_fast64_t begin, uint_fast64_t end) const; /*! * Examines the old and new relevant predicates and declares decision variables for the missing relevant * predicates. * * @param manager The manager in which to declare the decision variable. * @param oldRelevantPredicates The previously relevant predicates. * @param newRelevantPredicates The new relevant predicates. * @return Pairs of decision variables and their index for the missing predicates. */ static std::vector> declareNewVariables(storm::expressions::ExpressionManager& manager, std::vector> const& oldRelevantPredicates, std::set const& newRelevantPredicates); // The manager responsible for the DDs. std::shared_ptr> manager; // The DD variables corresponding to the predicates. std::vector> predicateDdVariables; // The set of all source variables. std::set sourceVariables; // The set of all source variables. std::set successorVariables; // The BDDs corresponding to the predicates. std::vector, storm::dd::Bdd>> predicateBdds; // The BDDs representing the predicate identities (i.e. source and successor variable have the same truth value). std::vector> predicateIdentities; // A BDD that represents the identity of all predicate variables. storm::dd::Bdd allPredicateIdentities; // The DD variable encoding the command (i.e., the nondeterministic choices of player 1). storm::expressions::Variable commandDdVariable; // The DD variable encoding the update IDs for all actions. storm::expressions::Variable updateDdVariable; // The DD variables encoding the nondeterministic choices of player 2. std::vector>> optionDdVariables; // A mapping from the predicates to the BDDs. std::map> expressionToBddMap; // A mapping from the indices of the BDD variables to the predicates. std::unordered_map bddVariableIndexToPredicateMap; }; } }