Storm 1.14.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
HyperplaneCollector.h
Go to the documentation of this file.
1#pragma once
2
3#include <unordered_map>
4
6
7namespace storm {
8namespace storage {
9namespace geometry {
14template<typename ValueType>
16 public:
17 typedef Eigen::Matrix<ValueType, Eigen::Dynamic, Eigen::Dynamic> EigenMatrix;
18 typedef Eigen::Matrix<ValueType, Eigen::Dynamic, 1> EigenVector;
19
22 virtual ~HyperplaneCollector() = default;
23
24 /*
25 * inserts the given hyperplane.
26 * 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.
27 * If indexList is given (i.e. not nullptr), the given indices are appended to that list.
28 * Returns true iff the hyperplane was inserted (i.e. the hyperplane was not already contained in this)
29 */
30 bool insert(EigenVector const& normal, ValueType const& offset, std::vector<uint_fast64_t> const* indexList = nullptr);
31 bool insert(EigenVector&& normal, ValueType&& offset, std::vector<uint_fast64_t> const* indexList = nullptr);
32
33 std::pair<EigenMatrix, EigenVector> getCollectedHyperplanesAsMatrixVector() const;
34 // Note that the returned lists might contain dublicates.
35 std::vector<std::vector<uint_fast64_t>> getIndexLists() const;
36
37 uint_fast64_t numOfCollectedHyperplanes() const;
38
39 private:
40 typedef std::pair<EigenVector, ValueType> NormalOffset;
41 class NormalOffsetHash {
42 public:
43 std::size_t operator()(NormalOffset const& ns) const {
44 std::size_t seed = std::hash<EigenVector>()(ns.first);
45 carl::hash_add(seed, std::hash<ValueType>()(ns.second));
46 return seed;
47 }
48 };
49 typedef typename std::unordered_map<NormalOffset, std::vector<uint_fast64_t>, NormalOffsetHash>::key_type MapKeyType;
50 typedef typename std::unordered_map<NormalOffset, std::vector<uint_fast64_t>, NormalOffsetHash>::value_type MapValueType;
51
52 std::unordered_map<NormalOffset, std::vector<uint_fast64_t>, NormalOffsetHash> map;
53};
54} // namespace geometry
55} // namespace storage
56} // namespace storm
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