Parma_Polyhedra_Library::C_Polyhedron Class Reference
[C++ Language Interface]

A closed convex polyhedron. More...

#include <C_Polyhedron.defs.hh>

Inheritance diagram for Parma_Polyhedra_Library::C_Polyhedron:
Inheritance graph
[legend]
Collaboration diagram for Parma_Polyhedra_Library::C_Polyhedron:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 C_Polyhedron (dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
 Builds either the universe or the empty C polyhedron.
 C_Polyhedron (const Constraint_System &cs)
 Builds a C polyhedron from a system of constraints.
 C_Polyhedron (Constraint_System &cs, Recycle_Input dummy)
 Builds a C polyhedron recycling a system of constraints.
 C_Polyhedron (const Generator_System &gs)
 Builds a C polyhedron from a system of generators.
 C_Polyhedron (Generator_System &gs, Recycle_Input dummy)
 Builds a C polyhedron recycling a system of generators.
 C_Polyhedron (const Congruence_System &cgs)
 Builds a C polyhedron from a system of congruences.
 C_Polyhedron (Congruence_System &cgs, Recycle_Input dummy)
 Builds a C polyhedron recycling a system of congruences.
 C_Polyhedron (const NNC_Polyhedron &y, Complexity_Class complexity=ANY_COMPLEXITY)
 Builds a C polyhedron representing the topological closure of the NNC polyhedron y.
template<typename Interval >
 C_Polyhedron (const Box< Interval > &box, Complexity_Class complexity=ANY_COMPLEXITY)
 Builds a C polyhedron out of a box.
template<typename U >
 C_Polyhedron (const BD_Shape< U > &bd, Complexity_Class complexity=ANY_COMPLEXITY)
 Builds a C polyhedron out of a BD shape.
template<typename U >
 C_Polyhedron (const Octagonal_Shape< U > &os, Complexity_Class complexity=ANY_COMPLEXITY)
 Builds a C polyhedron out of an octagonal shape.
 C_Polyhedron (const Grid &grid, Complexity_Class complexity=ANY_COMPLEXITY)
 Builds a C polyhedron out of a grid.
 C_Polyhedron (const C_Polyhedron &y, Complexity_Class complexity=ANY_COMPLEXITY)
 Ordinary copy constructor.
C_Polyhedronoperator= (const C_Polyhedron &y)
 The assignment operator. (*this and y can be dimension-incompatible.).
C_Polyhedronoperator= (const NNC_Polyhedron &y)
 Assigns to *this the topological closure of the NNC polyhedron y.
 ~C_Polyhedron ()
 Destructor.
bool poly_hull_assign_if_exact (const C_Polyhedron &y)
 If the poly-hull of *this and y is exact it is assigned to *this and true is returned, otherwise false is returned.
bool upper_bound_assign_if_exact (const C_Polyhedron &y)
 Same as poly_hull_assign_if_exact(y).

Detailed Description

A closed convex polyhedron.

An object of the class C_Polyhedron represents a topologically closed convex polyhedron in the vector space $\Rset^n$.

When building a closed polyhedron starting from a system of constraints, an exception is thrown if the system contains a strict inequality constraint. Similarly, an exception is thrown when building a closed polyhedron starting from a system of generators containing a closure point.

Note:
Such an exception will be obtained even if the system of constraints (resp., generators) actually defines a topologically closed subset of the vector space, i.e., even if all the strict inequalities (resp., closure points) in the system happen to be redundant with respect to the system obtained by removing all the strict inequality constraints (resp., all the closure points). In contrast, when building a closed polyhedron starting from an object of the class NNC_Polyhedron, the precise topological closure test will be performed.

Definition at line 59 of file C_Polyhedron.defs.hh.


Constructor & Destructor Documentation

Parma_Polyhedra_Library::C_Polyhedron::C_Polyhedron ( dimension_type  num_dimensions = 0,
Degenerate_Element  kind = UNIVERSE 
) [inline, explicit]

Builds either the universe or the empty C polyhedron.

Parameters:
num_dimensions The number of dimensions of the vector space enclosing the C polyhedron;
kind Specifies whether a universe or an empty C polyhedron should be built.
Exceptions:
std::length_error Thrown if num_dimensions exceeds the maximum allowed space dimension.

Both parameters are optional: by default, a 0-dimension space universe C polyhedron is built.

Definition at line 37 of file C_Polyhedron.inlines.hh.

00039   : Polyhedron(NECESSARILY_CLOSED,
00040                num_dimensions <= max_space_dimension()
00041                ? num_dimensions
00042                : (throw_space_dimension_overflow(NECESSARILY_CLOSED,
00043                                                  "C_Polyhedron(n, k)",
00044                                                  "n exceeds the maximum "
00045                                                  "allowed space dimension"),
00046                   num_dimensions),
00047                kind) {
00048 }

Parma_Polyhedra_Library::C_Polyhedron::C_Polyhedron ( const Constraint_System cs  )  [inline, explicit]

Builds a C polyhedron from a system of constraints.

The polyhedron inherits the space dimension of the constraint system.

Parameters:
cs The system of constraints defining the polyhedron.
Exceptions:
std::invalid_argument Thrown if the system of constraints contains strict inequalities.

Definition at line 51 of file C_Polyhedron.inlines.hh.

00052   : Polyhedron(NECESSARILY_CLOSED,
00053                cs.space_dimension() <= max_space_dimension()
00054                ? cs
00055                : (throw_space_dimension_overflow(NECESSARILY_CLOSED,
00056                                                  "C_Polyhedron(cs)",
00057                                                  "the space dimension of cs "
00058                                                  "exceeds the maximum allowed "
00059                                                  "space dimension"), cs)) {
00060 }

Parma_Polyhedra_Library::C_Polyhedron::C_Polyhedron ( Constraint_System cs,
Recycle_Input  dummy 
) [inline]

Builds a C polyhedron recycling a system of constraints.

The polyhedron inherits the space dimension of the constraint system.

Parameters:
cs The system of constraints defining the polyhedron. It is not declared const because its data-structures may be recycled to build the polyhedron.
dummy A dummy tag to syntactically differentiate this one from the other constructors.
Exceptions:
std::invalid_argument Thrown if the system of constraints contains strict inequalities.

Definition at line 63 of file C_Polyhedron.inlines.hh.

00064   : Polyhedron(NECESSARILY_CLOSED,
00065                cs.space_dimension() <= max_space_dimension()
00066                ? cs
00067                : (throw_space_dimension_overflow(NECESSARILY_CLOSED,
00068                                                  "C_Polyhedron(cs, recycle)",
00069                                                  "the space dimension of cs "
00070                                                  "exceeds the maximum allowed "
00071                                                  "space dimension"), cs),
00072                Recycle_Input()) {
00073 }

Parma_Polyhedra_Library::C_Polyhedron::C_Polyhedron ( const Generator_System gs  )  [inline, explicit]

Builds a C polyhedron from a system of generators.

The polyhedron inherits the space dimension of the generator system.

Parameters:
gs The system of generators defining the polyhedron.
Exceptions:
std::invalid_argument Thrown if the system of generators is not empty but has no points, or if it contains closure points.

Definition at line 76 of file C_Polyhedron.inlines.hh.

00077   : Polyhedron(NECESSARILY_CLOSED,
00078                gs.space_dimension() <= max_space_dimension()
00079                ? gs
00080                : (throw_space_dimension_overflow(NECESSARILY_CLOSED,
00081                                                  "C_Polyhedron(gs)",
00082                                                  "the space dimension of gs "
00083                                                  "exceeds the maximum allowed "
00084                                                  "space dimension"), gs)) {
00085 }

Parma_Polyhedra_Library::C_Polyhedron::C_Polyhedron ( Generator_System gs,
Recycle_Input  dummy 
) [inline]

Builds a C polyhedron recycling a system of generators.

The polyhedron inherits the space dimension of the generator system.

Parameters:
gs The system of generators defining the polyhedron. It is not declared const because its data-structures may be recycled to build the polyhedron.
dummy A dummy tag to syntactically differentiate this one from the other constructors.
Exceptions:
std::invalid_argument Thrown if the system of generators is not empty but has no points, or if it contains closure points.

Definition at line 88 of file C_Polyhedron.inlines.hh.

00089   : Polyhedron(NECESSARILY_CLOSED,
00090                gs.space_dimension() <= max_space_dimension()
00091                ? gs
00092                : (throw_space_dimension_overflow(NECESSARILY_CLOSED,
00093                                                  "C_Polyhedron(gs, recycle)",
00094                                                  "the space dimension of gs "
00095                                                  "exceeds the maximum allowed "
00096                                                  "space dimension"), gs),
00097                Recycle_Input()) {
00098 }

Parma_Polyhedra_Library::C_Polyhedron::C_Polyhedron ( const Congruence_System cgs  )  [explicit]

Builds a C polyhedron from a system of congruences.

The polyhedron inherits the space dimension of the congruence system.

Parameters:
cgs The system of congruences defining the polyhedron.

Definition at line 44 of file C_Polyhedron.cc.

References Parma_Polyhedra_Library::Polyhedron::add_congruences().

00045   : Polyhedron(NECESSARILY_CLOSED,
00046                cgs.space_dimension() <= max_space_dimension()
00047                ? cgs.space_dimension()
00048                : (throw_space_dimension_overflow(NECESSARILY_CLOSED,
00049                                                  "C_Polyhedron(cgs)",
00050                                                  "the space dimension of cgs "
00051                                                  "exceeds the maximum allowed "
00052                                                  "space dimension"), 0),
00053                UNIVERSE) {
00054   add_congruences(cgs);
00055 }

Parma_Polyhedra_Library::C_Polyhedron::C_Polyhedron ( Congruence_System cgs,
Recycle_Input  dummy 
)

Builds a C polyhedron recycling a system of congruences.

The polyhedron inherits the space dimension of the congruence system.

Parameters:
cgs The system of congruences defining the polyhedron. It is not declared const because its data-structures may be recycled to build the polyhedron.
dummy A dummy tag to syntactically differentiate this one from the other constructors.

Definition at line 57 of file C_Polyhedron.cc.

References Parma_Polyhedra_Library::Polyhedron::add_congruences().

00058   : Polyhedron(NECESSARILY_CLOSED,
00059                cgs.space_dimension() <= max_space_dimension()
00060                ? cgs.space_dimension()
00061                : (throw_space_dimension_overflow(NECESSARILY_CLOSED,
00062                                                  "NNC_Polyhedron"
00063                                                  "(cgs, recycle)",
00064                                                  "the space dimension of cgs "
00065                                                  "exceeds the maximum allowed "
00066                                                  "space dimension"), 0),
00067                UNIVERSE) {
00068   add_congruences(cgs);
00069 }

Parma_Polyhedra_Library::C_Polyhedron::C_Polyhedron ( const NNC_Polyhedron y,
Complexity_Class  complexity = ANY_COMPLEXITY 
) [explicit]

Builds a C polyhedron representing the topological closure of the NNC polyhedron y.

Parameters:
y The NNC polyhedron to be used;
complexity This argument is ignored.

Definition at line 33 of file C_Polyhedron.cc.

References Parma_Polyhedra_Library::Polyhedron::add_constraint(), Parma_Polyhedra_Library::Constraint_System::begin(), Parma_Polyhedra_Library::Polyhedron::constraints(), Parma_Polyhedra_Library::Constraint_System::end(), Parma_Polyhedra_Library::Constraint::is_strict_inequality(), and Parma_Polyhedra_Library::Polyhedron::OK().

00034   : Polyhedron(NECESSARILY_CLOSED, y.space_dimension(), UNIVERSE) {
00035   const Constraint_System& cs = y.constraints();
00036   for (Constraint_System::const_iterator i = cs.begin(),
00037          cs_end = cs.end(); i != cs_end; ++i) {
00038     const Constraint& c = *i;
00039     add_constraint(c.is_strict_inequality() ? (Linear_Expression(c) >= 0) : c);
00040   }
00041   PPL_ASSERT_HEAVY(OK());
00042 }

template<typename Interval >
Parma_Polyhedra_Library::C_Polyhedron::C_Polyhedron ( const Box< Interval > &  box,
Complexity_Class  complexity = ANY_COMPLEXITY 
) [inline, explicit]

Builds a C polyhedron out of a box.

The polyhedron inherits the space dimension of the box and is the most precise that includes the box. The algorithm used has polynomial complexity.

Parameters:
box The box representing the polyhedron to be approximated;
complexity This argument is ignored.
Exceptions:
std::length_error Thrown if the space dimension of box exceeds the maximum allowed space dimension.

Definition at line 102 of file C_Polyhedron.inlines.hh.

00103   : Polyhedron(NECESSARILY_CLOSED,
00104                box.space_dimension() <= max_space_dimension()
00105                ? box
00106                : (throw_space_dimension_overflow(NECESSARILY_CLOSED,
00107                                                  "C_Polyhedron(box): ",
00108                                                  "the space dimension of box "
00109                                                  "exceeds the maximum allowed "
00110                                                  "space dimension"), box)) {
00111 }

template<typename U >
Parma_Polyhedra_Library::C_Polyhedron::C_Polyhedron ( const BD_Shape< U > &  bd,
Complexity_Class  complexity = ANY_COMPLEXITY 
) [inline, explicit]

Builds a C polyhedron out of a BD shape.

The polyhedron inherits the space dimension of the BDS and is the most precise that includes the BDS.

Parameters:
bd The BDS used to build the polyhedron.
complexity This argument is ignored as the algorithm used has polynomial complexity.

Definition at line 115 of file C_Polyhedron.inlines.hh.

References Parma_Polyhedra_Library::Polyhedron::add_constraints(), and Parma_Polyhedra_Library::BD_Shape< T >::constraints().

00116   : Polyhedron(NECESSARILY_CLOSED,
00117                bd.space_dimension() <= max_space_dimension()
00118                ? bd.space_dimension()
00119                : (throw_space_dimension_overflow(NECESSARILY_CLOSED,
00120                                                  "C_Polyhedron(bd): ",
00121                                                  "the space dimension of bd "
00122                                                  "exceeds the maximum allowed "
00123                                                  "space dimension"), 0),
00124                UNIVERSE) {
00125   add_constraints(bd.constraints());
00126 }

template<typename U >
Parma_Polyhedra_Library::C_Polyhedron::C_Polyhedron ( const Octagonal_Shape< U > &  os,
Complexity_Class  complexity = ANY_COMPLEXITY 
) [inline, explicit]

Builds a C polyhedron out of an octagonal shape.

The polyhedron inherits the space dimension of the octagonal shape and is the most precise that includes the octagonal shape.

Parameters:
os The octagonal shape used to build the polyhedron.
complexity This argument is ignored as the algorithm used has polynomial complexity.

Definition at line 130 of file C_Polyhedron.inlines.hh.

References Parma_Polyhedra_Library::Polyhedron::add_constraints(), and Parma_Polyhedra_Library::Octagonal_Shape< T >::constraints().

00131   : Polyhedron(NECESSARILY_CLOSED,
00132                os.space_dimension() <= max_space_dimension()
00133                ? os.space_dimension()
00134                : (throw_space_dimension_overflow(NECESSARILY_CLOSED,
00135                                                  "C_Polyhedron(os): ",
00136                                                  "the space dimension of os "
00137                                                  "exceeds the maximum allowed "
00138                                                  "space dimension"), 0),
00139                UNIVERSE) {
00140   add_constraints(os.constraints());
00141 }

Parma_Polyhedra_Library::C_Polyhedron::C_Polyhedron ( const Grid grid,
Complexity_Class  complexity = ANY_COMPLEXITY 
) [explicit]

Builds a C polyhedron out of a grid.

The polyhedron inherits the space dimension of the grid and is the most precise that includes the grid.

Parameters:
grid The grid used to build the polyhedron.
complexity This argument is ignored as the algorithm used has polynomial complexity.

Definition at line 71 of file C_Polyhedron.cc.

References Parma_Polyhedra_Library::Polyhedron::add_constraints(), and Parma_Polyhedra_Library::Grid::constraints().

00072   : Polyhedron(NECESSARILY_CLOSED,
00073                grid.space_dimension() <= max_space_dimension()
00074                ? grid.space_dimension()
00075                : (throw_space_dimension_overflow(NECESSARILY_CLOSED,
00076                                                  "C_Polyhedron(grid)",
00077                                                  "the space dimension of grid "
00078                                                  "exceeds the maximum allowed "
00079                                                  "space dimension"), 0),
00080                UNIVERSE) {
00081   add_constraints(grid.constraints());
00082 }

Parma_Polyhedra_Library::C_Polyhedron::C_Polyhedron ( const C_Polyhedron y,
Complexity_Class  complexity = ANY_COMPLEXITY 
) [inline]

Ordinary copy constructor.

The complexity argument is ignored.

Definition at line 144 of file C_Polyhedron.inlines.hh.

00145   : Polyhedron(y) {
00146 }

Parma_Polyhedra_Library::C_Polyhedron::~C_Polyhedron (  )  [inline]

Destructor.

Definition at line 33 of file C_Polyhedron.inlines.hh.

00033                             {
00034 }


Member Function Documentation

C_Polyhedron & Parma_Polyhedra_Library::C_Polyhedron::operator= ( const NNC_Polyhedron y  )  [inline]

Assigns to *this the topological closure of the NNC polyhedron y.

Definition at line 155 of file C_Polyhedron.inlines.hh.

References Parma_Polyhedra_Library::Polyhedron::swap().

00155                                                {
00156   C_Polyhedron c_y(y);
00157   swap(c_y);
00158   return *this;
00159 }

C_Polyhedron & Parma_Polyhedra_Library::C_Polyhedron::operator= ( const C_Polyhedron y  )  [inline]

The assignment operator. (*this and y can be dimension-incompatible.).

Definition at line 149 of file C_Polyhedron.inlines.hh.

00149                                              {
00150   Polyhedron::operator=(y);
00151   return *this;
00152 }

bool Parma_Polyhedra_Library::C_Polyhedron::poly_hull_assign_if_exact ( const C_Polyhedron y  ) 

If the poly-hull of *this and y is exact it is assigned to *this and true is returned, otherwise false is returned.

Exceptions:
std::invalid_argument Thrown if *this and y are dimension-incompatible.

Definition at line 85 of file C_Polyhedron.cc.

References Parma_Polyhedra_Library::Polyhedron::BFT00_poly_hull_assign_if_exact(), Parma_Polyhedra_Library::Polyhedron::BHZ09_poly_hull_assign_if_exact(), Parma_Polyhedra_Library::Polyhedron::space_dimension(), and Parma_Polyhedra_Library::Polyhedron::throw_dimension_incompatible().

Referenced by upper_bound_assign_if_exact().

00085                                                                 {
00086   // Dimension-compatibility check.
00087   if (space_dimension() != y.space_dimension())
00088     throw_dimension_incompatible("poly_hull_assign_if_exact(y)", "y", y);
00089 #define USE_BHZ09 0
00090 #define USE_BFT00 1
00091 #if USE_BHZ09 // [BagnaraHZ09]
00092   return BHZ09_poly_hull_assign_if_exact(y);
00093 #elif USE_BFT00 // [BemporadFT00TR].
00094   return BFT00_poly_hull_assign_if_exact(y);
00095 #else // Old implementation.
00096   return PPL::poly_hull_assign_if_exact(*this, y);
00097 #endif
00098 #undef USE_BHZ09
00099 #undef USE_BFT00
00100 }

bool Parma_Polyhedra_Library::C_Polyhedron::upper_bound_assign_if_exact ( const C_Polyhedron y  )  [inline]

Same as poly_hull_assign_if_exact(y).

Definition at line 162 of file C_Polyhedron.inlines.hh.

References poly_hull_assign_if_exact().

00162                                                                {
00163   return poly_hull_assign_if_exact(y);
00164 }


The documentation for this class was generated from the following files:
Generated on Sun Feb 27 16:20:28 2011 for PPL by  doxygen 1.6.3