Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
NativePolytope.h
Go to the documentation of this file.
1#ifndef STORM_STORAGE_GEOMETRY_NATIVEPOLYTOPE_H_
2#define STORM_STORAGE_GEOMETRY_NATIVEPOLYTOPE_H_
3
4#include <memory>
8
9namespace storm {
10namespace storage {
11namespace geometry {
12
13template<typename ValueType>
14class NativePolytope : public Polytope<ValueType> {
15 public:
16 typedef Eigen::Matrix<ValueType, Eigen::Dynamic, Eigen::Dynamic> EigenMatrix;
17 typedef Eigen::Matrix<ValueType, Eigen::Dynamic, 1> EigenVector;
18
19 enum class EmptyStatus {
20 Unknown, // It is unknown whether the polytope is empty or not
21 Empty, // The polytope is empty
22 Nonempty // the polytope is not empty
23 };
24
26
31 static std::shared_ptr<Polytope<ValueType>> create(boost::optional<std::vector<Halfspace<ValueType>>> const& halfspaces,
32 boost::optional<std::vector<Point>> const& points);
33
38 NativePolytope(std::vector<Halfspace<ValueType>> const& halfspaces);
39
44 NativePolytope(std::vector<Point> const& points);
45
51
55 NativePolytope(EmptyStatus const& emptyStatus, EigenMatrix const& halfspaceMatrix, EigenVector const& halfspaceVector);
56 NativePolytope(EmptyStatus&& emptyStatus, EigenMatrix&& halfspaceMatrix, EigenVector&& halfspaceVector);
57
58 virtual ~NativePolytope();
59
63 virtual std::vector<Point> getVertices() const override;
64
68 virtual std::vector<Halfspace<ValueType>> getHalfspaces() const override;
69
73 virtual bool isEmpty() const override;
74
78 virtual bool isUniversal() const override;
79
83 virtual bool contains(Point const& point) const override;
84
88 virtual bool contains(std::shared_ptr<Polytope<ValueType>> const& other) const override;
89
93 virtual std::shared_ptr<Polytope<ValueType>> intersection(std::shared_ptr<Polytope<ValueType>> const& rhs) const override;
94 virtual std::shared_ptr<Polytope<ValueType>> intersection(Halfspace<ValueType> const& halfspace) const override;
95
99 virtual std::shared_ptr<Polytope<ValueType>> convexUnion(std::shared_ptr<Polytope<ValueType>> const& rhs) const override;
100
104 virtual std::shared_ptr<Polytope<ValueType>> minkowskiSum(std::shared_ptr<Polytope<ValueType>> const& rhs) const override;
105
113 virtual std::shared_ptr<Polytope<ValueType>> affineTransformation(std::vector<Point> const& matrix, Point const& vector) const override;
114
122 virtual std::pair<Point, bool> optimize(Point const& direction) const override;
123
129 virtual std::vector<storm::expressions::Variable> declareVariables(storm::expressions::ExpressionManager& manager,
130 std::string const& namePrefix) const override;
131
135 virtual std::vector<storm::expressions::Expression> getConstraints(storm::expressions::ExpressionManager const& manager,
136 std::vector<storm::expressions::Variable> const& variables) const override;
137
138 virtual bool isNativePolytope() const override;
139
140 virtual std::shared_ptr<Polytope<ValueType>> clean() override;
141
142 private:
143 // returns the vertices of this polytope as EigenVectors
144 std::vector<EigenVector> getEigenVertices() const;
145
146 // As optimize(..) but with EigenVectors
147 std::pair<EigenVector, bool> optimize(EigenVector const& direction) const;
148
149 // Stores whether the polytope is empty or not
150 mutable EmptyStatus emptyStatus;
151
152 // Intern representation of the polytope as { x | Ax<=b }
153 EigenMatrix A;
154 EigenVector b;
155};
156
157} // namespace geometry
158} // namespace storage
159} // namespace storm
160
161#endif /* STORM_STORAGE_GEOMETRY_NATIVEPOLYTOPE_H_ */
This class is responsible for managing a set of typed variables and all expressions using these varia...
virtual bool contains(Point const &point) const override
Returns true iff the given point is inside of the polytope.
Eigen::Matrix< ValueType, Eigen::Dynamic, Eigen::Dynamic > EigenMatrix
virtual std::vector< storm::expressions::Variable > declareVariables(storm::expressions::ExpressionManager &manager, std::string const &namePrefix) const override
declares one variable for each dimension and returns the obtained variables.
virtual std::pair< Point, bool > optimize(Point const &direction) const override
Finds an optimal point inside this polytope w.r.t.
virtual std::shared_ptr< Polytope< ValueType > > clean() override
Performs cleaning operations, e.g., deleting redundant halfspaces.
virtual std::shared_ptr< Polytope< ValueType > > affineTransformation(std::vector< Point > const &matrix, Point const &vector) const override
Returns the affine transformation of this polytope P w.r.t.
virtual bool isNativePolytope() const override
Polytope< ValueType >::Point Point
virtual std::vector< Point > getVertices() const override
Returns the vertices of this polytope.
Eigen::Matrix< ValueType, Eigen::Dynamic, 1 > EigenVector
virtual bool isUniversal() const override
Returns whether this polytope is universal (i.e., equals R^n).
virtual std::shared_ptr< Polytope< ValueType > > intersection(std::shared_ptr< Polytope< ValueType > > const &rhs) const override
Intersects this polytope with rhs and returns the result.
virtual std::shared_ptr< Polytope< ValueType > > minkowskiSum(std::shared_ptr< Polytope< ValueType > > const &rhs) const override
Returns the minkowskiSum of this polytope and rhs.
static std::shared_ptr< Polytope< ValueType > > create(boost::optional< std::vector< Halfspace< ValueType > > > const &halfspaces, boost::optional< std::vector< Point > > const &points)
Creates a NativePolytope from the given halfspaces or points.
virtual bool isEmpty() const override
Returns whether this polytope is the empty set.
virtual std::vector< storm::expressions::Expression > getConstraints(storm::expressions::ExpressionManager const &manager, std::vector< storm::expressions::Variable > const &variables) const override
returns the constrains defined by this polytope as an expression over the given variables
virtual std::vector< Halfspace< ValueType > > getHalfspaces() const override
Returns the halfspaces of this polytope.
virtual std::shared_ptr< Polytope< ValueType > > convexUnion(std::shared_ptr< Polytope< ValueType > > const &rhs) const override
Returns the convex union of this polytope and rhs.
std::vector< ValueType > Point
Definition Polytope.h:19
LabParser.cpp.
Definition cli.cpp:18