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

A convergence certificate for the H79 widening operator. More...

#include <H79_Certificate.defs.hh>

List of all members.

Classes

struct  Compare
 A total ordering on H79 certificates. More...

Public Member Functions

 H79_Certificate ()
 Default constructor.
template<typename PH >
 H79_Certificate (const PH &ph)
 Constructor: computes the certificate for ph.
 H79_Certificate (const Polyhedron &ph)
 Constructor: computes the certificate for ph.
 H79_Certificate (const H79_Certificate &y)
 Copy constructor.
 ~H79_Certificate ()
 Destructor.
int compare (const H79_Certificate &y) const
 The comparison function for certificates.
template<typename PH >
int compare (const PH &ph) const
 Compares *this with the certificate for polyhedron ph.
int compare (const Polyhedron &ph) const
 Compares *this with the certificate for polyhedron ph.

Private Attributes

dimension_type affine_dim
 Affine dimension of the polyhedron.
dimension_type num_constraints
 Cardinality of a non-redundant constraint system for the polyhedron.

Detailed Description

A convergence certificate for the H79 widening operator.

Convergence certificates are used to instantiate the BHZ03 framework so as to define widening operators for the finite powerset domain.

Note:
The convergence of the H79 widening can also be certified by BHRZ03_Certificate.

Definition at line 41 of file H79_Certificate.defs.hh.


Constructor & Destructor Documentation

Parma_Polyhedra_Library::H79_Certificate::H79_Certificate (  )  [inline]

Default constructor.

Definition at line 32 of file H79_Certificate.inlines.hh.

00033   : affine_dim(0), num_constraints(0) {
00034   // This is the certificate for a zero-dim universe polyhedron.
00035 }

template<typename PH >
Parma_Polyhedra_Library::H79_Certificate::H79_Certificate ( const PH &  ph  )  [inline]

Constructor: computes the certificate for ph.

Definition at line 56 of file H79_Certificate.inlines.hh.

References affine_dim, Parma_Polyhedra_Library::NECESSARILY_CLOSED, and num_constraints.

00057   : affine_dim(0), num_constraints(0) {
00058   H79_Certificate cert(Polyhedron(NECESSARILY_CLOSED, ph.constraints()));
00059   affine_dim = cert.affine_dim;
00060   num_constraints = cert.num_constraints;
00061 }

Parma_Polyhedra_Library::H79_Certificate::H79_Certificate ( const Polyhedron ph  ) 

Constructor: computes the certificate for ph.

Definition at line 35 of file H79_Certificate.cc.

References affine_dim, Parma_Polyhedra_Library::Constraint_System::begin(), Parma_Polyhedra_Library::Constraint_System::end(), Parma_Polyhedra_Library::Polyhedron::is_necessarily_closed(), Parma_Polyhedra_Library::Polyhedron::marked_empty(), Parma_Polyhedra_Library::Polyhedron::minimize(), Parma_Polyhedra_Library::Polyhedron::minimized_constraints(), num_constraints, and Parma_Polyhedra_Library::Polyhedron::space_dimension().

00036   : affine_dim(0), num_constraints(0) {
00037   // The affine dimension of the polyhedron is obtained by subtracting
00038   // the number of equalities from the space dimension.
00039   // When counting constraints, for a correct reasoning, we have
00040   // to disregard the low-level constraints (i.e., the positivity
00041   // constraint and epsilon bounds).
00042   const dimension_type space_dim = ph.space_dimension();
00043   affine_dim = space_dim;
00044   const Constraint_System& cs = ph.minimized_constraints();
00045   // It is assumed that `ph' is not an empty polyhedron.
00046   PPL_ASSERT(!ph.marked_empty());
00047   for (Constraint_System::const_iterator i = cs.begin(),
00048          cs_end = cs.end(); i != cs_end; ++i) {
00049     ++num_constraints;
00050     if (i->is_equality())
00051       --affine_dim;
00052   }
00053 
00054   // TODO: this is an inefficient workaround.
00055   // For NNC polyhedra, generators might be no longer up-to-date
00056   // (and hence, neither minimized) due to the strong minimization
00057   // process applied to constraints when constructing the certificate.
00058   // We have to reinforce the (normal) minimization of the generator
00059   // system. The future, lazy implementation of the strong minimization
00060   // process will solve this problem.
00061   if (!ph.is_necessarily_closed())
00062     ph.minimize();
00063 }

Parma_Polyhedra_Library::H79_Certificate::H79_Certificate ( const H79_Certificate y  )  [inline]

Copy constructor.

Definition at line 38 of file H79_Certificate.inlines.hh.

00039   : affine_dim(y.affine_dim), num_constraints(y.num_constraints) {
00040 }

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

Destructor.

Definition at line 43 of file H79_Certificate.inlines.hh.

00043                                   {
00044 }


Member Function Documentation

int Parma_Polyhedra_Library::H79_Certificate::compare ( const Polyhedron ph  )  const

Compares *this with the certificate for polyhedron ph.

Definition at line 76 of file H79_Certificate.cc.

References affine_dim, Parma_Polyhedra_Library::Constraint_System::begin(), Parma_Polyhedra_Library::Constraint_System::end(), Parma_Polyhedra_Library::Polyhedron::is_necessarily_closed(), Parma_Polyhedra_Library::Polyhedron::marked_empty(), Parma_Polyhedra_Library::Polyhedron::minimize(), Parma_Polyhedra_Library::Polyhedron::minimized_constraints(), num_constraints, and Parma_Polyhedra_Library::Polyhedron::space_dimension().

00076                                                       {
00077   // The affine dimension of the polyhedron is obtained by subtracting
00078   // the number of equalities from the space dimension.
00079   // When counting constraints, for a correct reasoning, we have
00080   // to disregard the low-level constraints (i.e., the positivity
00081   // constraint and epsilon bounds).
00082   const dimension_type space_dim = ph.space_dimension();
00083   dimension_type ph_affine_dim = space_dim;
00084   dimension_type ph_num_constraints = 0;
00085   const Constraint_System& cs = ph.minimized_constraints();
00086   // It is assumed that `ph' is a polyhedron containing the
00087   // polyhedron described by `*this': hence, it cannot be empty.
00088   PPL_ASSERT(!ph.marked_empty());
00089   for (Constraint_System::const_iterator i = cs.begin(),
00090          cs_end = cs.end(); i != cs_end; ++i) {
00091     ++ph_num_constraints;
00092     if (i->is_equality())
00093       --ph_affine_dim;
00094   }
00095   // TODO: this is an inefficient workaround.
00096   // For NNC polyhedra, generators might be no longer up-to-date
00097   // (and hence, neither minimized) due to the strong minimization
00098   // process applied to constraints when constructing the certificate.
00099   // We have to reinforce the (normal) minimization of the generator
00100   // system. The future, lazy implementation of the strong minimization
00101   // process will solve this problem.
00102   if (!ph.is_necessarily_closed())
00103     ph.minimize();
00104 
00105   // If the affine dimension of `ph' is increasing, the chain is stabilizing.
00106   if (ph_affine_dim > affine_dim)
00107     return 1;
00108 
00109   // At this point the two polyhedra must have the same affine dimension.
00110   PPL_ASSERT(ph_affine_dim == affine_dim);
00111 
00112   // If the number of constraints of `ph' is decreasing, then the chain
00113   // is stabilizing. If it is increasing, the chain is not stabilizing.
00114   if (ph_num_constraints != num_constraints)
00115     return ph_num_constraints < num_constraints ? 1 : -1;
00116 
00117   // All components are equal.
00118   return 0;
00119 }

template<typename PH >
int Parma_Polyhedra_Library::H79_Certificate::compare ( const PH &  ph  )  const [inline]

Compares *this with the certificate for polyhedron ph.

Definition at line 65 of file H79_Certificate.inlines.hh.

References compare(), and Parma_Polyhedra_Library::NECESSARILY_CLOSED.

00065                                            {
00066   return this->compare(Polyhedron(NECESSARILY_CLOSED, ph.constraints()));
00067 }

int Parma_Polyhedra_Library::H79_Certificate::compare ( const H79_Certificate y  )  const

The comparison function for certificates.

Returns:
$-1$, $0$ or $1$ depending on whether *this is smaller than, equal to, or greater than y, respectively.

Compares *this with y, using a total ordering which is a refinement of the limited growth ordering relation for the H79 widening.

Definition at line 66 of file H79_Certificate.cc.

References affine_dim, and num_constraints.

Referenced by compare(), and Parma_Polyhedra_Library::H79_Certificate::Compare::operator()().

00066                                                           {
00067   if (affine_dim != y.affine_dim)
00068     return affine_dim > y.affine_dim ? 1 : -1;
00069   if (num_constraints != y.num_constraints)
00070     return num_constraints > y.num_constraints ? 1 : -1;
00071   // All components are equal.
00072   return 0;
00073 }


Member Data Documentation

Affine dimension of the polyhedron.

Definition at line 91 of file H79_Certificate.defs.hh.

Referenced by compare(), and H79_Certificate().

Cardinality of a non-redundant constraint system for the polyhedron.

Definition at line 93 of file H79_Certificate.defs.hh.

Referenced by compare(), and H79_Certificate().


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