politopix
4.1.0
|
Model a polyhedral cone using its two equivalent definitions : the convex hull and the half-space intersection. We store its edges in _listOfHS and the positive combination of these vectors generates the polyhedral cone. More...
#include <PolyhedralCone_Rn.h>
Public Member Functions | |
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... | |
virtual bool | isBounded () const |
Tell whether this polyhedron is bounded or not, polyhedral cones are not. More... | |
virtual unsigned int | neigbourhoodCondition () const |
Two edges are neighbours in a polyhedral cone <=> they share at least (n-2) facets. More... | |
virtual unsigned int | numberOfGeneratorsPerFacet () const |
Each facet in a polyhedral cone has got (n-1) edges. 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) throw (std::invalid_argument) |
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 throw (std::out_of_range) |
For a given half-space, return its list index. More... | |
const boost::shared_ptr < HalfSpace_Rn > & | getHalfSpace (unsigned int i) const throw (std::out_of_range) |
Return the i-th generator. 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... | |
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 throw (std::out_of_range) |
Return the i-th generator. More... | |
unsigned int | getGeneratorNumber (boost::shared_ptr< Generator_Rn > G) const throw (std::out_of_range,std::invalid_argument) |
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) |
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 throw (std::invalid_argument) |
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 throw (std::invalid_argument) |
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 throw (std::invalid_argument) |
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) |
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 throw (std::invalid_argument) |
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 throw (std::out_of_range) |
virtual bool | checkTopologyAndGeometry () 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 | 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 throw (std::out_of_range) |
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... | |
void | removeGenerator (unsigned int j) |
Remove the generator number j from its list. More... | |
virtual bool | checkEdges () const |
Always true in the polyhedral cone case. More... | |
void | checkFacet (unsigned int fctNumber, std::ostream &this_ostream) const throw (std::out_of_range) |
bool | checkFacets () const |
Detect redundant half spaces and make sure each facet has the right number of generators.
Check that the polytope does not have generators violating a constraint defined by a half-space.
Check that the polytope does have at least (n-1) generators per half-space frontier.
. More... | |
bool | checkEquality (const boost::shared_ptr< PolyhedralCone_Rn > &B, bool getFaceMapping=false) const |
void | negate () |
Compute the symmetrical polyhedral cone. More... | |
virtual void | createTruncatedGenerator (const boost::shared_ptr< Generator_Rn_SD > &y, const boost::shared_ptr< Generator_Rn_SD > &z, boost::shared_ptr< Generator_Rn_SD > newG, double ay, double az, double b=0.) 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... | |
boost::shared_ptr < PolyhedralCone_Rn > | computeDualPolyhedralCone () const |
Build the dual polyhedral cone of the current one whose edge are orthogonal to the primal and vice-versa. More... | |
virtual void | computeMinkowskiSum (const boost::shared_ptr< PolyhedralCone_Rn > &A, const boost::shared_ptr< PolyhedralCone_Rn > &B) |
Compute the Minkowski sum of two polyhedral cones. More... | |
void | dump (std::ostream &this_ostream) const |
Dump the polyhedral structure on std::cout. More... | |
virtual void | createBoundingBox (double) |
At the moment this function is useless in the case of polyhedral cones. More... | |
virtual void | createBoundingSimplex (double) |
At the moment this function is useless in the case of polyhedral cones. More... | |
Protected Attributes | |
listOfGeometricObjects < boost::shared_ptr < HalfSpace_Rn > > | _listOfHalfSpaces |
The list of half-spaces defining the polytope. More... | |
listOfGeometricObjects < boost::shared_ptr < Generator_Rn > > | _listOfGenerators |
The convex hull of connected points. More... | |
Friends | |
class | lexIteratorOfListOfHalfSpaces |
class | constIteratorOfListOfHalfSpaces |
Model a polyhedral cone using its two equivalent definitions : the convex hull and the half-space intersection. We store its edges in _listOfHS and the positive combination of these vectors generates the polyhedral cone.
Definition at line 45 of file PolyhedralCone_Rn.h.
|
inline |
Constructor.
Definition at line 51 of file PolyhedralCone_Rn.h.
|
inline |
Constructor.
Definition at line 54 of file PolyhedralCone_Rn.h.
|
inlinevirtual |
Destructor.
Definition at line 60 of file PolyhedralCone_Rn.h.
|
inline |
Add the given generator.
Definition at line 139 of file PolyhedralCone_Rn.h.
boost::shared_ptr< HalfSpace_Rn > PolyhedralCone_Rn::addHalfSpace | ( | boost::shared_ptr< HalfSpace_Rn > | hs, |
bool | check = false |
||
) |
Add the current half-space in its list.
Definition at line 137 of file PolyhedralCone_Rn.cpp.
bool PolyhedralCone_Rn::checkDuplicateGenerators | ( | unsigned int & | a, |
unsigned int & | b | ||
) |
Make sure no duplicate generators are stored.
a | in case of equality store in this parameter the index of the first equal generator |
b | in case of equality store in this parameter the index of the second equal generator |
Definition at line 70 of file PolyhedralCone_Rn.cpp.
|
inlinevirtual |
Always true in the polyhedral cone case.
Reimplemented in Polytope_Rn.
Definition at line 518 of file PolyhedralCone_Rn.h.
bool PolyhedralCone_Rn::checkEquality | ( | const boost::shared_ptr< PolyhedralCone_Rn > & | B, |
bool | getFaceMapping = false |
||
) | const |
Check whether the current polyhedral cones and B are equal or not. If the last variable is true, print the mapping between the generators and faces of both polyhedral cones.
Definition at line 401 of file PolyhedralCone_Rn.cpp.
|
inline |
|
inline |
Detect redundant half spaces and make sure each facet has the right number of generators.
Check that the polytope does not have generators violating a constraint defined by a half-space.
Check that the polytope does have at least (n-1) generators per half-space frontier.
.
Definition at line 582 of file PolyhedralCone_Rn.h.
|
inline |
Compute all distance from the current point to all half-spaces frontiers.
Definition at line 424 of file PolyhedralCone_Rn.h.
|
inline |
Check the number of facets per generator and make sure it is compliant with its current constraints. It must verify the following property :
.
Definition at line 462 of file PolyhedralCone_Rn.h.
|
inline |
Check for polytopes that vertices share (n-1) facets. For polyhedral cones, it must check that vectors share (n-2) facets.
V1 | the first vertex to check |
V2 | the second vertex to check |
commonFacets | the set of common facets between V1 and V2 |
listOfRedundantHS | the set of half-spaces that will not be taken into account to compute commonFacets |
Definition at line 215 of file PolyhedralCone_Rn.h.
|
inline |
Check for polytopes that vertices share (n-1) facets. For polyhedral cones, it must check that vectors share (n-2) facets.
V1 | the first vertex to check |
V2 | the second vertex to check |
commonFacets | the set of common facets between V1 and V2 |
topologicalCode | model the level of neighborhood: 1 for an edge, ..., (n-1) for a facet in a n-dimensional space |
Definition at line 246 of file PolyhedralCone_Rn.h.
|
inline |
Check for polytopes that vertices share (n-1) facets. For polyhedral cones, it must check that vectors share (n-2) facets.
V1 | the first vertex to check |
V2 | the second vertex to check |
commonFacets | the list of common facets between V1 and V2 |
topologicalCode | model the level of neighborhood: 1 for an edge, ..., (n-1) for a facet in a n-dimensional space |
Definition at line 273 of file PolyhedralCone_Rn.h.
|
inline |
Check for polytopes that vertices share (n-1) facets. For polyhedral cones, it must check that vectors share (n-2) facets.
genIn | the first vertex to check |
genOut | the second vertex to check |
commonFacets | the list of common facets indices between genIn and genOut |
Definition at line 299 of file PolyhedralCone_Rn.h.
|
inline |
Check for polytopes that vertices share (n-1) facets. For polyhedral cones, it must check that vectors share (n-2) facets.
V1 | the first vertex to check |
V2 | the second vertex to check |
commonFacets | the list of common facets between V1 and V2 |
listOfRedundantHS | the list of facets to ignore when we process V1 and V2 |
topologicalCode | model the level of neighborhood: 1 for an edge, ..., (n-1) for a facet in a n-dimensional space |
Definition at line 321 of file PolyhedralCone_Rn.h.
HalfSpace_Rn::State PolyhedralCone_Rn::checkPoint | ( | const Point_Rn & | thisPoint | ) | const |
Check a point state against the whole polyhedron.
Definition at line 29 of file PolyhedralCone_Rn.cpp.
HalfSpace_Rn::State PolyhedralCone_Rn::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.
Definition at line 47 of file PolyhedralCone_Rn.cpp.
|
inlinevirtual |
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 :
Definition at line 393 of file PolyhedralCone_Rn.h.
boost::shared_ptr< PolyhedralCone_Rn > PolyhedralCone_Rn::computeDualPolyhedralCone | ( | ) | const |
Build the dual polyhedral cone of the current one whose edge are orthogonal to the primal and vice-versa.
Definition at line 285 of file PolyhedralCone_Rn.cpp.
|
virtual |
Compute the Minkowski sum of two polyhedral cones.
Definition at line 280 of file PolyhedralCone_Rn.cpp.
|
inlinevirtual |
At the moment this function is useless in the case of polyhedral cones.
Reimplemented in Polytope_Rn.
Definition at line 656 of file PolyhedralCone_Rn.h.
|
inlinevirtual |
At the moment this function is useless in the case of polyhedral cones.
Reimplemented in Polytope_Rn.
Definition at line 659 of file PolyhedralCone_Rn.h.
|
virtual |
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 :
.
y | The generator outside the current half-space ![]() |
z | The generator inside the current half-space ![]() |
newG | The new generator is the intersection between the 2-face created by y and z, and the current halfspace hyperplane |
ay | Scalar product ![]() |
az | Scalar product ![]() |
b | Half-space constant, null in the polyhedral cone case. |
Reimplemented in Polytope_Rn.
Definition at line 342 of file PolyhedralCone_Rn.cpp.
|
inlinevirtual |
Return the space dimension.
Definition at line 63 of file PolyhedralCone_Rn.h.
void PolyhedralCone_Rn::dump | ( | std::ostream & | this_ostream | ) | const |
Dump the polyhedral structure on std::cout.
Definition at line 223 of file PolyhedralCone_Rn.cpp.
|
inline |
Compute and store all neighborhood relations between generators.
neighboursA | a sparse matrix where each line models a generator |
topologicalCode | model the level of neighborhood: 1 for an edge, ..., (n-1) for a facet in a n-dimensional space |
Definition at line 348 of file PolyhedralCone_Rn.h.
const boost::shared_ptr< Generator_Rn > & PolyhedralCone_Rn::getGenerator | ( | unsigned int | i | ) | const |
throw | ( | std::out_of_range | |||
) |
Return the i-th generator.
Definition at line 190 of file PolyhedralCone_Rn.cpp.
unsigned int PolyhedralCone_Rn::getGeneratorNumber | ( | boost::shared_ptr< Generator_Rn > | G | ) | const |
throw | ( | std::out_of_range, | |||
std::invalid_argument | |||||
) |
For a given generator, return its list index.
Definition at line 199 of file PolyhedralCone_Rn.cpp.
const boost::shared_ptr< HalfSpace_Rn > & PolyhedralCone_Rn::getHalfSpace | ( | unsigned int | i | ) | const |
throw | ( | std::out_of_range | |||
) |
Return the i-th generator.
Definition at line 159 of file PolyhedralCone_Rn.cpp.
|
inline |
For a given half-space, return its list index.
Definition at line 110 of file PolyhedralCone_Rn.h.
|
inline |
Return the list of generators.
Definition at line 148 of file PolyhedralCone_Rn.h.
|
inline |
|
inline |
Return the list of half-spaces.
Definition at line 127 of file PolyhedralCone_Rn.h.
|
inline |
Return the list of half-spaces.
Definition at line 130 of file PolyhedralCone_Rn.h.
|
inlinevirtual |
Tell whether this polyhedron is bounded or not, polyhedral cones are not.
Reimplemented in Polytope_Rn.
Definition at line 79 of file PolyhedralCone_Rn.h.
bool PolyhedralCone_Rn::isIncluded | ( | const boost::shared_ptr< PolyhedralCone_Rn > & | B | ) | const |
Test whether the current polytope V-description is inside the polytope B H-description.
B | The H-polytope |
Definition at line 359 of file PolyhedralCone_Rn.cpp.
|
inline |
Compute the symmetrical polyhedral cone.
Definition at line 627 of file PolyhedralCone_Rn.h.
|
inlinevirtual |
Two edges are neighbours in a polyhedral cone <=> they share at least (n-2) facets.
Reimplemented in Polytope_Rn.
Definition at line 82 of file PolyhedralCone_Rn.h.
|
inline |
Give the total number of generators.
Definition at line 136 of file PolyhedralCone_Rn.h.
|
inlinevirtual |
Each facet in a polyhedral cone has got (n-1) edges.
Reimplemented in Polytope_Rn.
Definition at line 85 of file PolyhedralCone_Rn.h.
|
inline |
Get the total number of half-spaces.
Definition at line 93 of file PolyhedralCone_Rn.h.
void PolyhedralCone_Rn::relocateGenerators | ( | ) |
|
inline |
Remove the generator number j from its list.
Definition at line 515 of file PolyhedralCone_Rn.h.
|
inline |
Remove the half-space number j from its list.
Definition at line 102 of file PolyhedralCone_Rn.h.
void PolyhedralCone_Rn::removeHalfSpaceFromListAndGenerators | ( | const boost::shared_ptr< HalfSpace_Rn > & | hs | ) | |
throw | ( | std::invalid_argument | |||
) |
Remove the half-space given as parameter from its list and from all generators.
Definition at line 168 of file PolyhedralCone_Rn.cpp.
|
inline |
Remove the half-space number j from its list.
Definition at line 105 of file PolyhedralCone_Rn.h.
|
inline |
Remove all half-spaces and generators.
Definition at line 88 of file PolyhedralCone_Rn.h.
|
inline |
Set a new list of generators.
Definition at line 204 of file PolyhedralCone_Rn.h.
|
inline |
Set a new list of generators. The list of half-spaces should have been previously set.
Definition at line 168 of file PolyhedralCone_Rn.h.
|
friend |
Definition at line 47 of file PolyhedralCone_Rn.h.
|
friend |
Definition at line 46 of file PolyhedralCone_Rn.h.
|
protected |
The convex hull of connected points.
Definition at line 665 of file PolyhedralCone_Rn.h.
|
protected |
The list of half-spaces defining the polytope.
Definition at line 663 of file PolyhedralCone_Rn.h.