Browse Source

added functionality to translate a polytope to an expression

tempestpy_adaptions
TimQu 7 years ago
parent
commit
a73574a99f
  1. 21
      src/storm/storage/geometry/NativePolytope.h
  2. 15
      src/storm/storage/geometry/Polytope.cpp
  3. 13
      src/storm/storage/geometry/Polytope.h

21
src/storm/storage/geometry/NativePolytope.h

@ -2,7 +2,6 @@
#define STORM_STORAGE_GEOMETRY_NATIVEPOLYTOPE_H_ #define STORM_STORAGE_GEOMETRY_NATIVEPOLYTOPE_H_
#include "storm/storage/geometry/Polytope.h" #include "storm/storage/geometry/Polytope.h"
#include "storm/storage/expressions/Expressions.h"
#include "storm/adapters/EigenAdapter.h" #include "storm/adapters/EigenAdapter.h"
namespace storm { namespace storm {
@ -125,8 +124,20 @@ namespace storm {
*/ */
virtual std::pair<Point, bool> optimize(Point const& direction) const override; virtual std::pair<Point, bool> optimize(Point const& direction) const override;
virtual bool isNativePolytope() const override;
/*!
* declares one variable for each dimension and returns the obtained variables.
* @param manager The expression manager that keeps track of the variables
* @param namePrefix The prefix that is prepanded to the variable index
*/
virtual std::vector<storm::expressions::Variable> declareVariables(storm::expressions::ExpressionManager& manager, std::string const& namePrefix) const override;
/*!
* returns the constrains defined by this polytope as an expression over the given variables
*/
virtual std::vector<storm::expressions::Expression> getConstraints(storm::expressions::ExpressionManager const& manager, std::vector<storm::expressions::Variable> const& variables) const override;
virtual bool isNativePolytope() const override;
private: private:
// returns the vertices of this polytope as EigenVectors // returns the vertices of this polytope as EigenVectors
@ -136,12 +147,6 @@ namespace storm {
std::pair<EigenVector, bool> optimize(EigenVector const& direction) const; std::pair<EigenVector, bool> optimize(EigenVector const& direction) const;
// declares one variable for each constraint and returns the obtained variables.
std::vector<storm::expressions::Variable> declareVariables(storm::expressions::ExpressionManager& manager, std::string const& namePrefix) const;
// returns the constrains defined by this polytope as an expresseion
std::vector<storm::expressions::Expression> getConstraints(storm::expressions::ExpressionManager const& manager, std::vector<storm::expressions::Variable> const& variables) const;
//Stores whether the polytope is empty or not //Stores whether the polytope is empty or not
mutable EmptyStatus emptyStatus; mutable EmptyStatus emptyStatus;

15
src/storm/storage/geometry/Polytope.cpp

@ -182,6 +182,21 @@ namespace storm {
return createDownwardClosure(this->getVertices()); return createDownwardClosure(this->getVertices());
} }
template <typename ValueType>
std::vector<storm::expressions::Variable> Polytope<ValueType>::declareVariables(storm::expressions::ExpressionManager& manager, std::string const& namePrefix) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Functionality not implemented for this polytope implementation.");
std::vector<storm::expressions::Variable> result;
return result;
}
template <typename ValueType>
std::vector<storm::expressions::Expression> Polytope<ValueType>::getConstraints(storm::expressions::ExpressionManager const& manager, std::vector<storm::expressions::Variable> const& variables) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Functionality not implemented for this polytope implementation.");
std::vector<storm::expressions::Expression> result;
return result;
}
template <typename ValueType> template <typename ValueType>
template <typename TargetType> template <typename TargetType>
std::shared_ptr<Polytope<TargetType>> Polytope<ValueType>::convertNumberRepresentation() const { std::shared_ptr<Polytope<TargetType>> Polytope<ValueType>::convertNumberRepresentation() const {

13
src/storm/storage/geometry/Polytope.h

@ -7,6 +7,7 @@
#include "storm/storage/geometry/Halfspace.h" #include "storm/storage/geometry/Halfspace.h"
#include "storm/storage/BitVector.h" #include "storm/storage/BitVector.h"
#include "storm/storage/expressions/Expressions.h"
namespace storm { namespace storm {
namespace storage { namespace storage {
@ -137,6 +138,18 @@ namespace storm {
*/ */
virtual std::pair<Point, bool> optimize(Point const& direction) const = 0; virtual std::pair<Point, bool> optimize(Point const& direction) const = 0;
/*!
* Declares one variable for each dimension and returns the obtained variables.
* @param manager The expression manager that keeps track of the variables
* @param namePrefix The prefix that is prepanded to the variable index
*/
virtual std::vector<storm::expressions::Variable> declareVariables(storm::expressions::ExpressionManager& manager, std::string const& namePrefix) const;
/*!
* Returns the constrains defined by this polytope as an expression over the given variables
*/
virtual std::vector<storm::expressions::Expression> getConstraints(storm::expressions::ExpressionManager const& manager, std::vector<storm::expressions::Variable> const& variables) const;
/*! /*!
* converts the intern number representation of the polytope to the given target type * converts the intern number representation of the polytope to the given target type
*/ */

Loading…
Cancel
Save