PPL  0.12.1
Parma_Polyhedra_Library::C_Polyhedron Class Reference

A closed convex polyhedron. More...

#include <C_Polyhedron.defs.hh>

Inheritance diagram for Parma_Polyhedra_Library::C_Polyhedron:
Collaboration diagram for Parma_Polyhedra_Library::C_Polyhedron:

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

Builds either the universe or the empty C polyhedron.

Parameters:
num_dimensionsThe number of dimensions of the vector space enclosing the C polyhedron;
kindSpecifies whether a universe or an empty C polyhedron should be built.
Exceptions:
std::length_errorThrown 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.

  : Polyhedron(NECESSARILY_CLOSED,
               check_space_dimension_overflow(num_dimensions,
                                              NECESSARILY_CLOSED,
                                              "C_Polyhedron(n, k)",
                                              "n exceeds the maximum "
                                              "allowed space dimension"),
               kind) {
}

Builds a C polyhedron from a system of constraints.

The polyhedron inherits the space dimension of the constraint system.

Parameters:
csThe system of constraints defining the polyhedron.
Exceptions:
std::invalid_argumentThrown if the system of constraints contains strict inequalities.

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

  : Polyhedron(NECESSARILY_CLOSED,
               check_obj_space_dimension_overflow(cs, NECESSARILY_CLOSED,
                                                  "C_Polyhedron(cs)",
                                                  "the space dimension of cs "
                                                  "exceeds the maximum allowed "
                                                  "space dimension")) {
}

Builds a C polyhedron recycling a system of constraints.

The polyhedron inherits the space dimension of the constraint system.

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

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

  : Polyhedron(NECESSARILY_CLOSED,
               check_obj_space_dimension_overflow(cs, NECESSARILY_CLOSED,
                                                  "C_Polyhedron(cs, recycle)",
                                                  "the space dimension of cs "
                                                  "exceeds the maximum allowed "
                                                  "space dimension"),
               Recycle_Input()) {
}

Builds a C polyhedron from a system of generators.

The polyhedron inherits the space dimension of the generator system.

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

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

  : Polyhedron(NECESSARILY_CLOSED,
               check_obj_space_dimension_overflow(gs, NECESSARILY_CLOSED,
                                                  "C_Polyhedron(gs)",
                                                  "the space dimension of gs "
                                                  "exceeds the maximum allowed "
                                                  "space dimension")) {
}

Builds a C polyhedron recycling a system of generators.

The polyhedron inherits the space dimension of the generator system.

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

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

  : Polyhedron(NECESSARILY_CLOSED,
               check_obj_space_dimension_overflow(gs, NECESSARILY_CLOSED,
                                                  "C_Polyhedron(gs, recycle)",
                                                  "the space dimension of gs "
                                                  "exceeds the maximum allowed "
                                                  "space dimension"),
               Recycle_Input()) {
}

Builds a C polyhedron from a system of congruences.

The polyhedron inherits the space dimension of the congruence system.

Parameters:
cgsThe system of congruences defining the polyhedron.

Definition at line 43 of file C_Polyhedron.cc.

References Parma_Polyhedra_Library::Polyhedron::add_congruences().

  : Polyhedron(NECESSARILY_CLOSED,
               check_space_dimension_overflow(cgs.space_dimension(),
                                              NECESSARILY_CLOSED,
                                              "C_Polyhedron(cgs)",
                                              "the space dimension of cgs "
                                              "exceeds the maximum allowed "
                                              "space dimension"),
               UNIVERSE) {
  add_congruences(cgs);
}

Builds a C polyhedron recycling a system of congruences.

The polyhedron inherits the space dimension of the congruence system.

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

Definition at line 55 of file C_Polyhedron.cc.

References Parma_Polyhedra_Library::Polyhedron::add_congruences().

  : Polyhedron(NECESSARILY_CLOSED,
               check_space_dimension_overflow(cgs.space_dimension(),
                                              NECESSARILY_CLOSED,
                                              "C_Polyhedron(cgs, recycle)",
                                              "the space dimension of cgs "
                                              "exceeds the maximum allowed "
                                              "space dimension"),
               UNIVERSE) {
  add_congruences(cgs);
}

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

Parameters:
yThe NNC polyhedron to be used;
complexityThis argument is ignored.

Definition at line 32 of file C_Polyhedron.cc.

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

  : Polyhedron(NECESSARILY_CLOSED, y.space_dimension(), UNIVERSE) {
  const Constraint_System& cs = y.constraints();
  for (Constraint_System::const_iterator i = cs.begin(),
         cs_end = cs.end(); i != cs_end; ++i) {
    const Constraint& c = *i;
    add_constraint(c.is_strict_inequality() ? (Linear_Expression(c) >= 0) : c);
  }
  PPL_ASSERT_HEAVY(OK());
}
template<typename Interval >
Parma_Polyhedra_Library::C_Polyhedron::C_Polyhedron ( const Box< Interval > &  box,
Complexity_Class  complexity = ANY_COMPLEXITY 
)
inlineexplicit

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:
boxThe box representing the polyhedron to be approximated;
complexityThis argument is ignored.
Exceptions:
std::length_errorThrown if the space dimension of box exceeds the maximum allowed space dimension.

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

  : Polyhedron(NECESSARILY_CLOSED,
               check_obj_space_dimension_overflow(box, NECESSARILY_CLOSED,
                                                  "C_Polyhedron(box)",
                                                  "the space dimension of box "
                                                  "exceeds the maximum allowed "
                                                  "space dimension")) {
}
template<typename U >
Parma_Polyhedra_Library::C_Polyhedron::C_Polyhedron ( const BD_Shape< U > &  bd,
Complexity_Class  complexity = ANY_COMPLEXITY 
)
inlineexplicit

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:
bdThe BDS used to build the polyhedron.
complexityThis argument is ignored as the algorithm used has polynomial complexity.

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

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

  : Polyhedron(NECESSARILY_CLOSED,
               check_space_dimension_overflow(bd.space_dimension(),
                                              NECESSARILY_CLOSED,
                                              "C_Polyhedron(bd)",
                                              "the space dimension of bd "
                                              "exceeds the maximum allowed "
                                              "space dimension"),
               UNIVERSE) {
  add_constraints(bd.constraints());
}
template<typename U >
Parma_Polyhedra_Library::C_Polyhedron::C_Polyhedron ( const Octagonal_Shape< U > &  os,
Complexity_Class  complexity = ANY_COMPLEXITY 
)
inlineexplicit

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:
osThe octagonal shape used to build the polyhedron.
complexityThis argument is ignored as the algorithm used has polynomial complexity.

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

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

  : Polyhedron(NECESSARILY_CLOSED,
               check_space_dimension_overflow(os.space_dimension(),
                                              NECESSARILY_CLOSED,
                                              "C_Polyhedron(os)",
                                              "the space dimension of os "
                                              "exceeds the maximum allowed "
                                              "space dimension"),
               UNIVERSE) {
  add_constraints(os.constraints());
}

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:
gridThe grid used to build the polyhedron.
complexityThis argument is ignored as the algorithm used has polynomial complexity.

Definition at line 67 of file C_Polyhedron.cc.

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

  : Polyhedron(NECESSARILY_CLOSED,
               check_space_dimension_overflow(grid.space_dimension(),
                                              NECESSARILY_CLOSED,
                                              "C_Polyhedron(grid)",
                                              "the space dimension of grid "
                                              "exceeds the maximum allowed "
                                              "space dimension"),
               UNIVERSE) {
  add_constraints(grid.constraints());
}

Ordinary copy constructor.

The complexity argument is ignored.

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

  : Polyhedron(y) {
}

Destructor.

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

                            {
}

Member Function Documentation

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 135 of file C_Polyhedron.inlines.hh.

                                             {
  Polyhedron::operator=(y);
  return *this;
}
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 141 of file C_Polyhedron.inlines.hh.

References Parma_Polyhedra_Library::Polyhedron::m_swap().

                                               {
  C_Polyhedron c_y(y);
  m_swap(c_y);
  return *this;
}

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_argumentThrown if *this and y are dimension-incompatible.

Definition at line 80 of file C_Polyhedron.cc.

References Parma_Polyhedra_Library::Polyhedron::space_dimension().

Referenced by upper_bound_assign_if_exact().

                                                                {
  // Dimension-compatibility check.
  if (space_dimension() != y.space_dimension())
    throw_dimension_incompatible("poly_hull_assign_if_exact(y)", "y", y);
#define USE_BHZ09 0
#define USE_BFT00 1
#if USE_BHZ09 // [BagnaraHZ09]
  return BHZ09_poly_hull_assign_if_exact(y);
#elif USE_BFT00 // [BemporadFT00TR].
  return BFT00_poly_hull_assign_if_exact(y);
#else // Old implementation.
  return PPL::poly_hull_assign_if_exact(*this, y);
#endif
#undef USE_BHZ09
#undef USE_BFT00
}

Same as poly_hull_assign_if_exact(y).

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

References poly_hull_assign_if_exact().

                                                               {
  return poly_hull_assign_if_exact(y);
}

The documentation for this class was generated from the following files: