68 lines
2.7 KiB

/*
* File: HyperplaneEnumeration.h
* Author: tim quatmann
* Author: phillip florian
*
* Created on December 27, 2015, 1:06 PM
*/
#pragma once
#include "../macros.h"
#include "../../../datastructures/Hyperplane.h"
#include "../../../datastructures/Point.h"
namespace hypro{
namespace pterm{
template< typename Number>
class HyperplaneEnumeration {
public:
HyperplaneEnumeration() = default;
virtual ~HyperplaneEnumeration() = default;
/*
* Generates the vertices of the given polytope by enumerating all intersection points generated by subsets of hyperplanes of size hPoly.dimension().
* If the given flag is true, this method will also compute
* * the minimal set of hyperplanes which represent the given hPoly (can be used to remove redundant hyperplanes), and
* * for each hyperplane, the set of (non-redundant) vertices that lie on that hyperplane.
*
* Use the provided getter methods to retrieve the results
*
* @return true iff conversion was successful.
*/
bool generateVerticesFromHalfspaces(PTermHPolytope<Number> const& hPoly, bool generateRelevantHyperplanesAndVertexSets);
std::vector<Point<Number>>& getResultVertices();
/*!
* Returns the set of halfspaces which are not redundant
* @note the returned matrix and vector are empty if the corresponding flag was false
*/
hypro::matrix_t<Number>& getRelevantMatrix();
hypro::vector_t<Number>& getRelevantVector();
/*!
* Returns for each hyperplane the set of vertices that lie on that hyperplane.
* A vertex is given as an index in the relevantVertices vector.
* @note the returned vector is empty if the corresponding flag was false
*/
std::vector<std::vector<std::size_t>>& getVertexSets();
/*
* Returns true if the hyperplanes with indices of subset and item are all linear independent
* Note that this is also used by the hybrid polytope.
*/
static bool linearDependenciesFilter(std::vector<std::size_t> const& subset, std::size_t const& item, hypro::matrix_t<Number> const& A);
private:
std::vector<Point<Number>> mResultVertices;
hypro::matrix_t<Number> mRelevantMatrix;
hypro::vector_t<Number> mRelevantVector;
std::vector<std::vector<std::size_t>> mVertexSets;
};
}
}
#include "HyperplaneEnumeration.tpp"