From 723999f8854fc17f6c79835700fb4e822c33a81a Mon Sep 17 00:00:00 2001 From: dehnert Date: Thu, 4 Aug 2016 16:04:32 +0200 Subject: [PATCH] intermediate work-place switch commit Former-commit-id: 818179d2864862dc0710919707275bcee96a954c --- src/abstraction/AbstractionInformation.cpp | 77 ++++++++++++ src/abstraction/AbstractionInformation.h | 129 +++++++++++++++++++++ 2 files changed, 206 insertions(+) create mode 100644 src/abstraction/AbstractionInformation.cpp create mode 100644 src/abstraction/AbstractionInformation.h diff --git a/src/abstraction/AbstractionInformation.cpp b/src/abstraction/AbstractionInformation.cpp new file mode 100644 index 000000000..071f9150e --- /dev/null +++ b/src/abstraction/AbstractionInformation.cpp @@ -0,0 +1,77 @@ +#include "src/abstraction/AbstractionInformation.h" + +namespace storm { + namespace abstraction { + + template + AbstractionInformation::AbstractionInformation(storm::expressions::ExpressionManager& expressionManager) : expressionManager(expressionManager) { + // Intentionally left empty. + } + + template + void AbstractionInformation::addVariable(storm::expressions::Variable const& variable) { + variables.insert(variable); + } + + template + void AbstractionInformation::addVariable(storm::expressions::Variable const& variable, storm::expressions::Expression const& constraint) { + addVariable(variable); + addConstraint(constraint); + } + + template + void AbstractionInformation::addConstraint(storm::expressions::Expression const& constraint) { + constraints.push_back(constraint); + } + + template + void AbstractionInformation::addPredicate(storm::expressions::Expression const& predicate) { + predicates.push_back(predicate); + } + + template + void AbstractionInformation::addPredicates(std::vector const& predicates) { + for (auto const& predicate : predicates) { + this->addPredicate(predicate); + } + } + + template + storm::expressions::ExpressionManager& AbstractionInformation::getExpressionManager() { + return expressionManager; + } + + template + storm::expressions::ExpressionManager const& AbstractionInformation::getExpressionManager() const { + return expressionManager; + } + + template + std::vector const& AbstractionInformation::getPredicates() const { + return predicates; + } + + template + storm::expressions::Expression const& AbstractionInformation::getPredicateByIndex(uint_fast64_t index) const { + return predicates[index]; + } + + template + std::size_t AbstractionInformation::getNumberOfPredicates() const { + return predicates.size(); + } + + template + std::set const& AbstractionInformation::getVariables() const { + return variables; + } + + template + std::vector const& AbstractionInformation::getConstraints() const { + return constraints; + } + + template class AbstractionInformation; + template class AbstractionInformation; + } +} \ No newline at end of file diff --git a/src/abstraction/AbstractionInformation.h b/src/abstraction/AbstractionInformation.h new file mode 100644 index 000000000..6af6e7e17 --- /dev/null +++ b/src/abstraction/AbstractionInformation.h @@ -0,0 +1,129 @@ +#pragma once + +#include +#include + +#include "src/storage/dd/DdType.h" + +namespace storm { + namespace expressions { + class ExpressionManager; + class Expression; + class Variable; + } + + namespace abstraction { + + template + class AbstractionInformation { + public: + /*! + * Creates a new abstraction information object. + * + * @param expressionManager The manager responsible for all variables and expressions during the abstraction process. + */ + AbstractionInformation(storm::expressions::ExpressionManager& expressionManager); + + /*! + * Adds the given variable. + * + * @param variable The variable to add. + */ + void addVariable(storm::expressions::Variable const& variable); + + /*! + * Adds the given variable whose range is restricted. + * + * @param variable The variable to add. + * @param constraint An expression characterizing the legal values of the variable. + */ + void addVariable(storm::expressions::Variable const& variable, storm::expressions::Expression const& constraint); + + /*! + * Adds an expression that constrains the legal variable values. + * + * @param constraint The constraint. + */ + void addConstraint(storm::expressions::Expression const& constraint); + + /*! + * Adds the given predicate. + * + * @param predicate The predicate to add. + */ + void addPredicate(storm::expressions::Expression const& predicate); + + /*! + * Adds the given predicates. + * + * @param predicates The predicates to add. + */ + void addPredicates(std::vector const& predicates); + + /*! + * Retrieves the expression manager. + * + * @return The manager. + */ + storm::expressions::ExpressionManager& getExpressionManager(); + + /*! + * Retrieves the expression manager. + * + * @return The manager. + */ + storm::expressions::ExpressionManager const& getExpressionManager() const; + + /*! + * Retrieves all currently known predicates. + * + * @return The list of known predicates. + */ + std::vector const& getPredicates() const; + + /*! + * Retrieves the predicate with the given index. + * + * @param index The index of the predicate. + */ + storm::expressions::Expression const& getPredicateByIndex(uint_fast64_t index) const; + + /*! + * Retrieves the number of predicates. + * + * @return The number of predicates. + */ + std::size_t getNumberOfPredicates() const; + + /*! + * Retrieves all currently known variables. + * + * @return The set of known variables. + */ + std::set const& getVariables() const; + + /*! + * Retrieves a list of expressions that constrain the valid variable values. + * + * @return The constraint expressions. + */ + std::vector const& getConstraints() const; + + private: + // The expression related data. + + /// The manager responsible for the expressions of the program and the SMT solvers. + storm::expressions::ExpressionManager& expressionManager; + + /// The current set of predicates used in the abstraction. + std::vector predicates; + + /// The set of all variables. + std::set variables; + + /// The expressions characterizing legal variable values. + std::vector constraints; + }; + + } +} \ No newline at end of file