Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
HyperplaneCollector.h
Go to the documentation of this file.
1#ifndef STORM_STORAGE_GEOMETRY_NATIVEPOLYTOPECONVERSION_HYPERPLANECOLLECTOR_H_
2#define STORM_STORAGE_GEOMETRY_NATIVEPOLYTOPECONVERSION_HYPERPLANECOLLECTOR_H_
3
4#include <unordered_map>
5
7
8namespace storm {
9namespace storage {
10namespace geometry {
15template<typename ValueType>
17 public:
18 typedef Eigen::Matrix<ValueType, Eigen::Dynamic, Eigen::Dynamic> EigenMatrix;
19 typedef Eigen::Matrix<ValueType, Eigen::Dynamic, 1> EigenVector;
20
23 virtual ~HyperplaneCollector() = default;
24
25 /*
26 * inserts the given hyperplane.
27 * For every (unique) hyperplane, there is a list of indices which can be used e.g. to obtain the set of vertices that lie on each hyperplane.
28 * If indexList is given (i.e. not nullptr), the given indices are appended to that list.
29 * Returns true iff the hyperplane was inserted (i.e. the hyperplane was not already contained in this)
30 */
31 bool insert(EigenVector const& normal, ValueType const& offset, std::vector<uint_fast64_t> const* indexList = nullptr);
32 bool insert(EigenVector&& normal, ValueType&& offset, std::vector<uint_fast64_t> const* indexList = nullptr);
33
34 std::pair<EigenMatrix, EigenVector> getCollectedHyperplanesAsMatrixVector() const;
35 // Note that the returned lists might contain dublicates.
36 std::vector<std::vector<uint_fast64_t>> getIndexLists() const;
37
38 uint_fast64_t numOfCollectedHyperplanes() const;
39
40 private:
41 typedef std::pair<EigenVector, ValueType> NormalOffset;
42 class NormalOffsetHash {
43 public:
44 std::size_t operator()(NormalOffset const& ns) const {
45 std::size_t seed = std::hash<EigenVector>()(ns.first);
46 carl::hash_add(seed, std::hash<ValueType>()(ns.second));
47 return seed;
48 }
49 };
50 typedef typename std::unordered_map<NormalOffset, std::vector<uint_fast64_t>, NormalOffsetHash>::key_type MapKeyType;
51 typedef typename std::unordered_map<NormalOffset, std::vector<uint_fast64_t>, NormalOffsetHash>::value_type MapValueType;
52
53 std::unordered_map<NormalOffset, std::vector<uint_fast64_t>, NormalOffsetHash> map;
54};
55} // namespace geometry
56} // namespace storage
57} // namespace storm
58
59#endif /* STORM_STORAGE_GEOMETRY_NATIVEPOLYTOPECONVERSION_HYPERPLANECOLLECTOR_H_ */
This class can be used to collect a set of hyperplanes (without duplicates).
HyperplaneCollector(const HyperplaneCollector &orig)=default
bool insert(EigenVector const &normal, ValueType const &offset, std::vector< uint_fast64_t > const *indexList=nullptr)
Eigen::Matrix< ValueType, Eigen::Dynamic, 1 > EigenVector
std::vector< std::vector< uint_fast64_t > > getIndexLists() const
std::pair< EigenMatrix, EigenVector > getCollectedHyperplanesAsMatrixVector() const
Eigen::Matrix< ValueType, Eigen::Dynamic, Eigen::Dynamic > EigenMatrix
LabParser.cpp.
Definition cli.cpp:18