politopix
5.0.0
|
Model a polytope using its two equivalent definitions : the convex hull and the half-space intersection. More...
#include <Polytope_Rn.h>
Public Member Functions | |
Polytope_Rn () | |
Constructor for polytopes i.e. bounded convex polyhedra. More... | |
virtual | ~Polytope_Rn () |
Destructor. More... | |
virtual bool | isBounded () const |
Tell whether this polyhedron is bounded or not, polytopes are bounded. More... | |
virtual unsigned int | neigbourhoodCondition () const |
Two vertices are neighbours in a polytope <=> they share at least (n-1) facets. More... | |
virtual unsigned int | numberOfGeneratorsPerFacet () const |
Each facet in a polytope has got n vertices. More... | |
virtual void | createBoundingSimplex (double M) |
Initialize the truncating algorithm building a M-sized simplex around the polytope. More... | |
virtual void | createBoundingBox (double M) |
Initialize the truncating algorithm building a M-sized bounding box around the polytope. More... | |
virtual bool | checkEdges () const |
Always true in the polyhedral cone case. More... | |
bool | checkEqualityOfVertices (const boost::shared_ptr< Polytope_Rn > &B, bool printOnScreen=false) const |
Check whether two V-polytopes are identical Check whether the sets of vertices of A and B are equal. More... | |
virtual double | createTruncatedGenerator (const boost::shared_ptr< Generator_Rn_SD > &in, const boost::shared_ptr< Generator_Rn_SD > &out, boost::shared_ptr< Generator_Rn_SD > newV, double ay, double az, double b=0.) const |
This is the intersection vertex in the truncating algorithm, defined by the intersection between an edge and an hyperplane. More... | |
boost::shared_ptr< PolyhedralCone_Rn > | getPrimalCone (unsigned int u, const std::vector< unsigned int > &allNgb) const |
boost::shared_ptr< PolyhedralCone_Rn > | getPrimalCone (unsigned int i) const |
boost::shared_ptr< Polytope_Rn > | sum (const boost::shared_ptr< Polytope_Rn > &pol2sum) |
boost::shared_ptr< Polytope_Rn > | intersect (const boost::shared_ptr< Polytope_Rn > &pol2intersect) |
bool | isIncluded (const boost::shared_ptr< Polytope_Rn > &B) const |
bool | isIncluded (const boost::shared_ptr< Polytope_Rn > &B, double &minmaxDistance) const |
std::string | getName () const |
std::string | getFileExtension () const |
![]() | |
PolyhedralCone_Rn () | |
Constructor. More... | |
PolyhedralCone_Rn (const PolyhedralCone_Rn &A) | |
Constructor. More... | |
virtual | ~PolyhedralCone_Rn () |
Destructor. More... | |
virtual unsigned int | dimension () const |
Return the space dimension. More... | |
void | reset () |
Remove all half-spaces and generators. More... | |
unsigned int | numberOfHalfSpaces () const |
Get the total number of half-spaces. More... | |
boost::shared_ptr< HalfSpace_Rn > | addHalfSpace (boost::shared_ptr< HalfSpace_Rn > hs, bool check=false) |
Add the current half-space in its list. More... | |
void | removeHalfSpaceFromListAndGenerators (const boost::shared_ptr< HalfSpace_Rn > &hs) |
Remove the half-space given as parameter from its list and from all generators. More... | |
void | removeHalfSpace (unsigned int j) |
Remove the half-space number j from its list. More... | |
void | removeHalfSpaces (const std::set< boost::shared_ptr< HalfSpace_Rn > > &setOfRedundantHS) |
Remove the half-space number j from its list. More... | |
unsigned int | getHalfSpaceNumber (const boost::shared_ptr< HalfSpace_Rn > &F) const |
For a given half-space, return its list index. More... | |
const boost::shared_ptr< HalfSpace_Rn > & | getHalfSpace (unsigned int i) const |
Return the i-th half-space. More... | |
listOfGeometricObjects< boost::shared_ptr< HalfSpace_Rn > > & | getListOfHalfSpaces () |
Return the list of half-spaces. More... | |
const listOfGeometricObjects< boost::shared_ptr< HalfSpace_Rn > > & | getListOfHalfSpaces () const |
Return the list of half-spaces. More... | |
void | setListOfHalfSpaces (const listOfGeometricObjects< boost::shared_ptr< HalfSpace_Rn > > &hsList) |
Set a new list of half-spaces. More... | |
unsigned int | numberOfGenerators () const |
Give the total number of generators. More... | |
void | addGenerator (boost::shared_ptr< Generator_Rn > vx) |
Add the given generator. More... | |
const boost::shared_ptr< Generator_Rn > & | getGenerator (unsigned int i) const |
Return the i-th generator. More... | |
unsigned int | getGeneratorNumber (boost::shared_ptr< Generator_Rn > G) const |
For a given generator, return its list index. More... | |
const listOfGeometricObjects< boost::shared_ptr< Generator_Rn > > & | getListOfGenerators () const |
Return the list of generators. More... | |
unsigned int | getListOfGeneratorsSD (std::vector< boost::shared_ptr< Generator_Rn_SD > > ¤tListOfGeneratorsSD) const |
void | setListOfGeneratorsSD (const std::vector< boost::shared_ptr< Generator_Rn_SD > > &gnList) |
Set a new list of generators. The list of half-spaces should have been previously set. More... | |
void | relocateGenerators () |
void | setListOfGenerators (const listOfGeometricObjects< boost::shared_ptr< Generator_Rn > > &gnList) |
Set a new list of generators. More... | |
bool | checkNeighbours (const boost::shared_ptr< Generator_Rn > &V1, const boost::shared_ptr< Generator_Rn > &V2, std::vector< boost::shared_ptr< HalfSpace_Rn > > &commonFacets, const std::set< boost::shared_ptr< HalfSpace_Rn > > &listOfRedundantHS) const |
bool | isIncluded (const boost::shared_ptr< PolyhedralCone_Rn > &B) const |
Test whether the current polytope V-description is inside the polytope B H-description. More... | |
bool | checkNeighbours (const boost::shared_ptr< Generator_Rn > &V1, const boost::shared_ptr< Generator_Rn > &V2, std::vector< boost::shared_ptr< HalfSpace_Rn > > &commonFacets, unsigned int topologicalCode=1) const |
bool | checkNeighbours (const boost::shared_ptr< Generator_Rn > &V1, const boost::shared_ptr< Generator_Rn > &V2, std::vector< HalfSpace_Rn * > &commonFacets, unsigned int topologicalCode=1) const |
Check for polytopes that vertices share (n-1) facets. For polyhedral cones, it must check that vectors share (n-2) facets. More... | |
bool | checkNeighbours (const boost::shared_ptr< Generator_Rn_SD > &genIn, const boost::shared_ptr< Generator_Rn_SD > &genOut, std::vector< unsigned int > &commonFacets) const |
Check for polytopes that vertices share (n-1) facets. For polyhedral cones, it must check that vectors share (n-2) facets. More... | |
bool | checkNeighboursWithHSnumbers (const boost::shared_ptr< Generator_Rn > &V1, const boost::shared_ptr< Generator_Rn > &V2, std::vector< HalfSpace_Rn * > &commonFacets, const std::set< boost::shared_ptr< HalfSpace_Rn > > &listOfRedundantHS, unsigned int topologicalCode=1) const |
Check for polytopes that vertices share (n-1) facets. For polyhedral cones, it must check that vectors share (n-2) facets. More... | |
void | fillNeighbourMatrix (std::vector< std::vector< unsigned int > > &neighboursA, unsigned int topologicalCode=1) const |
void | fillIrredundantNeighbourMatrix (std::vector< std::vector< unsigned int > > &neighboursA) const |
virtual bool | checkTopologyAndGeometry (bool check_all=false) const |
As stated by Komei Fukuda "the complexity of the polyhedral verification problem is unknown.
Is it in P or in coNP-complete?" So only 3 verifications are made in Rn : More... | |
HalfSpace_Rn::State | checkPoint (const Point_Rn &thisPoint) const |
Check a point state against the whole polyhedron. More... | |
HalfSpace_Rn::State | checkGenerator (const boost::shared_ptr< Generator_Rn > &thisGen) const |
HalfSpace_Rn::State | checkPoint (const boost::shared_ptr< Generator_Rn > &point, const boost::shared_ptr< HalfSpace_Rn > &halfSpace, double halfSpaceNorm) const |
Check a point state against a half-space. More... | |
bool | checkDuplicateGenerators (unsigned int &a, unsigned int &b) |
Make sure no duplicate generators are stored. More... | |
void | checkGenerator (unsigned int vtxNumber, std::ostream &this_ostream) const |
Compute all distance from the current point to all half-spaces frontiers. More... | |
bool | checkGenerators (const listOfGeometricObjects< boost::shared_ptr< Generator_Rn > > &listGenA, const listOfGeometricObjects< boost::shared_ptr< HalfSpace_Rn > > &listHSB, bool check_all=false) const |
Check the number of facets per generator and make sure it is compliant with its current constraints. It must verify the following property : More... | |
double | checkVolumeEquality (const boost::shared_ptr< PolyhedralCone_Rn > &B) const |
void | removeGenerator (unsigned int j) |
Remove the generator number j from its list. More... | |
void | removeGenerators (const std::set< boost::shared_ptr< Generator_Rn > > &setToRemove) |
Remove the generators contained in setToRemove. More... | |
void | checkFacet (unsigned int fctNumber, std::ostream &this_ostream) const |
bool | checkFacets () const |
Detect redundant half spaces and make sure each facet has the right number of generators. More... | |
bool | checkEquality (const boost::shared_ptr< PolyhedralCone_Rn > &B, bool getFaceMapping=false) const |
void | getGeneratorsPerFacet (std::vector< std::vector< unsigned int > > &listOfGeneratorsPerFacet) const |
Get topological connections: for each facet, list its generators. More... | |
void | negate () |
Compute the symmetrical polyhedral cone. More... | |
boost::shared_ptr< PolyhedralCone_Rn > | computeDualPolyhedralCone () const |
Create the intersection edge in the truncating algorithm. It is defined by the intersection between a 2-face and a hyperplane, i.e. a (n-1)-face. The new egde is given by this formula where H is the current half space : More... | |
virtual void | dump (std::ostream &this_ostream) const |
Dump the polyhedral structure on the stream passed as an argument. More... | |
void | dumpScilab (std::ostream &this_ostream) const |
Dump the generators on on the stream passed as an argument for outputting in Scilab. More... | |
Static Public Member Functions | |
static boost::shared_ptr< Polytope_Rn > | create () |
Return s shared pointer on an empty polytope. More... | |
Additional Inherited Members | |
![]() | |
listOfGeometricObjects< boost::shared_ptr< HalfSpace_Rn > > | _listOfHalfSpaces |
The list of half-spaces defining the polyhedron. More... | |
listOfGeometricObjects< boost::shared_ptr< Generator_Rn > > | _listOfGenerators |
The convex hull of connected points. More... | |
Model a polytope using its two equivalent definitions : the convex hull and the half-space intersection.
Definition at line 36 of file Polytope_Rn.h.
|
inline |
Constructor for polytopes i.e. bounded convex polyhedra.
Definition at line 40 of file Polytope_Rn.h.
|
inlinevirtual |
Destructor.
Definition at line 43 of file Polytope_Rn.h.
|
virtual |
Always true in the polyhedral cone case.
Reimplemented from PolyhedralCone_Rn.
Definition at line 32 of file Polytope_Rn.cpp.
bool Polytope_Rn::checkEqualityOfVertices | ( | const boost::shared_ptr< Polytope_Rn > & | B, |
bool | printOnScreen = false |
||
) | const |
Check whether two V-polytopes are identical Check whether the sets of vertices of A and B are equal.
A | The V-polytope |
\[ \mathcal{V}_A = \mathcal{V}_B \]
, false otherwise.Definition at line 242 of file Polytope_Rn.cpp.
|
inlinestatic |
Return s shared pointer on an empty polytope.
Definition at line 46 of file Polytope_Rn.h.
|
virtual |
Initialize the truncating algorithm building a M-sized bounding box around the polytope.
When only the polytope facets are given, include it in a huge cube that we are going to truncate.
Reimplemented from PolyhedralCone_Rn.
Definition at line 154 of file Polytope_Rn.cpp.
|
virtual |
Initialize the truncating algorithm building a M-sized simplex around the polytope.
When only the polytope facets are given, include it in a huge simplex that we are going to truncate.
Reimplemented from PolyhedralCone_Rn.
Definition at line 79 of file Polytope_Rn.cpp.
|
virtual |
This is the intersection vertex in the truncating algorithm, defined by the intersection between an edge and an hyperplane.
This is the intersection vertex in the truncating algorithm. It is defined by the intersection between an edge, i.e. a 1-face, and an hyperplane, i.e. a (n-1)-face.
Reimplemented from PolyhedralCone_Rn.
Definition at line 226 of file Polytope_Rn.cpp.
|
inline |
Definition at line 146 of file Polytope_Rn.h.
|
inline |
Definition at line 144 of file Polytope_Rn.h.
boost::shared_ptr<PolyhedralCone_Rn> Polytope_Rn::getPrimalCone | ( | unsigned int | i | ) | const |
Return the i-th primal cone C(i) of the polytope A. If A has k vertices then \( A = \displaystyle{ \bigcap_{i=1}^k C(i) }\) where \( C(i) = \displaystyle{ \bigcap_{i=1}^l \bar{H}_i^+ } \)
boost::shared_ptr< PolyhedralCone_Rn > Polytope_Rn::getPrimalCone | ( | unsigned int | u, |
const std::vector< unsigned int > & | allNgb | ||
) | const |
boost::shared_ptr< Polytope_Rn > Polytope_Rn::intersect | ( | const boost::shared_ptr< Polytope_Rn > & | pol2intersect | ) |
|
inlinevirtual |
Tell whether this polyhedron is bounded or not, polytopes are bounded.
Reimplemented from PolyhedralCone_Rn.
Definition at line 49 of file Polytope_Rn.h.
|
inline |
|
inline |
|
inlinevirtual |
Two vertices are neighbours in a polytope <=> they share at least (n-1) facets.
Reimplemented from PolyhedralCone_Rn.
Definition at line 52 of file Polytope_Rn.h.
|
inlinevirtual |
Each facet in a polytope has got n vertices.
Reimplemented from PolyhedralCone_Rn.
Definition at line 55 of file Polytope_Rn.h.
boost::shared_ptr< Polytope_Rn > Polytope_Rn::sum | ( | const boost::shared_ptr< Polytope_Rn > & | pol2sum | ) |