PPL  1.2
Parma_Polyhedra_Library::Pointset_Powerset< PSET > Class Template Reference

The powerset construction instantiated on PPL pointset domains. More...

#include <Pointset_Powerset_defs.hh>

Inheritance diagram for Parma_Polyhedra_Library::Pointset_Powerset< PSET >:
Collaboration diagram for Parma_Polyhedra_Library::Pointset_Powerset< PSET >:

Public Types

typedef PSET element_type
 
typedef Base::size_type size_type
 
typedef Base::value_type value_type
 
typedef Base::iterator iterator
 
typedef Base::const_iterator const_iterator
 
typedef Base::reverse_iterator reverse_iterator
 
typedef Base::const_reverse_iterator const_reverse_iterator
 
- Public Types inherited from Parma_Polyhedra_Library::Powerset< Parma_Polyhedra_Library::Determinate< PSET > >
typedef Sequence::size_type size_type
 
typedef Sequence::value_type value_type
 
typedef iterator_to_const< Sequenceiterator
 Alias for a read-only bidirectional iterator on the disjuncts of a Powerset element. More...
 
typedef const_iterator_to_const< Sequenceconst_iterator
 A bidirectional const_iterator on the disjuncts of a Powerset element. More...
 
typedef std::reverse_iterator< iteratorreverse_iterator
 The reverse iterator type built from Powerset::iterator. More...
 
typedef std::reverse_iterator< const_iteratorconst_reverse_iterator
 The reverse iterator type built from Powerset::const_iterator. More...
 

Public Member Functions

void ascii_dump () const
 Writes to std::cerr an ASCII representation of *this. More...
 
void ascii_dump (std::ostream &s) const
 Writes to s an ASCII representation of *this. More...
 
void print () const
 Prints *this to std::cerr using operator<<. More...
 
bool ascii_load (std::istream &s)
 Loads from s an ASCII representation (as produced by ascii_dump(std::ostream&) const) and sets *this accordingly. Returns true if successful, false otherwise. More...
 
template<>
void difference_assign (const Pointset_Powerset &y)
 
template<>
bool geometrically_covers (const Pointset_Powerset &y) const
 
template<>
void difference_assign (const Pointset_Powerset &y)
 
template<>
bool geometrically_covers (const Pointset_Powerset &y) const
 
template<>
 Pointset_Powerset (const Pointset_Powerset< C_Polyhedron > &y, Complexity_Class)
 
template<>
 Pointset_Powerset (const Pointset_Powerset< Grid > &y, Complexity_Class)
 
template<>
 Pointset_Powerset (const Pointset_Powerset< NNC_Polyhedron > &y, Complexity_Class)
 
template<>
 Pointset_Powerset (const Pointset_Powerset< QH > &y, Complexity_Class)
 
template<>
 Pointset_Powerset (const Pointset_Powerset< C_Polyhedron > &y, Complexity_Class)
 
template<>
 Pointset_Powerset (const Pointset_Powerset< Grid > &y, Complexity_Class)
 
template<>
 Pointset_Powerset (const Pointset_Powerset< NNC_Polyhedron > &y, Complexity_Class)
 
template<>
void difference_assign (const Pointset_Powerset &y)
 
template<>
void difference_assign (const Pointset_Powerset &y)
 
template<>
bool geometrically_covers (const Pointset_Powerset &y) const
 
template<>
bool geometrically_covers (const Pointset_Powerset &y) const
 
template<typename QH >
Pointset_Powerset< PSET > & operator= (const Pointset_Powerset< QH > &y)
 
template<>
bool geometrically_equals (const Pointset_Powerset &y) const
 
template<>
bool geometrically_equals (const Pointset_Powerset &y) const
 
template<>
 Pointset_Powerset (const Pointset_Powerset< QH > &y, Complexity_Class complexity)
 
Constructors
 Pointset_Powerset (dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
 Builds a universe (top) or empty (bottom) Pointset_Powerset. More...
 
 Pointset_Powerset (const Pointset_Powerset &y, Complexity_Class complexity=ANY_COMPLEXITY)
 Ordinary copy constructor. More...
 
template<typename QH >
 Pointset_Powerset (const Pointset_Powerset< QH > &y, Complexity_Class complexity=ANY_COMPLEXITY)
 Conversion constructor: the type QH of the disjuncts in the source powerset is different from PSET. More...
 
template<typename QH1 , typename QH2 , typename R >
 Pointset_Powerset (const Partially_Reduced_Product< QH1, QH2, R > &prp, Complexity_Class complexity=ANY_COMPLEXITY)
 Creates a Pointset_Powerset from a product This will be created as a single disjunct of type PSET that approximates the product. More...
 
 Pointset_Powerset (const Constraint_System &cs)
 Creates a Pointset_Powerset with a single disjunct approximating the system of constraints cs. More...
 
 Pointset_Powerset (const Congruence_System &cgs)
 Creates a Pointset_Powerset with a single disjunct approximating the system of congruences cgs. More...
 
 Pointset_Powerset (const C_Polyhedron &ph, Complexity_Class complexity=ANY_COMPLEXITY)
 Builds a pointset_powerset out of a closed polyhedron. More...
 
 Pointset_Powerset (const NNC_Polyhedron &ph, Complexity_Class complexity=ANY_COMPLEXITY)
 Builds a pointset_powerset out of an nnc polyhedron. More...
 
 Pointset_Powerset (const Grid &gr, Complexity_Class complexity=ANY_COMPLEXITY)
 Builds a pointset_powerset out of a grid. More...
 
template<typename T >
 Pointset_Powerset (const Octagonal_Shape< T > &os, Complexity_Class complexity=ANY_COMPLEXITY)
 Builds a pointset_powerset out of an octagonal shape. More...
 
template<typename T >
 Pointset_Powerset (const BD_Shape< T > &bds, Complexity_Class complexity=ANY_COMPLEXITY)
 Builds a pointset_powerset out of a bd shape. More...
 
template<typename Interval >
 Pointset_Powerset (const Box< Interval > &box, Complexity_Class complexity=ANY_COMPLEXITY)
 Builds a pointset_powerset out of a box. More...
 
Member Functions that Do Not Modify the Pointset_Powerset
dimension_type space_dimension () const
 Returns the dimension of the vector space enclosing *this. More...
 
dimension_type affine_dimension () const
 Returns the dimension of the vector space enclosing *this. More...
 
bool is_empty () const
 Returns true if and only if *this is an empty powerset. More...
 
bool is_universe () const
 Returns true if and only if *this is the top element of the powerset lattice. More...
 
bool is_topologically_closed () const
 Returns true if and only if all the disjuncts in *this are topologically closed. More...
 
bool is_bounded () const
 Returns true if and only if all elements in *this are bounded. More...
 
bool is_disjoint_from (const Pointset_Powerset &y) const
 Returns true if and only if *this and y are disjoint. More...
 
bool is_discrete () const
 Returns true if and only if *this is discrete. More...
 
bool constrains (Variable var) const
 Returns true if and only if var is constrained in *this. More...
 
bool bounds_from_above (const Linear_Expression &expr) const
 Returns true if and only if expr is bounded from above in *this. More...
 
bool bounds_from_below (const Linear_Expression &expr) const
 Returns true if and only if expr is bounded from below in *this. More...
 
bool maximize (const Linear_Expression &expr, Coefficient &sup_n, Coefficient &sup_d, bool &maximum) const
 Returns true if and only if *this is not empty and expr is bounded from above in *this, in which case the supremum value is computed. More...
 
bool maximize (const Linear_Expression &expr, Coefficient &sup_n, Coefficient &sup_d, bool &maximum, Generator &g) const
 Returns true if and only if *this is not empty and expr is bounded from above in *this, in which case the supremum value and a point where expr reaches it are computed. More...
 
bool minimize (const Linear_Expression &expr, Coefficient &inf_n, Coefficient &inf_d, bool &minimum) const
 Returns true if and only if *this is not empty and expr is bounded from below in *this, in which case the infimum value is computed. More...
 
bool minimize (const Linear_Expression &expr, Coefficient &inf_n, Coefficient &inf_d, bool &minimum, Generator &g) const
 Returns true if and only if *this is not empty and expr is bounded from below in *this, in which case the infimum value and a point where expr reaches it are computed. More...
 
bool geometrically_covers (const Pointset_Powerset &y) const
 Returns true if and only if *this geometrically covers y, i.e., if any point (in some element) of y is also a point (of some element) of *this. More...
 
bool geometrically_equals (const Pointset_Powerset &y) const
 Returns true if and only if *this is geometrically equal to y, i.e., if (the elements of) *this and y contain the same set of points. More...
 
bool contains (const Pointset_Powerset &y) const
 Returns true if and only if each disjunct of y is contained in a disjunct of *this. More...
 
bool strictly_contains (const Pointset_Powerset &y) const
 Returns true if and only if each disjunct of y is strictly contained in a disjunct of *this. More...
 
bool contains_integer_point () const
 Returns true if and only if *this contains at least one integer point. More...
 
Poly_Con_Relation relation_with (const Constraint &c) const
 Returns the relations holding between the powerset *this and the constraint c. More...
 
Poly_Gen_Relation relation_with (const Generator &g) const
 Returns the relations holding between the powerset *this and the generator g. More...
 
Poly_Con_Relation relation_with (const Congruence &cg) const
 Returns the relations holding between the powerset *this and the congruence c. More...
 
memory_size_type total_memory_in_bytes () const
 Returns a lower bound to the total size in bytes of the memory occupied by *this. More...
 
memory_size_type external_memory_in_bytes () const
 Returns a lower bound to the size in bytes of the memory managed by *this. More...
 
int32_t hash_code () const
 Returns a 32-bit hash code for *this. More...
 
bool OK () const
 Checks if all the invariants are satisfied. More...
 
Space Dimension Preserving Member Functions that May Modify the Pointset_Powerset
void add_disjunct (const PSET &ph)
 Adds to *this the disjunct ph. More...
 
void add_constraint (const Constraint &c)
 Intersects *this with constraint c. More...
 
void refine_with_constraint (const Constraint &c)
 Use the constraint c to refine *this. More...
 
void add_constraints (const Constraint_System &cs)
 Intersects *this with the constraints in cs. More...
 
void refine_with_constraints (const Constraint_System &cs)
 Use the constraints in cs to refine *this. More...
 
void add_congruence (const Congruence &cg)
 Intersects *this with congruence cg. More...
 
void refine_with_congruence (const Congruence &cg)
 Use the congruence cg to refine *this. More...
 
void add_congruences (const Congruence_System &cgs)
 Intersects *this with the congruences in cgs. More...
 
void refine_with_congruences (const Congruence_System &cgs)
 Use the congruences in cgs to refine *this. More...
 
void unconstrain (Variable var)
 Computes the cylindrification of *this with respect to space dimension var, assigning the result to *this. More...
 
void unconstrain (const Variables_Set &vars)
 Computes the cylindrification of *this with respect to the set of space dimensions vars, assigning the result to *this. More...
 
void drop_some_non_integer_points (Complexity_Class complexity=ANY_COMPLEXITY)
 Possibly tightens *this by dropping some points with non-integer coordinates. More...
 
void drop_some_non_integer_points (const Variables_Set &vars, Complexity_Class complexity=ANY_COMPLEXITY)
 Possibly tightens *this by dropping some points with non-integer coordinates for the space dimensions corresponding to vars. More...
 
void topological_closure_assign ()
 Assigns to *this its topological closure. More...
 
void intersection_assign (const Pointset_Powerset &y)
 Assigns to *this the intersection of *this and y. More...
 
void difference_assign (const Pointset_Powerset &y)
 Assigns to *this an (a smallest) over-approximation as a powerset of the disjunct domain of the set-theoretical difference of *this and y. More...
 
bool simplify_using_context_assign (const Pointset_Powerset &y)
 Assigns to *this a meet-preserving simplification of *this with respect to y. If false is returned, then the intersection is empty. More...
 
void affine_image (Variable var, const Linear_Expression &expr, Coefficient_traits::const_reference denominator=Coefficient_one())
 Assigns to *this the affine image of *this under the function mapping variable var to the affine expression specified by expr and denominator. More...
 
void affine_preimage (Variable var, const Linear_Expression &expr, Coefficient_traits::const_reference denominator=Coefficient_one())
 Assigns to *this the affine preimage of *this under the function mapping variable var to the affine expression specified by expr and denominator. More...
 
void generalized_affine_image (Variable var, Relation_Symbol relsym, const Linear_Expression &expr, Coefficient_traits::const_reference denominator=Coefficient_one())
 Assigns to *this the image of *this with respect to the generalized affine relation $\mathrm{var}' \relsym \frac{\mathrm{expr}}{\mathrm{denominator}}$, where $\mathord{\relsym}$ is the relation symbol encoded by relsym. More...
 
void generalized_affine_preimage (Variable var, Relation_Symbol relsym, const Linear_Expression &expr, Coefficient_traits::const_reference denominator=Coefficient_one())
 Assigns to *this the preimage of *this with respect to the generalized affine relation $\mathrm{var}' \relsym \frac{\mathrm{expr}}{\mathrm{denominator}}$, where $\mathord{\relsym}$ is the relation symbol encoded by relsym. More...
 
void generalized_affine_image (const Linear_Expression &lhs, Relation_Symbol relsym, const Linear_Expression &rhs)
 Assigns to *this the image of *this with respect to the generalized affine relation $\mathrm{lhs}' \relsym \mathrm{rhs}$, where $\mathord{\relsym}$ is the relation symbol encoded by relsym. More...
 
void generalized_affine_preimage (const Linear_Expression &lhs, Relation_Symbol relsym, const Linear_Expression &rhs)
 Assigns to *this the preimage of *this with respect to the generalized affine relation $\mathrm{lhs}' \relsym \mathrm{rhs}$, where $\mathord{\relsym}$ is the relation symbol encoded by relsym. More...
 
void bounded_affine_image (Variable var, const Linear_Expression &lb_expr, const Linear_Expression &ub_expr, Coefficient_traits::const_reference denominator=Coefficient_one())
 Assigns to *this the image of *this with respect to the bounded affine relation $\frac{\mathrm{lb\_expr}}{\mathrm{denominator}} \leq \mathrm{var}' \leq \frac{\mathrm{ub\_expr}}{\mathrm{denominator}}$. More...
 
void bounded_affine_preimage (Variable var, const Linear_Expression &lb_expr, const Linear_Expression &ub_expr, Coefficient_traits::const_reference denominator=Coefficient_one())
 Assigns to *this the preimage of *this with respect to the bounded affine relation $\frac{\mathrm{lb\_expr}}{\mathrm{denominator}} \leq \mathrm{var}' \leq \frac{\mathrm{ub\_expr}}{\mathrm{denominator}}$. More...
 
void time_elapse_assign (const Pointset_Powerset &y)
 Assigns to *this the result of computing the time-elapse between *this and y. More...
 
void wrap_assign (const Variables_Set &vars, Bounded_Integer_Type_Width w, Bounded_Integer_Type_Representation r, Bounded_Integer_Type_Overflow o, const Constraint_System *cs_p=0, unsigned complexity_threshold=16, bool wrap_individually=true)
 Wraps the specified dimensions of the vector space. More...
 
void pairwise_reduce ()
 Assign to *this the result of (recursively) merging together the pairs of disjuncts whose upper-bound is the same as their set-theoretical union. More...
 
template<typename Widening >
void BGP99_extrapolation_assign (const Pointset_Powerset &y, Widening widen_fun, unsigned max_disjuncts)
 Assigns to *this the result of applying the BGP99 extrapolation operator to *this and y, using the widening function widen_fun and the cardinality threshold max_disjuncts. More...
 
template<typename Cert , typename Widening >
void BHZ03_widening_assign (const Pointset_Powerset &y, Widening widen_fun)
 Assigns to *this the result of computing the BHZ03-widening between *this and y, using the widening function widen_fun certified by the convergence certificate Cert. More...
 
Member Functions that May Modify the Dimension of the Vector Space
Pointset_Powersetoperator= (const Pointset_Powerset &y)
 The assignment operator (*this and y can be dimension-incompatible). More...
 
template<typename QH >
Pointset_Powersetoperator= (const Pointset_Powerset< QH > &y)
 Conversion assignment: the type QH of the disjuncts in the source powerset is different from PSET (*this and y can be dimension-incompatible). More...
 
void m_swap (Pointset_Powerset &y)
 Swaps *this with y. More...
 
void add_space_dimensions_and_embed (dimension_type m)
 Adds m new dimensions to the vector space containing *this and embeds each disjunct in *this in the new space. More...
 
void add_space_dimensions_and_project (dimension_type m)
 Adds m new dimensions to the vector space containing *this without embedding the disjuncts in *this in the new space. More...
 
void concatenate_assign (const Pointset_Powerset &y)
 Assigns to *this the concatenation of *this and y. More...
 
void remove_space_dimensions (const Variables_Set &vars)
 Removes all the specified space dimensions. More...
 
void remove_higher_space_dimensions (dimension_type new_dimension)
 Removes the higher space dimensions so that the resulting space will have dimension new_dimension. More...
 
template<typename Partial_Function >
void map_space_dimensions (const Partial_Function &pfunc)
 Remaps the dimensions of the vector space according to a partial function. More...
 
void expand_space_dimension (Variable var, dimension_type m)
 Creates m copies of the space dimension corresponding to var. More...
 
void fold_space_dimensions (const Variables_Set &vars, Variable dest)
 Folds the space dimensions in vars into dest. More...
 
- Public Member Functions inherited from Parma_Polyhedra_Library::Powerset< Parma_Polyhedra_Library::Determinate< PSET > >
 Powerset ()
 Default constructor: builds the bottom of the powerset constraint system (i.e., the empty powerset). More...
 
 Powerset (const Powerset &y)
 Copy constructor. More...
 
 Powerset (const Parma_Polyhedra_Library::Determinate< PSET > &d)
 If d is not bottom, builds a powerset containing only d. Builds the empty powerset otherwise. More...
 
 ~Powerset ()
 Destructor. More...
 
bool definitely_entails (const Powerset &y) const
 Returns true if *this definitely entails y. Returns false if *this may not entail y (i.e., if *this does not entail y or if entailment could not be decided). More...
 
bool is_top () const
 Returns true if and only if *this is the top element of the powerset constraint system (i.e., it represents the universe). More...
 
bool is_bottom () const
 Returns true if and only if *this is the bottom element of the powerset constraint system (i.e., it represents the empty set). More...
 
memory_size_type total_memory_in_bytes () const
 Returns a lower bound to the total size in bytes of the memory occupied by *this. More...
 
memory_size_type external_memory_in_bytes () const
 Returns a lower bound to the size in bytes of the memory managed by *this. More...
 
bool OK (bool disallow_bottom=false) const
 Checks if all the invariants are satisfied. More...
 
void omega_reduce () const
 Drops from the sequence of disjuncts in *this all the non-maximal elements so that *this is non-redundant. More...
 
size_type size () const
 Returns the number of disjuncts. More...
 
bool empty () const
 Returns true if and only if there are no disjuncts in *this. More...
 
iterator begin ()
 Returns an iterator pointing to the first disjunct, if *this is not empty; otherwise, returns the past-the-end iterator. More...
 
const_iterator begin () const
 Returns a const_iterator pointing to the first disjunct, if *this is not empty; otherwise, returns the past-the-end const_iterator. More...
 
iterator end ()
 Returns the past-the-end iterator. More...
 
const_iterator end () const
 Returns the past-the-end const_iterator. More...
 
reverse_iterator rbegin ()
 Returns a reverse_iterator pointing to the last disjunct, if *this is not empty; otherwise, returns the before-the-start reverse_iterator. More...
 
const_reverse_iterator rbegin () const
 Returns a const_reverse_iterator pointing to the last disjunct, if *this is not empty; otherwise, returns the before-the-start const_reverse_iterator. More...
 
reverse_iterator rend ()
 Returns the before-the-start reverse_iterator. More...
 
const_reverse_iterator rend () const
 Returns the before-the-start const_reverse_iterator. More...
 
void add_disjunct (const Parma_Polyhedra_Library::Determinate< PSET > &d)
 Adds to *this the disjunct d. More...
 
iterator drop_disjunct (iterator position)
 Drops the disjunct in *this pointed to by position, returning an iterator to the disjunct following position. More...
 
void drop_disjuncts (iterator first, iterator last)
 Drops all the disjuncts from first to last (excluded). More...
 
void clear ()
 Drops all the disjuncts, making *this an empty powerset. More...
 
Powersetoperator= (const Powerset &y)
 The assignment operator. More...
 
void m_swap (Powerset &y)
 Swaps *this with y. More...
 
void least_upper_bound_assign (const Powerset &y)
 Assigns to *this the least upper bound of *this and y. More...
 
void upper_bound_assign (const Powerset &y)
 Assigns to *this an upper bound of *this and y. More...
 
bool upper_bound_assign_if_exact (const Powerset &y)
 Assigns to *this the least upper bound of *this and y and returns true. More...
 
void meet_assign (const Powerset &y)
 Assigns to *this the meet of *this and y. More...
 
void collapse ()
 If *this is not empty (i.e., it is not the bottom element), it is reduced to a singleton obtained by computing an upper-bound of all the disjuncts. More...
 

Static Public Member Functions

static dimension_type max_space_dimension ()
 Returns the maximum space dimension a Pointset_Powerset<PSET> can handle. More...
 

Private Types

typedef Determinate< PSET > Det_PSET
 
typedef Powerset< Det_PSETBase
 
typedef Base::Sequence Sequence
 
typedef Base::Sequence_iterator Sequence_iterator
 
typedef Base::Sequence_const_iterator Sequence_const_iterator
 

Private Member Functions

bool intersection_preserving_enlarge_element (PSET &dest) const
 Assigns to dest a powerset meet-preserving enlargement of itself with respect to *this. If false is returned, then the intersection is empty. More...
 
template<typename Widening >
void BGP99_heuristics_assign (const Pointset_Powerset &y, Widening widen_fun)
 Assigns to *this the result of applying the BGP99 heuristics to *this and y, using the widening function widen_fun. More...
 
template<typename Cert >
void collect_certificates (std::map< Cert, size_type, typename Cert::Compare > &cert_ms) const
 Records in cert_ms the certificates for this set of disjuncts. More...
 
template<typename Cert >
bool is_cert_multiset_stabilizing (const std::map< Cert, size_type, typename Cert::Compare > &y_cert_ms) const
 Returns true if and only if the current set of disjuncts is stabilizing with respect to the multiset of certificates y_cert_ms. More...
 
template<typename Cons_or_Congr >
Poly_Con_Relation relation_with_aux (const Cons_or_Congr &c) const
 Template helper: common implementation for constraints and congruences. More...
 

Private Attributes

dimension_type space_dim
 The number of dimensions of the enclosing vector space. More...
 

Friends

class Pointset_Powerset< NNC_Polyhedron >
 

Related Functions

(Note that these are not member functions.)

bool check_containment (const NNC_Polyhedron &ph, const Pointset_Powerset< NNC_Polyhedron > &ps)
 
bool approximate_partition_aux (const PPL::Congruence &c, PPL::Grid &gr, PPL::Pointset_Powerset< PPL::Grid > &r)
 Uses the congruence c to approximately partition the grid gr. More...
 
std::pair< PPL::Grid, PPL::Pointset_Powerset< PPL::Grid > > approximate_partition (const Grid &p, const Grid &q, bool &finite_partition)
 
bool check_containment (const Grid &ph, const Pointset_Powerset< Grid > &ps)
 
template<typename PSET >
void swap (Pointset_Powerset< PSET > &x, Pointset_Powerset< PSET > &y)
 Swaps x with y. More...
 
template<typename PSET >
std::pair< PSET, Pointset_Powerset< NNC_Polyhedron > > linear_partition (const PSET &p, const PSET &q)
 Partitions q with respect to p. More...
 
bool check_containment (const NNC_Polyhedron &ph, const Pointset_Powerset< NNC_Polyhedron > &ps)
 Returns true if and only if the union of the NNC polyhedra in ps contains the NNC polyhedron ph. More...
 
std::pair< Grid, Pointset_Powerset< Grid > > approximate_partition (const Grid &p, const Grid &q, bool &finite_partition)
 Partitions the grid q with respect to grid p if and only if such a partition is finite. More...
 
bool check_containment (const Grid &ph, const Pointset_Powerset< Grid > &ps)
 Returns true if and only if the union of the grids ps contains the grid g. More...
 
template<typename PSET >
bool check_containment (const PSET &ph, const Pointset_Powerset< PSET > &ps)
 Returns true if and only if the union of the objects in ps contains ph. More...
 
template<typename PSET >
bool check_containment (const PSET &ph, const Pointset_Powerset< PSET > &ps)
 
template<>
bool check_containment (const C_Polyhedron &ph, const Pointset_Powerset< C_Polyhedron > &ps)
 
template<typename PSET >
void swap (Pointset_Powerset< PSET > &x, Pointset_Powerset< PSET > &y)
 
template<typename PSET >
void linear_partition_aux (const Constraint &c, PSET &pset, Pointset_Powerset< NNC_Polyhedron > &r)
 Partitions polyhedron pset according to constraint c. More...
 
template<typename PSET >
std::pair< PSET, Pointset_Powerset< NNC_Polyhedron > > linear_partition (const PSET &p, const PSET &q)
 
template<typename PSET >
Widening_Function< PSET > widen_fun_ref (void(PSET::*wm)(const PSET &, unsigned *))
 Wraps a widening method into a function object. More...
 
template<typename PSET , typename CSYS >
Limited_Widening_Function< PSET, CSYS > widen_fun_ref (void(PSET::*lwm)(const PSET &, const CSYS &, unsigned *), const CSYS &cs)
 Wraps a limited widening method into a function object. More...
 
template<typename PSET >
Widening_Function< PSET > widen_fun_ref (void(PSET::*wm)(const PSET &, unsigned *))
 
template<typename PSET , typename CSYS >
Limited_Widening_Function< PSET, CSYS > widen_fun_ref (void(PSET::*lwm)(const PSET &, const CSYS &, unsigned *), const CSYS &cs)
 

Additional Inherited Members

- Protected Types inherited from Parma_Polyhedra_Library::Powerset< Parma_Polyhedra_Library::Determinate< PSET > >
typedef std::list< Parma_Polyhedra_Library::Determinate< PSET > > Sequence
 A powerset is implemented as a sequence of elements. More...
 
typedef Sequence::iterator Sequence_iterator
 Alias for the low-level iterator on the disjuncts. More...
 
typedef Sequence::const_iterator Sequence_const_iterator
 Alias for the low-level const_iterator on the disjuncts. More...
 
- Protected Member Functions inherited from Parma_Polyhedra_Library::Powerset< Parma_Polyhedra_Library::Determinate< PSET > >
void collapse (unsigned max_disjuncts)
 Upon return, *this will contain at most max_disjuncts elements; the set of disjuncts in positions greater than or equal to max_disjuncts, will be replaced at that position by their upper-bound. More...
 
bool is_omega_reduced () const
 Returns true if and only if *this does not contain non-maximal elements. More...
 
iterator add_non_bottom_disjunct_preserve_reduction (const Parma_Polyhedra_Library::Determinate< PSET > &d, iterator first, iterator last)
 Adds to *this the disjunct d, assuming d is not the bottom element and ensuring partial Omega-reduction. More...
 
void add_non_bottom_disjunct_preserve_reduction (const Parma_Polyhedra_Library::Determinate< PSET > &d)
 Adds to *this the disjunct d, assuming d is not the bottom element and preserving Omega-reduction. More...
 
void pairwise_apply_assign (const Powerset &y, Binary_Operator_Assign op_assign)
 Assigns to *this the result of applying op_assign pairwise to the elements in *this and y. More...
 
- Protected Attributes inherited from Parma_Polyhedra_Library::Powerset< Parma_Polyhedra_Library::Determinate< PSET > >
Sequence sequence
 The sequence container holding powerset's elements. More...
 
bool reduced
 If true, *this is Omega-reduced. More...
 

Detailed Description

template<typename PSET>
class Parma_Polyhedra_Library::Pointset_Powerset< PSET >

The powerset construction instantiated on PPL pointset domains.

Warning
At present, the supported instantiations for the disjunct domain template PSET are the simple pointset domains: C_Polyhedron, NNC_Polyhedron, Grid, Octagonal_Shape<T>, BD_Shape<T>, Box<T>.

Definition at line 61 of file Pointset_Powerset_defs.hh.

Member Typedef Documentation

template<typename PSET>
typedef Powerset<Det_PSET> Parma_Polyhedra_Library::Pointset_Powerset< PSET >::Base
private

Definition at line 69 of file Pointset_Powerset_defs.hh.

Definition at line 1244 of file Pointset_Powerset_defs.hh.

template<typename PSET>
typedef Determinate<PSET> Parma_Polyhedra_Library::Pointset_Powerset< PSET >::Det_PSET
private

Definition at line 68 of file Pointset_Powerset_defs.hh.

template<typename PSET>
typedef PSET Parma_Polyhedra_Library::Pointset_Powerset< PSET >::element_type

Definition at line 65 of file Pointset_Powerset_defs.hh.

template<typename PSET>
typedef Base::iterator Parma_Polyhedra_Library::Pointset_Powerset< PSET >::iterator

Definition at line 1243 of file Pointset_Powerset_defs.hh.

Definition at line 1245 of file Pointset_Powerset_defs.hh.

template<typename PSET>
typedef Base::Sequence Parma_Polyhedra_Library::Pointset_Powerset< PSET >::Sequence
private

Definition at line 1258 of file Pointset_Powerset_defs.hh.

Definition at line 1260 of file Pointset_Powerset_defs.hh.

Definition at line 1259 of file Pointset_Powerset_defs.hh.

template<typename PSET>
typedef Base::size_type Parma_Polyhedra_Library::Pointset_Powerset< PSET >::size_type

Definition at line 1241 of file Pointset_Powerset_defs.hh.

Definition at line 1242 of file Pointset_Powerset_defs.hh.

Constructor & Destructor Documentation

template<typename PSET >
Parma_Polyhedra_Library::Pointset_Powerset< PSET >::Pointset_Powerset ( dimension_type  num_dimensions = 0,
Degenerate_Element  kind = UNIVERSE 
)
inlineexplicit

Builds a universe (top) or empty (bottom) Pointset_Powerset.

Parameters
num_dimensionsThe number of dimensions of the vector space enclosing the powerset;
kindSpecifies whether the universe or the empty powerset has to be built.

Definition at line 54 of file Pointset_Powerset_inlines.hh.

References Parma_Polyhedra_Library::Pointset_Powerset< PSET >::OK(), Parma_Polyhedra_Library::Powerset< D >::sequence, and Parma_Polyhedra_Library::UNIVERSE.

56  : Base(), space_dim(num_dimensions) {
57  Pointset_Powerset& x = *this;
58  if (kind == UNIVERSE) {
59  x.sequence.push_back(Determinate<PSET>(PSET(num_dimensions, kind)));
60  }
61  PPL_ASSERT_HEAVY(x.OK());
62 }
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
The universe element, i.e., the whole vector space.
dimension_type space_dim
The number of dimensions of the enclosing vector space.
template<typename PSET >
Parma_Polyhedra_Library::Pointset_Powerset< PSET >::Pointset_Powerset ( const Pointset_Powerset< PSET > &  y,
Complexity_Class  complexity = ANY_COMPLEXITY 
)
inline

Ordinary copy constructor.

The complexity argument is ignored.

Definition at line 66 of file Pointset_Powerset_inlines.hh.

68  : Base(y), space_dim(y.space_dim) {
69 }
dimension_type space_dim
The number of dimensions of the enclosing vector space.
template<typename PSET >
template<typename QH >
Parma_Polyhedra_Library::Pointset_Powerset< PSET >::Pointset_Powerset ( const Pointset_Powerset< QH > &  y,
Complexity_Class  complexity = ANY_COMPLEXITY 
)
explicit

Conversion constructor: the type QH of the disjuncts in the source powerset is different from PSET.

Parameters
yThe powerset to be used to build the new powerset.
complexityThe maximal complexity of any algorithms used.

Definition at line 88 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Powerset< Parma_Polyhedra_Library::Determinate< PSET > >::begin(), Parma_Polyhedra_Library::Powerset< Parma_Polyhedra_Library::Determinate< PSET > >::end(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::OK(), Parma_Polyhedra_Library::Powerset< D >::reduced, and Parma_Polyhedra_Library::Powerset< D >::sequence.

90  : Base(), space_dim(y.space_dimension()) {
91  Pointset_Powerset& x = *this;
92  for (typename Pointset_Powerset<QH>::const_iterator i = y.begin(),
93  y_end = y.end(); i != y_end; ++i) {
94  x.sequence.push_back(Determinate<PSET>(PSET(i->pointset(), complexity)));
95  }
96  // Note: this might be non-reduced even when `y' is known to be
97  // omega-reduced, because the constructor of PSET may have made
98  // different QH elements to become comparable.
99  x.reduced = false;
100  PPL_ASSERT_HEAVY(x.OK());
101 }
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
dimension_type space_dim
The number of dimensions of the enclosing vector space.
template<typename PSET >
template<typename QH1 , typename QH2 , typename R >
Parma_Polyhedra_Library::Pointset_Powerset< PSET >::Pointset_Powerset ( const Partially_Reduced_Product< QH1, QH2, R > &  prp,
Complexity_Class  complexity = ANY_COMPLEXITY 
)
inlineexplicit

Creates a Pointset_Powerset from a product This will be created as a single disjunct of type PSET that approximates the product.

Definition at line 124 of file Pointset_Powerset_inlines.hh.

References Parma_Polyhedra_Library::ANY_COMPLEXITY, Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::is_empty(), Parma_Polyhedra_Library::Powerset< D >::reduced, and Parma_Polyhedra_Library::Powerset< D >::sequence.

126  : Base(), space_dim(prp.space_dimension()) {
127  Pointset_Powerset& x = *this;
128  if (complexity == ANY_COMPLEXITY) {
129  if (prp.is_empty()) {
130  return;
131  }
132  }
133  else {
134  x.reduced = false;
135  }
136  x.sequence.push_back(Determinate<PSET>(PSET(prp, complexity)));
137  x.reduced = false;
138  PPL_ASSERT_HEAVY(OK());
139 }
bool OK() const
Checks if all the invariants are satisfied.
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
dimension_type space_dim
The number of dimensions of the enclosing vector space.
template<typename PSET >
Parma_Polyhedra_Library::Pointset_Powerset< PSET >::Pointset_Powerset ( const Constraint_System cs)
inlineexplicit

Creates a Pointset_Powerset with a single disjunct approximating the system of constraints cs.

Definition at line 179 of file Pointset_Powerset_inlines.hh.

References Parma_Polyhedra_Library::Pointset_Powerset< PSET >::OK().

180  : Base(Determinate<PSET>(cs)), space_dim(cs.space_dimension()) {
181  PPL_ASSERT_HEAVY(OK());
182 }
bool OK() const
Checks if all the invariants are satisfied.
dimension_type space_dim
The number of dimensions of the enclosing vector space.
template<typename PSET >
Parma_Polyhedra_Library::Pointset_Powerset< PSET >::Pointset_Powerset ( const Congruence_System cgs)
inlineexplicit

Creates a Pointset_Powerset with a single disjunct approximating the system of congruences cgs.

Definition at line 186 of file Pointset_Powerset_inlines.hh.

References Parma_Polyhedra_Library::Pointset_Powerset< PSET >::OK().

187  : Base(Determinate<PSET>(cgs)), space_dim(cgs.space_dimension()) {
188  PPL_ASSERT_HEAVY(OK());
189 }
bool OK() const
Checks if all the invariants are satisfied.
dimension_type space_dim
The number of dimensions of the enclosing vector space.
template<typename PSET >
Parma_Polyhedra_Library::Pointset_Powerset< PSET >::Pointset_Powerset ( const C_Polyhedron ph,
Complexity_Class  complexity = ANY_COMPLEXITY 
)
inlineexplicit

Builds a pointset_powerset out of a closed polyhedron.

Builds a powerset that is either empty (if the polyhedron is found to be empty) or contains a single disjunct approximating the polyhedron; this must only use algorithms that do not exceed the specified complexity. The powerset inherits the space dimension of the polyhedron.

Parameters
phThe closed polyhedron to be used to build the powerset.
complexityThe maximal complexity of any algorithms used.
Exceptions
std::length_errorThrown if the space dimension of ph exceeds the maximum allowed space dimension.

Definition at line 73 of file Pointset_Powerset_inlines.hh.

References Parma_Polyhedra_Library::ANY_COMPLEXITY, Parma_Polyhedra_Library::Polyhedron::is_empty(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::OK(), Parma_Polyhedra_Library::Powerset< D >::reduced, and Parma_Polyhedra_Library::Powerset< D >::sequence.

75  : Base(), space_dim(ph.space_dimension()) {
76  Pointset_Powerset& x = *this;
77  if (complexity == ANY_COMPLEXITY) {
78  if (ph.is_empty()) {
79  return;
80  }
81  }
82  else {
83  x.reduced = false;
84  }
85  x.sequence.push_back(Determinate<PSET>(PSET(ph, complexity)));
86  x.reduced = false;
87  PPL_ASSERT_HEAVY(OK());
88 }
bool OK() const
Checks if all the invariants are satisfied.
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
dimension_type space_dim
The number of dimensions of the enclosing vector space.
template<typename PSET >
Parma_Polyhedra_Library::Pointset_Powerset< PSET >::Pointset_Powerset ( const NNC_Polyhedron ph,
Complexity_Class  complexity = ANY_COMPLEXITY 
)
inlineexplicit

Builds a pointset_powerset out of an nnc polyhedron.

Builds a powerset that is either empty (if the polyhedron is found to be empty) or contains a single disjunct approximating the polyhedron; this must only use algorithms that do not exceed the specified complexity. The powerset inherits the space dimension of the polyhedron.

Parameters
phThe closed polyhedron to be used to build the powerset.
complexityThe maximal complexity of any algorithms used.
Exceptions
std::length_errorThrown if the space dimension of ph exceeds the maximum allowed space dimension.

Definition at line 92 of file Pointset_Powerset_inlines.hh.

References Parma_Polyhedra_Library::ANY_COMPLEXITY, Parma_Polyhedra_Library::Polyhedron::is_empty(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::OK(), Parma_Polyhedra_Library::Powerset< D >::reduced, and Parma_Polyhedra_Library::Powerset< D >::sequence.

94  : Base(), space_dim(ph.space_dimension()) {
95  Pointset_Powerset& x = *this;
96  if (complexity == ANY_COMPLEXITY) {
97  if (ph.is_empty()) {
98  return;
99  }
100  }
101  else {
102  x.reduced = false;
103  }
104  x.sequence.push_back(Determinate<PSET>(PSET(ph, complexity)));
105  PPL_ASSERT_HEAVY(OK());
106 }
bool OK() const
Checks if all the invariants are satisfied.
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
dimension_type space_dim
The number of dimensions of the enclosing vector space.
template<typename PSET >
Parma_Polyhedra_Library::Pointset_Powerset< PSET >::Pointset_Powerset ( const Grid gr,
Complexity_Class  complexity = ANY_COMPLEXITY 
)
inlineexplicit

Builds a pointset_powerset out of a grid.

If the grid is nonempty, builds a powerset containing a single disjunct approximating the grid. Builds the empty powerset otherwise. The powerset inherits the space dimension of the grid.

Parameters
grThe grid to be used to build the powerset.
complexityThis argument is ignored.
Exceptions
std::length_errorThrown if the space dimension of gr exceeds the maximum allowed space dimension.

Definition at line 110 of file Pointset_Powerset_inlines.hh.

References Parma_Polyhedra_Library::Grid::is_empty(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::OK(), and Parma_Polyhedra_Library::Powerset< D >::sequence.

112  : Base(), space_dim(gr.space_dimension()) {
113  Pointset_Powerset& x = *this;
114  if (!gr.is_empty()) {
115  x.sequence.push_back(Determinate<PSET>(PSET(gr)));
116  }
117  PPL_ASSERT_HEAVY(OK());
118 }
bool OK() const
Checks if all the invariants are satisfied.
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
dimension_type space_dim
The number of dimensions of the enclosing vector space.
template<typename PSET >
template<typename T >
Parma_Polyhedra_Library::Pointset_Powerset< PSET >::Pointset_Powerset ( const Octagonal_Shape< T > &  os,
Complexity_Class  complexity = ANY_COMPLEXITY 
)
explicit

Builds a pointset_powerset out of an octagonal shape.

If the octagonal shape is nonempty, builds a powerset containing a single disjunct approximating the octagonal shape. Builds the empty powerset otherwise. The powerset inherits the space dimension of the octagonal shape.

Parameters
osThe octagonal shape to be used to build the powerset.
complexityThis argument is ignored.
Exceptions
std::length_errorThrown if the space dimension of os exceeds the maximum allowed space dimension.

Definition at line 155 of file Pointset_Powerset_inlines.hh.

References Parma_Polyhedra_Library::Octagonal_Shape< T >::is_empty(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::OK(), and Parma_Polyhedra_Library::Powerset< D >::sequence.

157  : Base(), space_dim(os.space_dimension()) {
158  Pointset_Powerset& x = *this;
159  if (!os.is_empty()) {
160  x.sequence.push_back(Determinate<PSET>(PSET(os)));
161  }
162  PPL_ASSERT_HEAVY(OK());
163 }
bool OK() const
Checks if all the invariants are satisfied.
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
dimension_type space_dim
The number of dimensions of the enclosing vector space.
template<typename PSET >
template<typename T >
Parma_Polyhedra_Library::Pointset_Powerset< PSET >::Pointset_Powerset ( const BD_Shape< T > &  bds,
Complexity_Class  complexity = ANY_COMPLEXITY 
)
explicit

Builds a pointset_powerset out of a bd shape.

If the bd shape is nonempty, builds a powerset containing a single disjunct approximating the bd shape. Builds the empty powerset otherwise. The powerset inherits the space dimension of the bd shape.

Parameters
bdsThe bd shape to be used to build the powerset.
complexityThis argument is ignored.
Exceptions
std::length_errorThrown if the space dimension of bds exceeds the maximum allowed space dimension.

Definition at line 167 of file Pointset_Powerset_inlines.hh.

References Parma_Polyhedra_Library::BD_Shape< T >::is_empty(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::OK(), and Parma_Polyhedra_Library::Powerset< D >::sequence.

169  : Base(), space_dim(bds.space_dimension()) {
170  Pointset_Powerset& x = *this;
171  if (!bds.is_empty()) {
172  x.sequence.push_back(Determinate<PSET>(PSET(bds)));
173  }
174  PPL_ASSERT_HEAVY(OK());
175 }
bool OK() const
Checks if all the invariants are satisfied.
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
dimension_type space_dim
The number of dimensions of the enclosing vector space.
template<typename PSET >
template<typename Interval >
Parma_Polyhedra_Library::Pointset_Powerset< PSET >::Pointset_Powerset ( const Box< Interval > &  box,
Complexity_Class  complexity = ANY_COMPLEXITY 
)
explicit

Builds a pointset_powerset out of a box.

If the box is nonempty, builds a powerset containing a single disjunct approximating the box. Builds the empty powerset otherwise. The powerset inherits the space dimension of the box.

Parameters
boxThe box to be used to build the powerset.
complexityThis argument is ignored.
Exceptions
std::length_errorThrown if the space dimension of box exceeds the maximum allowed space dimension.

Definition at line 143 of file Pointset_Powerset_inlines.hh.

References Parma_Polyhedra_Library::Box< ITV >::is_empty(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::OK(), and Parma_Polyhedra_Library::Powerset< D >::sequence.

145  : Base(), space_dim(box.space_dimension()) {
146  Pointset_Powerset& x = *this;
147  if (!box.is_empty()) {
148  x.sequence.push_back(Determinate<PSET>(PSET(box)));
149  }
150  PPL_ASSERT_HEAVY(OK());
151 }
bool OK() const
Checks if all the invariants are satisfied.
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
dimension_type space_dim
The number of dimensions of the enclosing vector space.

Definition at line 321 of file Pointset_Powerset.cc.

References Parma_Polyhedra_Library::Powerset< Parma_Polyhedra_Library::Determinate< PSET > >::begin(), Parma_Polyhedra_Library::Powerset< Parma_Polyhedra_Library::Determinate< PSET > >::end(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::OK(), Parma_Polyhedra_Library::Powerset< D >::reduced, Parma_Polyhedra_Library::Powerset< Parma_Polyhedra_Library::Determinate< PSET > >::reduced, and Parma_Polyhedra_Library::Powerset< D >::sequence.

323  : Base(), space_dim(y.space_dimension()) {
324  Pointset_Powerset& x = *this;
325  for (Pointset_Powerset<C_Polyhedron>::const_iterator i = y.begin(),
326  y_end = y.end(); i != y_end; ++i) {
327  x.sequence.push_back(Determinate<NNC_Polyhedron>
328  (NNC_Polyhedron(i->pointset())));
329  }
330  x.reduced = y.reduced;
331  PPL_ASSERT_HEAVY(x.OK());
332 }
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
dimension_type space_dim
The number of dimensions of the enclosing vector space.

Definition at line 337 of file Pointset_Powerset.cc.

References Parma_Polyhedra_Library::Powerset< Parma_Polyhedra_Library::Determinate< PSET > >::begin(), Parma_Polyhedra_Library::Powerset< Parma_Polyhedra_Library::Determinate< PSET > >::end(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::OK(), Parma_Polyhedra_Library::Powerset< D >::reduced, and Parma_Polyhedra_Library::Powerset< D >::sequence.

339  : Base(), space_dim(y.space_dimension()) {
340  Pointset_Powerset& x = *this;
341  for (Pointset_Powerset<Grid>::const_iterator i = y.begin(),
342  y_end = y.end(); i != y_end; ++i) {
343  x.sequence.push_back(Determinate<NNC_Polyhedron>
344  (NNC_Polyhedron(i->pointset())));
345  }
346  x.reduced = false;
347  PPL_ASSERT_HEAVY(x.OK());
348 }
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
dimension_type space_dim
The number of dimensions of the enclosing vector space.

Definition at line 353 of file Pointset_Powerset.cc.

References Parma_Polyhedra_Library::Powerset< Parma_Polyhedra_Library::Determinate< PSET > >::begin(), Parma_Polyhedra_Library::Powerset< Parma_Polyhedra_Library::Determinate< PSET > >::end(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::OK(), Parma_Polyhedra_Library::Powerset< D >::reduced, and Parma_Polyhedra_Library::Powerset< D >::sequence.

355  : Base(), space_dim(y.space_dimension()) {
356  Pointset_Powerset& x = *this;
357  for (Pointset_Powerset<NNC_Polyhedron>::const_iterator i = y.begin(),
358  y_end = y.end(); i != y_end; ++i) {
359  x.sequence.push_back(Determinate<C_Polyhedron>
360  (C_Polyhedron(i->pointset())));
361  }
362 
363  // Note: this might be non-reduced even when `y' is known to be
364  // omega-reduced, because the constructor of C_Polyhedron, by
365  // enforcing topological closure, may have made different elements
366  // comparable.
367  x.reduced = false;
368  PPL_ASSERT_HEAVY(x.OK());
369 }
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
dimension_type space_dim
The number of dimensions of the enclosing vector space.

Definition at line 61 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Powerset< Parma_Polyhedra_Library::Determinate< PSET > >::begin(), Parma_Polyhedra_Library::Powerset< Parma_Polyhedra_Library::Determinate< PSET > >::end(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::OK(), Parma_Polyhedra_Library::Powerset< D >::reduced, Parma_Polyhedra_Library::Powerset< Parma_Polyhedra_Library::Determinate< PSET > >::reduced, and Parma_Polyhedra_Library::Powerset< D >::sequence.

63  : Base(), space_dim(y.space_dimension()) {
64  Pointset_Powerset& x = *this;
65  for (typename Pointset_Powerset<QH>::const_iterator i = y.begin(),
66  y_end = y.end(); i != y_end; ++i) {
67  x.sequence.push_back(Determinate<NNC_Polyhedron>
68  (NNC_Polyhedron(i->pointset(), complexity)));
69 
70  }
71  // FIXME: If the domain elements can be represented _exactly_ as NNC
72  // polyhedra, then having x.reduced = y.reduced is correct. This is
73  // the case if the domains are both linear and convex which holds
74  // for all the currently supported instantiations except for
75  // Grids; for this reason the Grid specialization has a
76  // separate implementation. For any non-linear or non-convex
77  // domains (e.g., a domain of Intervals with restrictions or a
78  // domain of circles) that may be supported in the future, the
79  // assignment x.reduced = y.reduced will be a bug.
80  x.reduced = y.reduced;
81 
82  PPL_ASSERT_HEAVY(x.OK());
83 }
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
dimension_type space_dim
The number of dimensions of the enclosing vector space.

Member Function Documentation

template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::add_congruence ( const Congruence cg)

Intersects *this with congruence cg.

Exceptions
std::invalid_argumentThrown if *this and congruence cg are topology-incompatible or dimension-incompatible.

Definition at line 193 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Pointset_Powerset< PSET >::add_congruence(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::OK(), Parma_Polyhedra_Library::Powerset< D >::reduced, and Parma_Polyhedra_Library::Powerset< D >::sequence.

Referenced by Parma_Polyhedra_Library::Pointset_Powerset< PSET >::add_congruence().

193  {
194  Pointset_Powerset& x = *this;
195  for (Sequence_iterator si = x.sequence.begin(),
196  s_end = x.sequence.end(); si != s_end; ++si) {
197  si->pointset().add_congruence(cg);
198  }
199  x.reduced = false;
200  PPL_ASSERT_HEAVY(x.OK());
201 }
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::add_congruences ( const Congruence_System cgs)

Intersects *this with the congruences in cgs.

Parameters
cgsThe congruences to intersect with.
Exceptions
std::invalid_argumentThrown if *this and cgs are topology-incompatible or dimension-incompatible.

Definition at line 217 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Pointset_Powerset< PSET >::add_congruences(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::OK(), Parma_Polyhedra_Library::Powerset< D >::reduced, and Parma_Polyhedra_Library::Powerset< D >::sequence.

Referenced by Parma_Polyhedra_Library::Pointset_Powerset< PSET >::add_congruences().

217  {
218  Pointset_Powerset& x = *this;
219  for (Sequence_iterator si = x.sequence.begin(),
220  s_end = x.sequence.end(); si != s_end; ++si) {
221  si->pointset().add_congruences(cgs);
222  }
223  x.reduced = false;
224  PPL_ASSERT_HEAVY(x.OK());
225 }
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::add_constraint ( const Constraint c)

Intersects *this with constraint c.

Exceptions
std::invalid_argumentThrown if *this and constraint c are topology-incompatible or dimension-incompatible.

Definition at line 145 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Pointset_Powerset< PSET >::add_constraint(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::OK(), Parma_Polyhedra_Library::Powerset< D >::reduced, and Parma_Polyhedra_Library::Powerset< D >::sequence.

Referenced by Parma_Polyhedra_Library::Pointset_Powerset< PSET >::add_constraint().

145  {
146  Pointset_Powerset& x = *this;
147  for (Sequence_iterator si = x.sequence.begin(),
148  s_end = x.sequence.end(); si != s_end; ++si) {
149  si->pointset().add_constraint(c);
150  }
151  x.reduced = false;
152  PPL_ASSERT_HEAVY(x.OK());
153 }
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
Coefficient c
Definition: PIP_Tree.cc:64
template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::add_constraints ( const Constraint_System cs)

Intersects *this with the constraints in cs.

Parameters
csThe constraints to intersect with.
Exceptions
std::invalid_argumentThrown if *this and cs are topology-incompatible or dimension-incompatible.

Definition at line 169 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Pointset_Powerset< PSET >::add_constraints(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::OK(), Parma_Polyhedra_Library::Powerset< D >::reduced, and Parma_Polyhedra_Library::Powerset< D >::sequence.

Referenced by Parma_Polyhedra_Library::Pointset_Powerset< PSET >::add_constraints().

169  {
170  Pointset_Powerset& x = *this;
171  for (Sequence_iterator si = x.sequence.begin(),
172  s_end = x.sequence.end(); si != s_end; ++si) {
173  si->pointset().add_constraints(cs);
174  }
175  x.reduced = false;
176  PPL_ASSERT_HEAVY(x.OK());
177 }
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::add_disjunct ( const PSET &  ph)

Adds to *this the disjunct ph.

Exceptions
std::invalid_argumentThrown if *this and ph are dimension-incompatible.

Definition at line 44 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Pointset_Powerset< PSET >::OK(), Parma_Polyhedra_Library::Powerset< D >::reduced, Parma_Polyhedra_Library::Powerset< D >::sequence, and Parma_Polyhedra_Library::Pointset_Powerset< PSET >::space_dimension().

Referenced by Parma_Polyhedra_Library::Pointset_Powerset< PSET >::approximate_partition_aux(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::ascii_load(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::BHZ03_widening_assign(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::check_containment(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::concatenate_assign(), and Parma_Polyhedra_Library::Pointset_Powerset< PSET >::linear_partition_aux().

44  {
45  Pointset_Powerset& x = *this;
46  if (x.space_dimension() != ph.space_dimension()) {
47  std::ostringstream s;
48  s << "PPL::Pointset_Powerset<PSET>::add_disjunct(ph):\n"
49  << "this->space_dimension() == " << x.space_dimension() << ", "
50  << "ph.space_dimension() == " << ph.space_dimension() << ".";
51  throw std::invalid_argument(s.str());
52  }
53  x.sequence.push_back(Determinate<PSET>(ph));
54  x.reduced = false;
55  PPL_ASSERT_HEAVY(x.OK());
56 }
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::add_space_dimensions_and_embed ( dimension_type  m)

Adds m new dimensions to the vector space containing *this and embeds each disjunct in *this in the new space.

Definition at line 265 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Pointset_Powerset< PSET >::add_space_dimensions_and_embed(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::OK(), Parma_Polyhedra_Library::Powerset< D >::sequence, and Parma_Polyhedra_Library::Pointset_Powerset< PSET >::space_dim.

Referenced by Parma_Polyhedra_Library::Pointset_Powerset< PSET >::add_space_dimensions_and_embed().

265  {
266  Pointset_Powerset& x = *this;
267  for (Sequence_iterator si = x.sequence.begin(),
268  s_end = x.sequence.end(); si != s_end; ++si) {
269  si->pointset().add_space_dimensions_and_embed(m);
270  }
271  x.space_dim += m;
272  PPL_ASSERT_HEAVY(x.OK());
273 }
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::add_space_dimensions_and_project ( dimension_type  m)

Adds m new dimensions to the vector space containing *this without embedding the disjuncts in *this in the new space.

Definition at line 277 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Pointset_Powerset< PSET >::add_space_dimensions_and_project(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::OK(), Parma_Polyhedra_Library::Powerset< D >::sequence, and Parma_Polyhedra_Library::Pointset_Powerset< PSET >::space_dim.

Referenced by Parma_Polyhedra_Library::Pointset_Powerset< PSET >::add_space_dimensions_and_project().

277  {
278  Pointset_Powerset& x = *this;
279  for (Sequence_iterator si = x.sequence.begin(),
280  s_end = x.sequence.end(); si != s_end; ++si) {
281  si->pointset().add_space_dimensions_and_project(m);
282  }
283  x.space_dim += m;
284  PPL_ASSERT_HEAVY(x.OK());
285 }
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
template<typename PSET >
dimension_type Parma_Polyhedra_Library::Pointset_Powerset< PSET >::affine_dimension ( ) const

Returns the dimension of the vector space enclosing *this.

Definition at line 511 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Polyhedron::add_constraint(), Parma_Polyhedra_Library::Polyhedron::affine_dimension(), Parma_Polyhedra_Library::Constraint_System::begin(), c, Parma_Polyhedra_Library::EMPTY, Parma_Polyhedra_Library::Constraint_System::end(), Parma_Polyhedra_Library::Constraint::is_equality(), Parma_Polyhedra_Library::Polyhedron::poly_hull_assign(), and Parma_Polyhedra_Library::Powerset< D >::sequence.

511  {
512  // The affine dimension of the powerset is the affine dimension of
513  // the smallest vector space in which it can be embedded.
514  const Pointset_Powerset& x = *this;
515  C_Polyhedron x_ph(space_dim, EMPTY);
516 
517  for (Sequence_const_iterator si = x.sequence.begin(),
518  s_end = x.sequence.end(); si != s_end; ++si) {
519  PSET pi(si->pointset());
520  if (!pi.is_empty()) {
521  C_Polyhedron phi(space_dim);
522  const Constraint_System& cs = pi.minimized_constraints();
523  for (Constraint_System::const_iterator i = cs.begin(),
524  cs_end = cs.end(); i != cs_end; ++i) {
525  const Constraint& c = *i;
526  if (c.is_equality()) {
527  phi.add_constraint(c);
528  }
529  }
530  x_ph.poly_hull_assign(phi);
531  }
532  }
533 
534  return x_ph.affine_dimension();
535 }
The empty element, i.e., the empty set.
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
Coefficient c
Definition: PIP_Tree.cc:64
dimension_type space_dim
The number of dimensions of the enclosing vector space.
Constraint_System_const_iterator const_iterator
Base::Sequence_const_iterator Sequence_const_iterator
template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::affine_image ( Variable  var,
const Linear_Expression expr,
Coefficient_traits::const_reference  denominator = Coefficient_one() 
)

Assigns to *this the affine image of *this under the function mapping variable var to the affine expression specified by expr and denominator.

Parameters
varThe variable to which the affine expression is assigned;
exprThe numerator of the affine expression;
denominatorThe denominator of the affine expression (optional argument with default value 1).
Exceptions
std::invalid_argumentThrown if denominator is zero or if expr and *this are dimension-incompatible or if var is not a space dimension of *this.

Definition at line 377 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Pointset_Powerset< PSET >::affine_image(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::OK(), Parma_Polyhedra_Library::Powerset< D >::reduced, and Parma_Polyhedra_Library::Powerset< D >::sequence.

Referenced by Parma_Polyhedra_Library::Pointset_Powerset< PSET >::affine_image().

380  {
381  Pointset_Powerset& x = *this;
382  for (Sequence_iterator si = x.sequence.begin(),
383  s_end = x.sequence.end(); si != s_end; ++si) {
384  si->pointset().affine_image(var, expr, denominator);
385  // Note that the underlying domain can apply conservative approximation:
386  // that is why it would not be correct to make the loss of reduction
387  // conditional on `var' and `expr'.
388  x.reduced = false;
389  }
390  PPL_ASSERT_HEAVY(x.OK());
391 }
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::affine_preimage ( Variable  var,
const Linear_Expression expr,
Coefficient_traits::const_reference  denominator = Coefficient_one() 
)

Assigns to *this the affine preimage of *this under the function mapping variable var to the affine expression specified by expr and denominator.

Parameters
varThe variable to which the affine expression is assigned;
exprThe numerator of the affine expression;
denominatorThe denominator of the affine expression (optional argument with default value 1).
Exceptions
std::invalid_argumentThrown if denominator is zero or if expr and *this are dimension-incompatible or if var is not a space dimension of *this.

Definition at line 395 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Pointset_Powerset< PSET >::affine_preimage(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::OK(), Parma_Polyhedra_Library::Powerset< D >::reduced, and Parma_Polyhedra_Library::Powerset< D >::sequence.

Referenced by Parma_Polyhedra_Library::Pointset_Powerset< PSET >::affine_preimage().

398  {
399  Pointset_Powerset& x = *this;
400  for (Sequence_iterator si = x.sequence.begin(),
401  s_end = x.sequence.end(); si != s_end; ++si) {
402  si->pointset().affine_preimage(var, expr, denominator);
403  // Note that the underlying domain can apply conservative approximation:
404  // that is why it would not be correct to make the loss of reduction
405  // conditional on `var' and `expr'.
406  x.reduced = false;
407  }
408  PPL_ASSERT_HEAVY(x.OK());
409 }
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
template<typename PSET>
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::ascii_dump ( ) const

Writes to std::cerr an ASCII representation of *this.

template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::ascii_dump ( std::ostream &  s) const

Writes to s an ASCII representation of *this.

Definition at line 1545 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Powerset< D >::begin(), Parma_Polyhedra_Library::Powerset< D >::end(), Parma_Polyhedra_Library::Powerset< D >::size(), and Parma_Polyhedra_Library::Pointset_Powerset< PSET >::space_dim.

1545  {
1546  const Pointset_Powerset& x = *this;
1547  s << "size " << x.size()
1548  << "\nspace_dim " << x.space_dim
1549  << "\n";
1550  for (const_iterator xi = x.begin(), x_end = x.end();
1551  xi != x_end; ++xi) {
1552  xi->pointset().ascii_dump(s);
1553  }
1554 }
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
template<typename PSET >
bool Parma_Polyhedra_Library::Pointset_Powerset< PSET >::ascii_load ( std::istream &  s)

Loads from s an ASCII representation (as produced by ascii_dump(std::ostream&) const) and sets *this accordingly. Returns true if successful, false otherwise.

Definition at line 1560 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Pointset_Powerset< PSET >::add_disjunct(), Parma_Polyhedra_Library::EMPTY, Parma_Polyhedra_Library::Pointset_Powerset< PSET >::OK(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::space_dim, and Parma_Polyhedra_Library::swap().

1560  {
1561  Pointset_Powerset& x = *this;
1562  std::string str;
1563 
1564  if (!(s >> str) || str != "size") {
1565  return false;
1566  }
1567 
1568  size_type sz;
1569 
1570  if (!(s >> sz)) {
1571  return false;
1572  }
1573 
1574  if (!(s >> str) || str != "space_dim") {
1575  return false;
1576  }
1577 
1578  if (!(s >> x.space_dim)) {
1579  return false;
1580  }
1581 
1582  Pointset_Powerset new_x(x.space_dim, EMPTY);
1583  while (sz-- > 0) {
1584  PSET ph;
1585  if (!ph.ascii_load(s)) {
1586  return false;
1587  }
1588  new_x.add_disjunct(ph);
1589  }
1590  swap(x, new_x);
1591 
1592  // Check invariants.
1593  PPL_ASSERT_HEAVY(x.OK());
1594  return true;
1595 }
The empty element, i.e., the empty set.
void swap(Pointset_Powerset< PSET > &x, Pointset_Powerset< PSET > &y)
Swaps x with y.
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
template<typename PSET >
template<typename Widening >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::BGP99_extrapolation_assign ( const Pointset_Powerset< PSET > &  y,
Widening  widen_fun,
unsigned  max_disjuncts 
)

Assigns to *this the result of applying the BGP99 extrapolation operator to *this and y, using the widening function widen_fun and the cardinality threshold max_disjuncts.

Parameters
yA powerset that must definitely entail *this;
widen_funThe widening function to be used on polyhedra objects. It is obtained from the corresponding widening method by using the helper function Parma_Polyhedra_Library::widen_fun_ref. Legal values are, e.g., widen_fun_ref(&Polyhedron::H79_widening_assign) and widen_fun_ref(&Polyhedron::limited_H79_extrapolation_assign, cs);
max_disjunctsThe maximum number of disjuncts occurring in the powerset *this before starting the computation. If this number is exceeded, some of the disjuncts in *this are collapsed (i.e., joined together).
Exceptions
std::invalid_argumentThrown if *this and y are dimension-incompatible.

For a description of the extrapolation operator, see [BGP99] and [BHZ03b].

Definition at line 1336 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Pointset_Powerset< PSET >::BGP99_heuristics_assign(), Parma_Polyhedra_Library::Powerset< D >::collapse(), Parma_Polyhedra_Library::Powerset< Parma_Polyhedra_Library::Determinate< PSET > >::definitely_entails(), and Parma_Polyhedra_Library::Pointset_Powerset< PSET >::pairwise_reduce().

1338  {
1339  // `x' is the current iteration value.
1340  Pointset_Powerset& x = *this;
1341 
1342 #ifndef NDEBUG
1343  {
1344  // We assume that `y' entails `x'.
1345  const Pointset_Powerset<PSET> x_copy = x;
1346  const Pointset_Powerset<PSET> y_copy = y;
1347  PPL_ASSERT_HEAVY(y_copy.definitely_entails(x_copy));
1348  }
1349 #endif
1350 
1351  x.pairwise_reduce();
1352  if (max_disjuncts != 0) {
1353  x.collapse(max_disjuncts);
1354  }
1355  x.BGP99_heuristics_assign(y, widen_fun);
1356 }
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
template<typename PSET >
template<typename Widening >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::BGP99_heuristics_assign ( const Pointset_Powerset< PSET > &  y,
Widening  widen_fun 
)
private

Assigns to *this the result of applying the BGP99 heuristics to *this and y, using the widening function widen_fun.

Definition at line 1282 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Powerset< D >::add_non_bottom_disjunct_preserve_reduction(), Parma_Polyhedra_Library::Powerset< D >::begin(), Parma_Polyhedra_Library::Powerset< Parma_Polyhedra_Library::Determinate< PSET > >::definitely_entails(), Parma_Polyhedra_Library::EMPTY, Parma_Polyhedra_Library::Powerset< D >::end(), Parma_Polyhedra_Library::Powerset< D >::is_omega_reduced(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::OK(), Parma_Polyhedra_Library::Powerset< D >::sequence, Parma_Polyhedra_Library::Powerset< D >::size(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::space_dim, and Parma_Polyhedra_Library::swap().

Referenced by Parma_Polyhedra_Library::Pointset_Powerset< PSET >::BGP99_extrapolation_assign(), and Parma_Polyhedra_Library::Pointset_Powerset< PSET >::BHZ03_widening_assign().

1282  {
1283  // `x' is the current iteration value.
1284  Pointset_Powerset& x = *this;
1285 
1286 #ifndef NDEBUG
1287  {
1288  // We assume that `y' entails `x'.
1289  const Pointset_Powerset<PSET> x_copy = x;
1290  const Pointset_Powerset<PSET> y_copy = y;
1291  PPL_ASSERT_HEAVY(y_copy.definitely_entails(x_copy));
1292  }
1293 #endif
1294 
1295  size_type n = x.size();
1296  Pointset_Powerset new_x(x.space_dim, EMPTY);
1297  std::deque<bool> marked(n, false);
1298  const_iterator x_begin = x.begin();
1299  const_iterator x_end = x.end();
1300  unsigned i_index = 0;
1301  for (const_iterator i = x_begin,
1302  y_begin = y.begin(), y_end = y.end();
1303  i != x_end; ++i, ++i_index) {
1304  for (const_iterator j = y_begin; j != y_end; ++j) {
1305  const PSET& pi = i->pointset();
1306  const PSET& pj = j->pointset();
1307  if (pi.contains(pj)) {
1308  PSET pi_copy = pi;
1309  widen_fun(pi_copy, pj);
1310  new_x.add_non_bottom_disjunct_preserve_reduction(pi_copy);
1311  marked[i_index] = true;
1312  }
1313  }
1314  }
1315  iterator new_x_begin = new_x.begin();
1316  iterator new_x_end = new_x.end();
1317  i_index = 0;
1318  for (const_iterator i = x_begin; i != x_end; ++i, ++i_index) {
1319  if (!marked[i_index]) {
1320  new_x_begin
1321  = new_x.add_non_bottom_disjunct_preserve_reduction(*i,
1322  new_x_begin,
1323  new_x_end);
1324  }
1325  }
1326  using std::swap;
1327  swap(x.sequence, new_x.sequence);
1328  PPL_ASSERT_HEAVY(x.OK());
1329  PPL_ASSERT(x.is_omega_reduced());
1330 }
The empty element, i.e., the empty set.
void swap(CO_Tree &x, CO_Tree &y)
void swap(Pointset_Powerset< PSET > &x, Pointset_Powerset< PSET > &y)
Swaps x with y.
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
template<typename PSET >
template<typename Cert , typename Widening >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::BHZ03_widening_assign ( const Pointset_Powerset< PSET > &  y,
Widening  widen_fun 
)

Assigns to *this the result of computing the BHZ03-widening between *this and y, using the widening function widen_fun certified by the convergence certificate Cert.

Parameters
yThe finite powerset computed in the previous iteration step. It must definitely entail *this;
widen_funThe widening function to be used on disjuncts. It is obtained from the corresponding widening method by using the helper function widen_fun_ref. Legal values are, e.g., widen_fun_ref(&Polyhedron::H79_widening_assign) and widen_fun_ref(&Polyhedron::limited_H79_extrapolation_assign, cs).
Exceptions
std::invalid_argumentThrown if *this and y are dimension-incompatible.
Warning
In order to obtain a proper widening operator, the template parameter Cert should be a finite convergence certificate for the base-level widening function widen_fun; otherwise, an extrapolation operator is obtained. For a description of the methods that should be provided by Cert, see BHRZ03_Certificate or H79_Certificate.

Definition at line 1423 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Pointset_Powerset< PSET >::add_disjunct(), Parma_Polyhedra_Library::Powerset< Parma_Polyhedra_Library::Determinate< PSET > >::begin(), Parma_Polyhedra_Library::Powerset< D >::begin(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::BGP99_heuristics_assign(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::collect_certificates(), Parma_Polyhedra_Library::Powerset< Parma_Polyhedra_Library::Determinate< PSET > >::definitely_entails(), Parma_Polyhedra_Library::EMPTY, Parma_Polyhedra_Library::Powerset< D >::end(), Parma_Polyhedra_Library::Powerset< Parma_Polyhedra_Library::Determinate< PSET > >::end(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::is_cert_multiset_stabilizing(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::pairwise_reduce(), Parma_Polyhedra_Library::Powerset< D >::size(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::space_dim, and Parma_Polyhedra_Library::swap().

1424  {
1425  // `x' is the current iteration value.
1426  Pointset_Powerset& x = *this;
1427 
1428 #ifndef NDEBUG
1429  {
1430  // We assume that `y' entails `x'.
1431  const Pointset_Powerset<PSET> x_copy = x;
1432  const Pointset_Powerset<PSET> y_copy = y;
1433  PPL_ASSERT_HEAVY(y_copy.definitely_entails(x_copy));
1434  }
1435 #endif
1436 
1437  // First widening technique: do nothing.
1438 
1439  // If `y' is the empty collection, do nothing.
1440  PPL_ASSERT(x.size() > 0);
1441  if (y.size() == 0) {
1442  return;
1443  }
1444 
1445  // Compute the poly-hull of `x'.
1446  PSET x_hull(x.space_dim, EMPTY);
1447  for (const_iterator i = x.begin(), x_end = x.end(); i != x_end; ++i) {
1448  x_hull.upper_bound_assign(i->pointset());
1449  }
1450 
1451  // Compute the poly-hull of `y'.
1452  PSET y_hull(y.space_dim, EMPTY);
1453  for (const_iterator i = y.begin(), y_end = y.end(); i != y_end; ++i) {
1454  y_hull.upper_bound_assign(i->pointset());
1455  }
1456  // Compute the certificate for `y_hull'.
1457  const Cert y_hull_cert(y_hull);
1458 
1459  // If the hull is stabilizing, do nothing.
1460  int hull_stabilization = y_hull_cert.compare(x_hull);
1461  if (hull_stabilization == 1) {
1462  return;
1463  }
1464 
1465  // Multiset ordering is only useful when `y' is not a singleton.
1466  const bool y_is_not_a_singleton = y.size() > 1;
1467 
1468  // The multiset certificate for `y':
1469  // we want to be lazy about its computation.
1470  typedef std::map<Cert, size_type, typename Cert::Compare> Cert_Multiset;
1471  Cert_Multiset y_cert_ms;
1472  bool y_cert_ms_computed = false;
1473 
1474  if (hull_stabilization == 0 && y_is_not_a_singleton) {
1475  // Collect the multiset certificate for `y'.
1476  y.collect_certificates(y_cert_ms);
1477  y_cert_ms_computed = true;
1478  // If multiset ordering is stabilizing, do nothing.
1479  if (x.is_cert_multiset_stabilizing(y_cert_ms)) {
1480  return;
1481  }
1482  }
1483 
1484  // Second widening technique: try the BGP99 powerset heuristics.
1485  Pointset_Powerset<PSET> bgp99_heuristics = x;
1486  bgp99_heuristics.BGP99_heuristics_assign(y, widen_fun);
1487 
1488  // Compute the poly-hull of `bgp99_heuristics'.
1489  PSET bgp99_heuristics_hull(x.space_dim, EMPTY);
1490  for (const_iterator i = bgp99_heuristics.begin(),
1491  b_h_end = bgp99_heuristics.end(); i != b_h_end; ++i) {
1492  bgp99_heuristics_hull.upper_bound_assign(i->pointset());
1493  }
1494 
1495  // Check for stabilization and, if successful,
1496  // commit to the result of the extrapolation.
1497  hull_stabilization = y_hull_cert.compare(bgp99_heuristics_hull);
1498  if (hull_stabilization == 1) {
1499  // The poly-hull is stabilizing.
1500  swap(x, bgp99_heuristics);
1501  return;
1502  }
1503  else if (hull_stabilization == 0 && y_is_not_a_singleton) {
1504  // If not already done, compute multiset certificate for `y'.
1505  if (!y_cert_ms_computed) {
1506  y.collect_certificates(y_cert_ms);
1507  y_cert_ms_computed = true;
1508  }
1509  if (bgp99_heuristics.is_cert_multiset_stabilizing(y_cert_ms)) {
1510  swap(x, bgp99_heuristics);
1511  return;
1512  }
1513  // Third widening technique: pairwise-reduction on `bgp99_heuristics'.
1514  // Note that pairwise-reduction does not affect the computation
1515  // of the poly-hulls, so that we only have to check the multiset
1516  // certificate relation.
1517  Pointset_Powerset<PSET> reduced_bgp99_heuristics(bgp99_heuristics);
1518  reduced_bgp99_heuristics.pairwise_reduce();
1519  if (reduced_bgp99_heuristics.is_cert_multiset_stabilizing(y_cert_ms)) {
1520  swap(x, reduced_bgp99_heuristics);
1521  return;
1522  }
1523  }
1524 
1525  // Fourth widening technique: this is applicable only when
1526  // `y_hull' is a proper subset of `bgp99_heuristics_hull'.
1527  if (bgp99_heuristics_hull.strictly_contains(y_hull)) {
1528  // Compute (y_hull \widen bgp99_heuristics_hull).
1529  PSET ph = bgp99_heuristics_hull;
1530  widen_fun(ph, y_hull);
1531  // Compute the difference between `ph' and `bgp99_heuristics_hull'.
1532  ph.difference_assign(bgp99_heuristics_hull);
1533  x.add_disjunct(ph);
1534  return;
1535  }
1536 
1537  // Fall back to the computation of the poly-hull.
1538  Pointset_Powerset<PSET> x_hull_singleton(x.space_dim, EMPTY);
1539  x_hull_singleton.add_disjunct(x_hull);
1540  swap(x, x_hull_singleton);
1541 }
The empty element, i.e., the empty set.
void swap(Pointset_Powerset< PSET > &x, Pointset_Powerset< PSET > &y)
Swaps x with y.
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::bounded_affine_image ( Variable  var,
const Linear_Expression lb_expr,
const Linear_Expression ub_expr,
Coefficient_traits::const_reference  denominator = Coefficient_one() 
)

Assigns to *this the image of *this with respect to the bounded affine relation $\frac{\mathrm{lb\_expr}}{\mathrm{denominator}} \leq \mathrm{var}' \leq \frac{\mathrm{ub\_expr}}{\mathrm{denominator}}$.

Parameters
varThe variable updated by the affine relation;
lb_exprThe numerator of the lower bounding affine expression;
ub_exprThe numerator of the upper bounding affine expression;
denominatorThe (common) denominator for the lower and upper bounding affine expressions (optional argument with default value 1).
Exceptions
std::invalid_argumentThrown if denominator is zero or if lb_expr (resp., ub_expr) and *this are dimension-incompatible or if var is not a space dimension of *this.

Definition at line 479 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Pointset_Powerset< PSET >::bounded_affine_image(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::OK(), Parma_Polyhedra_Library::Powerset< D >::reduced, and Parma_Polyhedra_Library::Powerset< D >::sequence.

Referenced by Parma_Polyhedra_Library::Pointset_Powerset< PSET >::bounded_affine_image().

482  {
483  Pointset_Powerset& x = *this;
484  for (Sequence_iterator si = x.sequence.begin(),
485  s_end = x.sequence.end(); si != s_end; ++si) {
486  si->pointset().bounded_affine_image(var, lb_expr, ub_expr, denominator);
487  x.reduced = false;
488  }
489  PPL_ASSERT_HEAVY(x.OK());
490 }
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::bounded_affine_preimage ( Variable  var,
const Linear_Expression lb_expr,
const Linear_Expression ub_expr,
Coefficient_traits::const_reference  denominator = Coefficient_one() 
)

Assigns to *this the preimage of *this with respect to the bounded affine relation $\frac{\mathrm{lb\_expr}}{\mathrm{denominator}} \leq \mathrm{var}' \leq \frac{\mathrm{ub\_expr}}{\mathrm{denominator}}$.

Parameters
varThe variable updated by the affine relation;
lb_exprThe numerator of the lower bounding affine expression;
ub_exprThe numerator of the upper bounding affine expression;
denominatorThe (common) denominator for the lower and upper bounding affine expressions (optional argument with default value 1).
Exceptions
std::invalid_argumentThrown if denominator is zero or if lb_expr (resp., ub_expr) and *this are dimension-incompatible or if var is not a space dimension of *this.

Definition at line 495 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Pointset_Powerset< PSET >::bounded_affine_preimage(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::OK(), Parma_Polyhedra_Library::Powerset< D >::reduced, and Parma_Polyhedra_Library::Powerset< D >::sequence.

Referenced by Parma_Polyhedra_Library::Pointset_Powerset< PSET >::bounded_affine_preimage().

498  {
499  Pointset_Powerset& x = *this;
500  for (Sequence_iterator si = x.sequence.begin(),
501  s_end = x.sequence.end(); si != s_end; ++si) {
502  si->pointset().bounded_affine_preimage(var, lb_expr, ub_expr,
503  denominator);
504  x.reduced = false;
505  }
506  PPL_ASSERT_HEAVY(x.OK());
507 }
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
template<typename PSET >
bool Parma_Polyhedra_Library::Pointset_Powerset< PSET >::bounds_from_above ( const Linear_Expression expr) const

Returns true if and only if expr is bounded from above in *this.

Exceptions
std::invalid_argumentThrown if expr and *this are dimension-incompatible.

Definition at line 910 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Powerset< D >::omega_reduce(), and Parma_Polyhedra_Library::Powerset< D >::sequence.

910  {
911  const Pointset_Powerset& x = *this;
912  x.omega_reduce();
913  for (Sequence_const_iterator si = x.sequence.begin(),
914  s_end = x.sequence.end(); si != s_end; ++si) {
915  if (!si->pointset().bounds_from_above(expr)) {
916  return false;
917  }
918  }
919  return true;
920 }
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
Base::Sequence_const_iterator Sequence_const_iterator
template<typename PSET >
bool Parma_Polyhedra_Library::Pointset_Powerset< PSET >::bounds_from_below ( const Linear_Expression expr) const

Returns true if and only if expr is bounded from below in *this.

Exceptions
std::invalid_argumentThrown if expr and *this are dimension-incompatible.

Definition at line 925 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Powerset< D >::omega_reduce(), and Parma_Polyhedra_Library::Powerset< D >::sequence.

925  {
926  const Pointset_Powerset& x = *this;
927  x.omega_reduce();
928  for (Sequence_const_iterator si = x.sequence.begin(),
929  s_end = x.sequence.end(); si != s_end; ++si) {
930  if (!si->pointset().bounds_from_below(expr)) {
931  return false;
932  }
933  }
934  return true;
935 }
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
Base::Sequence_const_iterator Sequence_const_iterator
template<typename PSET >
template<typename Cert >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::collect_certificates ( std::map< Cert, size_type, typename Cert::Compare > &  cert_ms) const
private

Records in cert_ms the certificates for this set of disjuncts.

Definition at line 1362 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Powerset< D >::begin(), Parma_Polyhedra_Library::Powerset< D >::end(), and Parma_Polyhedra_Library::Powerset< D >::is_omega_reduced().

Referenced by Parma_Polyhedra_Library::Pointset_Powerset< PSET >::BHZ03_widening_assign().

1363  {
1364  const Pointset_Powerset& x = *this;
1365  PPL_ASSERT(x.is_omega_reduced());
1366  PPL_ASSERT(cert_ms.size() == 0);
1367  for (const_iterator i = x.begin(), end = x.end(); i != end; ++i) {
1368  Cert ph_cert(i->pointset());
1369  ++cert_ms[ph_cert];
1370  }
1371 }
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::concatenate_assign ( const Pointset_Powerset< PSET > &  y)

Assigns to *this the concatenation of *this and y.

The result is obtained by computing the pairwise concatenation of each disjunct in *this with each disjunct in y.

Definition at line 105 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::abandon_expensive_computations, Parma_Polyhedra_Library::Pointset_Powerset< PSET >::add_disjunct(), Parma_Polyhedra_Library::Powerset< D >::begin(), Parma_Polyhedra_Library::Determinate< PSET >::concatenate_assign(), Parma_Polyhedra_Library::EMPTY, Parma_Polyhedra_Library::Powerset< D >::end(), Parma_Polyhedra_Library::Determinate< PSET >::is_bottom(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::OK(), Parma_Polyhedra_Library::Powerset< D >::omega_reduce(), Parma_Polyhedra_Library::Powerset< Parma_Polyhedra_Library::Determinate< PSET > >::sequence, Parma_Polyhedra_Library::Pointset_Powerset< PSET >::space_dim, and Parma_Polyhedra_Library::swap().

105  {
106  Pointset_Powerset& x = *this;
107  // Ensure omega-reduction here, since what follows has quadratic complexity.
108  x.omega_reduce();
109  y.omega_reduce();
110  Pointset_Powerset<PSET> new_x(x.space_dim + y.space_dim, EMPTY);
111  for (const_iterator xi = x.begin(), x_end = x.end(),
112  y_begin = y.begin(), y_end = y.end(); xi != x_end; ) {
113  for (const_iterator yi = y_begin; yi != y_end; ++yi) {
114  Det_PSET zi = *xi;
115  zi.concatenate_assign(*yi);
116  PPL_ASSERT_HEAVY(!zi.is_bottom());
117  new_x.sequence.push_back(zi);
118  }
119  ++xi;
121  && (xi != x_end) && (y_begin != y_end)) {
122  // Hurry up!
123  PSET x_ph = xi->pointset();
124  for (++xi; xi != x_end; ++xi) {
125  x_ph.upper_bound_assign(xi->pointset());
126  }
127  const_iterator yi = y_begin;
128  PSET y_ph = yi->pointset();
129  for (++yi; yi != y_end; ++yi) {
130  y_ph.upper_bound_assign(yi->pointset());
131  }
132  x_ph.concatenate_assign(y_ph);
133  swap(x, new_x);
134  x.add_disjunct(x_ph);
135  PPL_ASSERT_HEAVY(x.OK());
136  return;
137  }
138  }
139  swap(x, new_x);
140  PPL_ASSERT_HEAVY(x.OK());
141 }
The empty element, i.e., the empty set.
void swap(Pointset_Powerset< PSET > &x, Pointset_Powerset< PSET > &y)
Swaps x with y.
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
const Throwable *volatile abandon_expensive_computations
A pointer to an exception object.
Definition: globals.cc:34
template<typename PSET >
bool Parma_Polyhedra_Library::Pointset_Powerset< PSET >::constrains ( Variable  var) const

Returns true if and only if var is constrained in *this.

Exceptions
std::invalid_argumentThrown if var is not a space dimension of *this.
Note
A variable is constrained if there exists a non-redundant disjunct that is constraining the variable: this definition relies on the powerset lattice structure and may be somewhat different from the geometric intuition. For instance, variable $x$ is constrained in the powerset

\[ \mathit{ps} = \bigl\{ \{ x \geq 0 \}, \{ x \leq 0 \} \bigr\}, \]

even though $\mathit{ps}$ is geometrically equal to the whole vector space.

Definition at line 619 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Powerset< D >::begin(), Parma_Polyhedra_Library::Powerset< D >::end(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::is_empty(), Parma_Polyhedra_Library::Powerset< D >::omega_reduce(), Parma_Polyhedra_Library::Variable::space_dimension(), and Parma_Polyhedra_Library::Pointset_Powerset< PSET >::space_dimension().

619  {
620  const Pointset_Powerset& x = *this;
621  // `var' should be one of the dimensions of the powerset.
622  const dimension_type var_space_dim = var.space_dimension();
623  if (x.space_dimension() < var_space_dim) {
624  std::ostringstream s;
625  s << "PPL::Pointset_Powerset<PSET>::constrains(v):\n"
626  << "this->space_dimension() == " << x.space_dimension() << ", "
627  << "v.space_dimension() == " << var_space_dim << ".";
628  throw std::invalid_argument(s.str());
629  }
630  // omega_reduction needed, since a redundant disjunct may constrain var.
631  x.omega_reduce();
632  // An empty powerset constrains all variables.
633  if (x.is_empty()) {
634  return true;
635  }
636  for (const_iterator x_i = x.begin(), x_end = x.end();
637  x_i != x_end; ++x_i) {
638  if (x_i->pointset().constrains(var)) {
639  return true;
640  }
641  }
642  return false;
643 }
size_t dimension_type
An unsigned integral type for representing space dimensions.
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
template<typename PSET >
bool Parma_Polyhedra_Library::Pointset_Powerset< PSET >::contains ( const Pointset_Powerset< PSET > &  y) const

Returns true if and only if each disjunct of y is contained in a disjunct of *this.

Exceptions
std::invalid_argumentThrown if *this and y are topology-incompatible or dimension-incompatible.

Definition at line 782 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Powerset< D >::sequence.

782  {
783  const Pointset_Powerset& x = *this;
784  for (Sequence_const_iterator si = y.sequence.begin(),
785  y_s_end = y.sequence.end(); si != y_s_end; ++si) {
786  const PSET& pi = si->pointset();
787  bool pi_is_contained = false;
788  for (Sequence_const_iterator sj = x.sequence.begin(),
789  x_s_end = x.sequence.end();
790  (sj != x_s_end && !pi_is_contained);
791  ++sj) {
792  const PSET& pj = sj->pointset();
793  if (pj.contains(pi)) {
794  pi_is_contained = true;
795  }
796  }
797  if (!pi_is_contained) {
798  return false;
799  }
800  }
801  return true;
802 }
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
Base::Sequence_const_iterator Sequence_const_iterator
template<typename PSET >
bool Parma_Polyhedra_Library::Pointset_Powerset< PSET >::contains_integer_point ( ) const

Returns true if and only if *this contains at least one integer point.

Definition at line 1190 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Powerset< D >::sequence.

1190  {
1191  const Pointset_Powerset& x = *this;
1192  for (Sequence_const_iterator si = x.sequence.begin(),
1193  s_end = x.sequence.end(); si != s_end; ++si) {
1194  if (si->pointset().contains_integer_point()) {
1195  return true;
1196  }
1197  }
1198  return false;
1199 }
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
Base::Sequence_const_iterator Sequence_const_iterator
template<>
void Parma_Polyhedra_Library::Pointset_Powerset< PPL::NNC_Polyhedron >::difference_assign ( const Pointset_Powerset< PSET > &  y)

Definition at line 34 of file Pointset_Powerset.cc.

References Parma_Polyhedra_Library::Powerset< D >::begin(), Parma_Polyhedra_Library::Powerset< D >::end(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::linear_partition(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::OK(), Parma_Polyhedra_Library::Powerset< D >::omega_reduce(), Parma_Polyhedra_Library::Powerset< D >::reduced, Parma_Polyhedra_Library::Powerset< D >::sequence, Parma_Polyhedra_Library::Affine_Space::swap(), and Parma_Polyhedra_Library::swap().

34  {
35  Pointset_Powerset& x = *this;
36  using std::swap;
37  // Ensure omega-reduction.
38  x.omega_reduce();
39  y.omega_reduce();
40  Sequence new_sequence = x.sequence;
41  for (const_iterator yi = y.begin(), y_end = y.end(); yi != y_end; ++yi) {
42  const NNC_Polyhedron& ph_yi = yi->pointset();
43  Sequence tmp_sequence;
44  for (Sequence_const_iterator itr = new_sequence.begin(),
45  ns_end = new_sequence.end(); itr != ns_end; ++itr) {
46  const std::pair<NNC_Polyhedron, Pointset_Powerset<NNC_Polyhedron> >
47  partition = linear_partition(ph_yi, itr->pointset());
48  const Pointset_Powerset<NNC_Polyhedron>& residues = partition.second;
49  // Append the contents of `residues' to `tmp_sequence'.
50  std::copy(residues.begin(), residues.end(), back_inserter(tmp_sequence));
51  }
52  swap(tmp_sequence, new_sequence);
53  }
54  swap(x.sequence, new_sequence);
55  x.reduced = false;
56  PPL_ASSERT_HEAVY(x.OK());
57 }
void swap(CO_Tree &x, CO_Tree &y)
void swap(Pointset_Powerset< PSET > &x, Pointset_Powerset< PSET > &y)
Swaps x with y.
std::pair< PSET, Pointset_Powerset< NNC_Polyhedron > > linear_partition(const PSET &p, const PSET &q)
Partitions q with respect to p.
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
Base::Sequence_const_iterator Sequence_const_iterator
template<>
void Parma_Polyhedra_Library::Pointset_Powerset< PPL::Grid >::difference_assign ( const Pointset_Powerset< PSET > &  y)

Definition at line 278 of file Pointset_Powerset.cc.

References Parma_Polyhedra_Library::Powerset< D >::begin(), Parma_Polyhedra_Library::Powerset< D >::end(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::OK(), Parma_Polyhedra_Library::Powerset< D >::omega_reduce(), Parma_Polyhedra_Library::Powerset< D >::reduced, Parma_Polyhedra_Library::Powerset< D >::sequence, and Parma_Polyhedra_Library::swap().

278  {
279  Pointset_Powerset& x = *this;
280  using std::swap;
281  // Ensure omega-reduction.
282  x.omega_reduce();
283  y.omega_reduce();
284  Sequence new_sequence = x.sequence;
285  for (const_iterator yi = y.begin(), y_end = y.end(); yi != y_end; ++yi) {
286  const Grid& gr_yi = yi->pointset();
287  Sequence tmp_sequence;
288  for (Sequence_const_iterator itr = new_sequence.begin(),
289  ns_end = new_sequence.end(); itr != ns_end; ++itr) {
290  bool finite_partition;
291  const std::pair<Grid, Pointset_Powerset<Grid> > partition
292  = approximate_partition(gr_yi, itr->pointset(), finite_partition);
293  const Pointset_Powerset<Grid>& residues = partition.second;
294  // Append the contents of `residues' to `tmp_sequence'.
295  std::copy(residues.begin(), residues.end(), back_inserter(tmp_sequence));
296  }
297  swap(tmp_sequence, new_sequence);
298  }
299  swap(x.sequence, new_sequence);
300  x.reduced = false;
301  PPL_ASSERT_HEAVY(x.OK());
302 }
void swap(CO_Tree &x, CO_Tree &y)
void swap(Pointset_Powerset< PSET > &x, Pointset_Powerset< PSET > &y)
Swaps x with y.
std::pair< PPL::Grid, PPL::Pointset_Powerset< PPL::Grid > > approximate_partition(const Grid &p, const Grid &q, bool &finite_partition)
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
Base::Sequence_const_iterator Sequence_const_iterator
template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::difference_assign ( const Pointset_Powerset< PSET > &  y)
inline

Assigns to *this an (a smallest) over-approximation as a powerset of the disjunct domain of the set-theoretical difference of *this and y.

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

Definition at line 304 of file Pointset_Powerset_inlines.hh.

References Parma_Polyhedra_Library::Pointset_Powerset< PSET >::difference_assign().

Referenced by Parma_Polyhedra_Library::Pointset_Powerset< PSET >::difference_assign().

304  {
305  // This code is only used when PSET is an abstraction of NNC_Polyhedron.
306  Pointset_Powerset<NNC_Polyhedron> nnc_this(*this);
308  nnc_this.difference_assign(nnc_y);
309  *this = nnc_this;
310 }
template<>
void Parma_Polyhedra_Library::Pointset_Powerset< NNC_Polyhedron >::difference_assign ( const Pointset_Powerset< PSET > &  y)
template<>
void Parma_Polyhedra_Library::Pointset_Powerset< Grid >::difference_assign ( const Pointset_Powerset< PSET > &  y)
template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::drop_some_non_integer_points ( Complexity_Class  complexity = ANY_COMPLEXITY)

Possibly tightens *this by dropping some points with non-integer coordinates.

Parameters
complexityThe maximal complexity of any algorithms used.
Note
Currently there is no optimality guarantee, not even if complexity is ANY_COMPLEXITY.

Definition at line 680 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Pointset_Powerset< PSET >::drop_some_non_integer_points(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::OK(), Parma_Polyhedra_Library::Powerset< D >::reduced, and Parma_Polyhedra_Library::Powerset< D >::sequence.

Referenced by Parma_Polyhedra_Library::Pointset_Powerset< PSET >::drop_some_non_integer_points().

680  {
681  Pointset_Powerset& x = *this;
682  for (Sequence_iterator si = x.sequence.begin(),
683  s_end = x.sequence.end(); si != s_end; ++si) {
684  si->pointset().drop_some_non_integer_points(complexity);
685  }
686  x.reduced = false;
687  PPL_ASSERT_HEAVY(x.OK());
688 }
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::drop_some_non_integer_points ( const Variables_Set vars,
Complexity_Class  complexity = ANY_COMPLEXITY 
)

Possibly tightens *this by dropping some points with non-integer coordinates for the space dimensions corresponding to vars.

Parameters
varsPoints with non-integer coordinates for these variables/space-dimensions can be discarded.
complexityThe maximal complexity of any algorithms used.
Note
Currently there is no optimality guarantee, not even if complexity is ANY_COMPLEXITY.

Definition at line 666 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Pointset_Powerset< PSET >::drop_some_non_integer_points(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::OK(), Parma_Polyhedra_Library::Powerset< D >::reduced, and Parma_Polyhedra_Library::Powerset< D >::sequence.

667  {
668  Pointset_Powerset& x = *this;
669  for (Sequence_iterator si = x.sequence.begin(),
670  s_end = x.sequence.end(); si != s_end; ++si) {
671  si->pointset().drop_some_non_integer_points(vars, complexity);
672  }
673  x.reduced = false;
674  PPL_ASSERT_HEAVY(x.OK());
675 }
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::expand_space_dimension ( Variable  var,
dimension_type  m 
)

Creates m copies of the space dimension corresponding to var.

Parameters
varThe variable corresponding to the space dimension to be replicated;
mThe number of replicas to be created.
Exceptions
std::invalid_argumentThrown if var does not correspond to a dimension of the vector space.
std::length_errorThrown if adding m new space dimensions would cause the vector space to exceed dimension max_space_dimension().

If *this has space dimension $n$, with $n > 0$, and var has space dimension $k \leq n$, then the $k$-th space dimension is expanded to m new space dimensions $n$, $n+1$, $\dots$, $n+m-1$.

Definition at line 348 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Pointset_Powerset< PSET >::expand_space_dimension(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::OK(), Parma_Polyhedra_Library::Powerset< D >::sequence, and Parma_Polyhedra_Library::Pointset_Powerset< PSET >::space_dim.

Referenced by Parma_Polyhedra_Library::Pointset_Powerset< PSET >::expand_space_dimension().

349  {
350  Pointset_Powerset& x = *this;
351  for (Sequence_iterator si = x.sequence.begin(),
352  s_end = x.sequence.end(); si != s_end; ++si) {
353  si->pointset().expand_space_dimension(var, m);
354  }
355  x.space_dim += m;
356  PPL_ASSERT_HEAVY(x.OK());
357 }
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
template<typename PSET >
memory_size_type Parma_Polyhedra_Library::Pointset_Powerset< PSET >::external_memory_in_bytes ( ) const
inline

Returns a lower bound to the size in bytes of the memory managed by *this.

Definition at line 285 of file Pointset_Powerset_inlines.hh.

References Parma_Polyhedra_Library::external_memory_in_bytes().

285  {
287 }
memory_size_type external_memory_in_bytes() const
Returns a lower bound to the size in bytes of the memory managed by *this.
template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::fold_space_dimensions ( const Variables_Set vars,
Variable  dest 
)

Folds the space dimensions in vars into dest.

Parameters
varsThe set of Variable objects corresponding to the space dimensions to be folded;
destThe variable corresponding to the space dimension that is the destination of the folding operation.
Exceptions
std::invalid_argumentThrown if *this is dimension-incompatible with dest or with one of the Variable objects contained in vars. Also thrown if dest is contained in vars.

If *this has space dimension $n$, with $n > 0$, dest has space dimension $k \leq n$, vars is a set of variables whose maximum space dimension is also less than or equal to $n$, and dest is not a member of vars, then the space dimensions corresponding to variables in vars are folded into the $k$-th space dimension.

Definition at line 361 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Pointset_Powerset< PSET >::OK(), Parma_Polyhedra_Library::Powerset< D >::sequence, and Parma_Polyhedra_Library::Pointset_Powerset< PSET >::space_dim.

362  {
363  Pointset_Powerset& x = *this;
364  Variables_Set::size_type num_folded = vars.size();
365  if (num_folded > 0) {
366  for (Sequence_iterator si = x.sequence.begin(),
367  s_end = x.sequence.end(); si != s_end; ++si) {
368  si->pointset().fold_space_dimensions(vars, dest);
369  }
370  }
371  x.space_dim -= num_folded;
372  PPL_ASSERT_HEAVY(x.OK());
373 }
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::generalized_affine_image ( Variable  var,
Relation_Symbol  relsym,
const Linear_Expression expr,
Coefficient_traits::const_reference  denominator = Coefficient_one() 
)

Assigns to *this the image of *this with respect to the generalized affine relation $\mathrm{var}' \relsym \frac{\mathrm{expr}}{\mathrm{denominator}}$, where $\mathord{\relsym}$ is the relation symbol encoded by relsym.

Parameters
varThe left hand side variable of the generalized affine relation;
relsymThe relation symbol;
exprThe numerator of the right hand side affine expression;
denominatorThe denominator of the right hand side affine expression (optional argument with default value 1).
Exceptions
std::invalid_argumentThrown if denominator is zero or if expr and *this are dimension-incompatible or if var is not a space dimension of *this or if *this is a C_Polyhedron and relsym is a strict relation symbol.

Definition at line 445 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Pointset_Powerset< PSET >::generalized_affine_image(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::OK(), Parma_Polyhedra_Library::Powerset< D >::reduced, and Parma_Polyhedra_Library::Powerset< D >::sequence.

Referenced by Parma_Polyhedra_Library::Pointset_Powerset< PSET >::generalized_affine_image().

448  {
449  Pointset_Powerset& x = *this;
450  for (Sequence_iterator si = x.sequence.begin(),
451  s_end = x.sequence.end(); si != s_end; ++si) {
452  si->pointset().generalized_affine_image(var, relsym, expr, denominator);
453  x.reduced = false;
454  }
455  PPL_ASSERT_HEAVY(x.OK());
456 }
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::generalized_affine_image ( const Linear_Expression lhs,
Relation_Symbol  relsym,
const Linear_Expression rhs 
)

Assigns to *this the image of *this with respect to the generalized affine relation $\mathrm{lhs}' \relsym \mathrm{rhs}$, where $\mathord{\relsym}$ is the relation symbol encoded by relsym.

Parameters
lhsThe left hand side affine expression;
relsymThe relation symbol;
rhsThe right hand side affine expression.
Exceptions
std::invalid_argumentThrown if *this is dimension-incompatible with lhs or rhs or if *this is a C_Polyhedron and relsym is a strict relation symbol.

Definition at line 415 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Pointset_Powerset< PSET >::generalized_affine_image(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::OK(), Parma_Polyhedra_Library::Powerset< D >::reduced, and Parma_Polyhedra_Library::Powerset< D >::sequence.

417  {
418  Pointset_Powerset& x = *this;
419  for (Sequence_iterator si = x.sequence.begin(),
420  s_end = x.sequence.end(); si != s_end; ++si) {
421  si->pointset().generalized_affine_image(lhs, relsym, rhs);
422  x.reduced = false;
423  }
424  PPL_ASSERT_HEAVY(x.OK());
425 }
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::generalized_affine_preimage ( Variable  var,
Relation_Symbol  relsym,
const Linear_Expression expr,
Coefficient_traits::const_reference  denominator = Coefficient_one() 
)

Assigns to *this the preimage of *this with respect to the generalized affine relation $\mathrm{var}' \relsym \frac{\mathrm{expr}}{\mathrm{denominator}}$, where $\mathord{\relsym}$ is the relation symbol encoded by relsym.

Parameters
varThe left hand side variable of the generalized affine relation;
relsymThe relation symbol;
exprThe numerator of the right hand side affine expression;
denominatorThe denominator of the right hand side affine expression (optional argument with default value 1).
Exceptions
std::invalid_argumentThrown if denominator is zero or if expr and *this are dimension-incompatible or if var is not a space dimension of *this or if *this is a C_Polyhedron and relsym is a strict relation symbol.

Definition at line 461 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Pointset_Powerset< PSET >::generalized_affine_preimage(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::OK(), Parma_Polyhedra_Library::Powerset< D >::reduced, and Parma_Polyhedra_Library::Powerset< D >::sequence.

Referenced by Parma_Polyhedra_Library::Pointset_Powerset< PSET >::generalized_affine_preimage().

465  {
466  Pointset_Powerset& x = *this;
467  for (Sequence_iterator si = x.sequence.begin(),
468  s_end = x.sequence.end(); si != s_end; ++si) {
469  si->pointset().generalized_affine_preimage(var, relsym, expr, denominator);
470  x.reduced = false;
471  }
472  PPL_ASSERT_HEAVY(x.OK());
473 }
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::generalized_affine_preimage ( const Linear_Expression lhs,
Relation_Symbol  relsym,
const Linear_Expression rhs 
)

Assigns to *this the preimage of *this with respect to the generalized affine relation $\mathrm{lhs}' \relsym \mathrm{rhs}$, where $\mathord{\relsym}$ is the relation symbol encoded by relsym.

Parameters
lhsThe left hand side affine expression;
relsymThe relation symbol;
rhsThe right hand side affine expression.
Exceptions
std::invalid_argumentThrown if *this is dimension-incompatible with lhs or rhs or if *this is a C_Polyhedron and relsym is a strict relation symbol.

Definition at line 430 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Pointset_Powerset< PSET >::generalized_affine_preimage(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::OK(), Parma_Polyhedra_Library::Powerset< D >::reduced, and Parma_Polyhedra_Library::Powerset< D >::sequence.

432  {
433  Pointset_Powerset& x = *this;
434  for (Sequence_iterator si = x.sequence.begin(),
435  s_end = x.sequence.end(); si != s_end; ++si) {
436  si->pointset().generalized_affine_preimage(lhs, relsym, rhs);
437  x.reduced = false;
438  }
439  PPL_ASSERT_HEAVY(x.OK());
440 }
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
template<>
bool Parma_Polyhedra_Library::Pointset_Powerset< PPL::NNC_Polyhedron >::geometrically_covers ( const Pointset_Powerset< PSET > &  y) const

Definition at line 62 of file Pointset_Powerset.cc.

References Parma_Polyhedra_Library::Powerset< D >::begin(), Parma_Polyhedra_Library::Pointset_Ask_Tell< PSET >::check_containment(), and Parma_Polyhedra_Library::Powerset< D >::end().

62  {
63  const Pointset_Powerset& x = *this;
64  for (const_iterator yi = y.begin(), y_end = y.end();
65  yi != y_end; ++yi) {
66  if (!check_containment(yi->pointset(), x)) {
67  return false;
68  }
69  }
70  return true;
71 }
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
bool check_containment(const NNC_Polyhedron &ph, const Pointset_Powerset< NNC_Polyhedron > &ps)
template<>
bool Parma_Polyhedra_Library::Pointset_Powerset< PPL::Grid >::geometrically_covers ( const Pointset_Powerset< PSET > &  y) const

Definition at line 307 of file Pointset_Powerset.cc.

References Parma_Polyhedra_Library::Powerset< D >::begin(), and Parma_Polyhedra_Library::Powerset< D >::end().

307  {
308  const Pointset_Powerset& x = *this;
309  for (const_iterator yi = y.begin(), y_end = y.end();
310  yi != y_end; ++yi) {
311  if (!check_containment(yi->pointset(), x)) {
312  return false;
313  }
314  }
315  return true;
316 }
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
bool check_containment(const NNC_Polyhedron &ph, const Pointset_Powerset< NNC_Polyhedron > &ps)
template<typename PSET >
bool Parma_Polyhedra_Library::Pointset_Powerset< PSET >::geometrically_covers ( const Pointset_Powerset< PSET > &  y) const
inline

Returns true if and only if *this geometrically covers y, i.e., if any point (in some element) of y is also a point (of some element) of *this.

Exceptions
std::invalid_argumentThrown if *this and y are dimension-incompatible.
Warning
This may be really expensive!

Definition at line 250 of file Pointset_Powerset_inlines.hh.

References Parma_Polyhedra_Library::Pointset_Powerset< PSET >::geometrically_covers().

Referenced by Parma_Polyhedra_Library::Pointset_Powerset< PSET >::geometrically_covers(), and Parma_Polyhedra_Library::Pointset_Powerset< PSET >::geometrically_equals().

250  {
251  // This code is only used when PSET is an abstraction of NNC_Polyhedron.
252  const Pointset_Powerset<NNC_Polyhedron> xx(*this);
254  return xx.geometrically_covers(yy);
255 }
template<>
bool Parma_Polyhedra_Library::Pointset_Powerset< NNC_Polyhedron >::geometrically_covers ( const Pointset_Powerset< PSET > &  y) const
template<>
bool Parma_Polyhedra_Library::Pointset_Powerset< Grid >::geometrically_covers ( const Pointset_Powerset< PSET > &  y) const
template<>
bool Parma_Polyhedra_Library::Pointset_Powerset< Grid >::geometrically_equals ( const Pointset_Powerset< PSET > &  y) const
inline

Definition at line 270 of file Pointset_Powerset_inlines.hh.

References Parma_Polyhedra_Library::Pointset_Powerset< PSET >::geometrically_covers().

270  {
271  const Pointset_Powerset& x = *this;
272  return x.geometrically_covers(y) && y.geometrically_covers(x);
273 }
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
template<>
bool Parma_Polyhedra_Library::Pointset_Powerset< NNC_Polyhedron >::geometrically_equals ( const Pointset_Powerset< PSET > &  y) const
inline

Definition at line 278 of file Pointset_Powerset_inlines.hh.

References Parma_Polyhedra_Library::Pointset_Powerset< PSET >::geometrically_covers().

278  {
279  const Pointset_Powerset& x = *this;
280  return x.geometrically_covers(y) && y.geometrically_covers(x);
281 }
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
template<typename PSET >
bool Parma_Polyhedra_Library::Pointset_Powerset< PSET >::geometrically_equals ( const Pointset_Powerset< PSET > &  y) const
inline

Returns true if and only if *this is geometrically equal to y, i.e., if (the elements of) *this and y contain the same set of points.

Exceptions
std::invalid_argumentThrown if *this and y are dimension-incompatible.
Warning
This may be really expensive!

Definition at line 260 of file Pointset_Powerset_inlines.hh.

References Parma_Polyhedra_Library::Pointset_Powerset< PSET >::geometrically_covers().

260  {
261  // This code is only used when PSET is an abstraction of NNC_Polyhedron.
262  const Pointset_Powerset<NNC_Polyhedron> xx(*this);
264  return xx.geometrically_covers(yy) && yy.geometrically_covers(xx);
265 }
template<typename PSET >
int32_t Parma_Polyhedra_Library::Pointset_Powerset< PSET >::hash_code ( ) const
inline

Returns a 32-bit hash code for *this.

If x and y are such that x == y, then x.hash_code() == y.hash_code().

Definition at line 297 of file Pointset_Powerset_inlines.hh.

References Parma_Polyhedra_Library::hash_code_from_dimension().

297  {
299 }
dimension_type space_dimension() const
Returns the dimension of the vector space enclosing *this.
int32_t hash_code_from_dimension(dimension_type dim)
Returns the hash code for space dimension dim.
template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::intersection_assign ( const Pointset_Powerset< PSET > &  y)
inline

Assigns to *this the intersection of *this and y.

The result is obtained by intersecting each disjunct in *this with each disjunct in y and collecting all these intersections.

Definition at line 221 of file Pointset_Powerset_inlines.hh.

References Parma_Polyhedra_Library::Powerset< D >::pairwise_apply_assign().

Referenced by Parma_Polyhedra_Library::Pointset_Powerset< PSET >::intersection_preserving_enlarge_element().

221  {
222  Pointset_Powerset& x = *this;
223  x.pairwise_apply_assign(y,
224  Det_PSET::lift_op_assign(std::mem_fun_ref(&PSET::intersection_assign)));
225 }
static Binary_Operator_Assign_Lifter< Binary_Operator_Assign > lift_op_assign(Binary_Operator_Assign op_assign)
Helper function returning a Binary_Operator_Assign_Lifter object, also allowing for the deduction of ...
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
template<typename PSET >
bool Parma_Polyhedra_Library::Pointset_Powerset< PSET >::intersection_preserving_enlarge_element ( PSET &  dest) const
private

Assigns to dest a powerset meet-preserving enlargement of itself with respect to *this. If false is returned, then the intersection is empty.

Note
It is assumed that *this and dest are topology-compatible and dimension-compatible.

Definition at line 704 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Pointset_Powerset< PSET >::intersection_assign(), Parma_Polyhedra_Library::Powerset< D >::sequence, Parma_Polyhedra_Library::Pointset_Powerset< PSET >::space_dimension(), Parma_Polyhedra_Library::swap(), and Parma_Polyhedra_Library::UNIVERSE.

Referenced by Parma_Polyhedra_Library::Pointset_Powerset< PSET >::simplify_using_context_assign().

704  {
705  // FIXME: this is just an executable specification.
706  const Pointset_Powerset& context = *this;
707  PPL_ASSERT(context.space_dimension() == dest.space_dimension());
708  bool nonempty_intersection = false;
709  // TODO: maybe use a *sorted* constraint system?
710  PSET enlarged(context.space_dimension(), UNIVERSE);
711  for (Sequence_const_iterator si = context.sequence.begin(),
712  s_end = context.sequence.end(); si != s_end; ++si) {
713  PSET context_i(si->pointset());
714  context_i.intersection_assign(enlarged);
715  PSET enlarged_i(dest);
716  if (enlarged_i.simplify_using_context_assign(context_i)) {
717  nonempty_intersection = true;
718  }
719  // TODO: merge the sorted constraints of `enlarged' and `enlarged_i'?
720  enlarged.intersection_assign(enlarged_i);
721  }
722  swap(dest, enlarged);
723  return nonempty_intersection;
724 }
void swap(Pointset_Powerset< PSET > &x, Pointset_Powerset< PSET > &y)
Swaps x with y.
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
The universe element, i.e., the whole vector space.
Base::Sequence_const_iterator Sequence_const_iterator
template<typename PSET >
bool Parma_Polyhedra_Library::Pointset_Powerset< PSET >::is_bounded ( ) const

Returns true if and only if all elements in *this are bounded.

Definition at line 606 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Powerset< D >::sequence.

606  {
607  const Pointset_Powerset& x = *this;
608  for (Sequence_const_iterator si = x.sequence.begin(),
609  s_end = x.sequence.end(); si != s_end; ++si) {
610  if (!si->pointset().is_bounded()) {
611  return false;
612  }
613  }
614  return true;
615 }
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
Base::Sequence_const_iterator Sequence_const_iterator
template<typename PSET >
template<typename Cert >
bool Parma_Polyhedra_Library::Pointset_Powerset< PSET >::is_cert_multiset_stabilizing ( const std::map< Cert, size_type, typename Cert::Compare > &  y_cert_ms) const
private

Returns true if and only if the current set of disjuncts is stabilizing with respect to the multiset of certificates y_cert_ms.

Definition at line 1377 of file Pointset_Powerset_templates.hh.

Referenced by Parma_Polyhedra_Library::Pointset_Powerset< PSET >::BHZ03_widening_assign().

1378  {
1379  typedef std::map<Cert, size_type, typename Cert::Compare> Cert_Multiset;
1380  Cert_Multiset x_cert_ms;
1381  collect_certificates(x_cert_ms);
1382  typename Cert_Multiset::const_iterator xi = x_cert_ms.begin();
1383  typename Cert_Multiset::const_iterator x_cert_ms_end = x_cert_ms.end();
1384  typename Cert_Multiset::const_iterator yi = y_cert_ms.begin();
1385  typename Cert_Multiset::const_iterator y_cert_ms_end = y_cert_ms.end();
1386  while (xi != x_cert_ms_end && yi != y_cert_ms_end) {
1387  const Cert& xi_cert = xi->first;
1388  const Cert& yi_cert = yi->first;
1389  switch (xi_cert.compare(yi_cert)) {
1390  case 0:
1391  // xi_cert == yi_cert: check the number of multiset occurrences.
1392  {
1393  const size_type& xi_count = xi->second;
1394  const size_type& yi_count = yi->second;
1395  if (xi_count == yi_count) {
1396  // Same number of occurrences: compare the next pair.
1397  ++xi;
1398  ++yi;
1399  }
1400  else {
1401  // Different number of occurrences: can decide ordering.
1402  return xi_count < yi_count;
1403  }
1404  break;
1405  }
1406  case 1:
1407  // xi_cert > yi_cert: it is not stabilizing.
1408  return false;
1409 
1410  case -1:
1411  // xi_cert < yi_cert: it is stabilizing.
1412  return true;
1413  }
1414  }
1415  // Here xi == x_cert_ms_end or yi == y_cert_ms_end.
1416  // Stabilization is achieved if `y_cert_ms' still has other elements.
1417  return yi != y_cert_ms_end;
1418 }
void collect_certificates(std::map< Cert, size_type, typename Cert::Compare > &cert_ms) const
Records in cert_ms the certificates for this set of disjuncts.
template<typename PSET >
bool Parma_Polyhedra_Library::Pointset_Powerset< PSET >::is_discrete ( ) const

Returns true if and only if *this is discrete.

Definition at line 577 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Powerset< D >::sequence.

577  {
578  const Pointset_Powerset& x = *this;
579  for (Sequence_const_iterator si = x.sequence.begin(),
580  s_end = x.sequence.end(); si != s_end; ++si) {
581  if (!si->pointset().is_discrete()) {
582  return false;
583  }
584  }
585  return true;
586 }
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
Base::Sequence_const_iterator Sequence_const_iterator
template<typename PSET >
bool Parma_Polyhedra_Library::Pointset_Powerset< PSET >::is_disjoint_from ( const Pointset_Powerset< PSET > &  y) const

Returns true if and only if *this and y are disjoint.

Exceptions
std::invalid_argumentThrown if x and y are topology-incompatible or dimension-incompatible.

Definition at line 647 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Powerset< D >::sequence.

647  {
648  const Pointset_Powerset& x = *this;
649  for (Sequence_const_iterator si = x.sequence.begin(),
650  x_s_end = x.sequence.end(); si != x_s_end; ++si) {
651  const PSET& pi = si->pointset();
652  for (Sequence_const_iterator sj = y.sequence.begin(),
653  y_s_end = y.sequence.end(); sj != y_s_end; ++sj) {
654  const PSET& pj = sj->pointset();
655  if (!pi.is_disjoint_from(pj)) {
656  return false;
657  }
658  }
659  }
660  return true;
661 }
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
Base::Sequence_const_iterator Sequence_const_iterator
template<typename PSET >
bool Parma_Polyhedra_Library::Pointset_Powerset< PSET >::is_empty ( ) const

Returns true if and only if *this is an empty powerset.

Definition at line 564 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Powerset< D >::sequence.

Referenced by Parma_Polyhedra_Library::Pointset_Powerset< PSET >::constrains(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::maximize(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::minimize(), and Parma_Polyhedra_Library::Pointset_Powerset< PSET >::simplify_using_context_assign().

564  {
565  const Pointset_Powerset& x = *this;
566  for (Sequence_const_iterator si = x.sequence.begin(),
567  s_end = x.sequence.end(); si != s_end; ++si) {
568  if (!si->pointset().is_empty()) {
569  return false;
570  }
571  }
572  return true;
573 }
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
Base::Sequence_const_iterator Sequence_const_iterator
template<typename PSET >
bool Parma_Polyhedra_Library::Pointset_Powerset< PSET >::is_topologically_closed ( ) const

Returns true if and only if all the disjuncts in *this are topologically closed.

Definition at line 590 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Powerset< D >::omega_reduce(), and Parma_Polyhedra_Library::Powerset< D >::sequence.

590  {
591  const Pointset_Powerset& x = *this;
592  // The powerset must be omega-reduced before checking
593  // topological closure.
594  x.omega_reduce();
595  for (Sequence_const_iterator si = x.sequence.begin(),
596  s_end = x.sequence.end(); si != s_end; ++si) {
597  if (!si->pointset().is_topologically_closed()) {
598  return false;
599  }
600  }
601  return true;
602 }
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
Base::Sequence_const_iterator Sequence_const_iterator
template<typename PSET >
bool Parma_Polyhedra_Library::Pointset_Powerset< PSET >::is_universe ( ) const

Returns true if and only if *this is the top element of the powerset lattice.

Definition at line 539 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Powerset< D >::begin(), Parma_Polyhedra_Library::Powerset< D >::end(), Parma_Polyhedra_Library::Powerset< D >::is_omega_reduced(), Parma_Polyhedra_Library::Powerset< D >::size(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::space_dimension(), Parma_Polyhedra_Library::swap(), Parma_Polyhedra_Library::UNIVERSE, and Parma_Polyhedra_Library::Implementation::Boxes::universe.

539  {
540  const Pointset_Powerset& x = *this;
541  // Exploit omega-reduction, if already computed.
542  if (x.is_omega_reduced()) {
543  return x.size() == 1 && x.begin()->pointset().is_universe();
544  }
545 
546  // A powerset is universe iff one of its disjuncts is.
547  for (const_iterator x_i = x.begin(), x_end = x.end();
548  x_i != x_end; ++x_i) {
549  if (x_i->pointset().is_universe()) {
550  // Speculative omega-reduction, if it is worth.
551  if (x.size() > 1) {
552  Pointset_Powerset<PSET> universe(x.space_dimension(), UNIVERSE);
553  Pointset_Powerset& xx = const_cast<Pointset_Powerset&>(x);
554  swap(xx, universe);
555  }
556  return true;
557  }
558  }
559  return false;
560 }
void swap(Pointset_Powerset< PSET > &x, Pointset_Powerset< PSET > &y)
Swaps x with y.
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
The universe element, i.e., the whole vector space.
template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::m_swap ( Pointset_Powerset< PSET > &  y)
inline

Swaps *this with y.

Definition at line 202 of file Pointset_Powerset_inlines.hh.

References Parma_Polyhedra_Library::Pointset_Powerset< PSET >::space_dim, and Parma_Polyhedra_Library::swap().

Referenced by Parma_Polyhedra_Library::Pointset_Powerset< PSET >::swap().

202  {
203  Pointset_Powerset& x = *this;
204  x.Base::m_swap(y);
205  using std::swap;
206  swap(x.space_dim, y.space_dim);
207 }
void swap(CO_Tree &x, CO_Tree &y)
void swap(Pointset_Powerset< PSET > &x, Pointset_Powerset< PSET > &y)
Swaps x with y.
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
template<typename PSET >
template<typename Partial_Function >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::map_space_dimensions ( const Partial_Function pfunc)

Remaps the dimensions of the vector space according to a partial function.

See also Polyhedron::map_space_dimensions.

Definition at line 322 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Powerset< D >::is_bottom(), Parma_Polyhedra_Library::Partial_Function::maps(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::OK(), Parma_Polyhedra_Library::Powerset< D >::reduced, Parma_Polyhedra_Library::Powerset< D >::sequence, and Parma_Polyhedra_Library::Pointset_Powerset< PSET >::space_dim.

322  {
323  Pointset_Powerset& x = *this;
324  if (x.is_bottom()) {
325  dimension_type n = 0;
326  for (dimension_type i = x.space_dim; i-- > 0; ) {
327  dimension_type new_i;
328  if (pfunc.maps(i, new_i)) {
329  ++n;
330  }
331  }
332  x.space_dim = n;
333  }
334  else {
335  Sequence_iterator s_begin = x.sequence.begin();
336  for (Sequence_iterator si = s_begin,
337  s_end = x.sequence.end(); si != s_end; ++si) {
338  si->pointset().map_space_dimensions(pfunc);
339  }
340  x.space_dim = s_begin->pointset().space_dimension();
341  x.reduced = false;
342  }
343  PPL_ASSERT_HEAVY(x.OK());
344 }
size_t dimension_type
An unsigned integral type for representing space dimensions.
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
template<typename PSET >
dimension_type Parma_Polyhedra_Library::Pointset_Powerset< PSET >::max_space_dimension ( )
inlinestatic

Returns the maximum space dimension a Pointset_Powerset<PSET> can handle.

Definition at line 48 of file Pointset_Powerset_inlines.hh.

References Parma_Polyhedra_Library::max_space_dimension().

48  {
50 }
dimension_type max_space_dimension()
Returns the maximum space dimension this library can handle.
template<typename PSET >
bool Parma_Polyhedra_Library::Pointset_Powerset< PSET >::maximize ( const Linear_Expression expr,
Coefficient sup_n,
Coefficient sup_d,
bool &  maximum 
) const

Returns true if and only if *this is not empty and expr is bounded from above in *this, in which case the supremum value is computed.

Parameters
exprThe linear expression to be maximized subject to *this;
sup_nThe numerator of the supremum value;
sup_dThe denominator of the supremum value;
maximumtrue if and only if the supremum is also the maximum value.
Exceptions
std::invalid_argumentThrown if expr and *this are dimension-incompatible.

If *this is empty or expr is not bounded from above, false is returned and sup_n, sup_d and maximum are left untouched.

Definition at line 939 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Pointset_Powerset< PSET >::is_empty(), Parma_Polyhedra_Library::Powerset< D >::omega_reduce(), PPL_DIRTY_TEMP_COEFFICIENT, and Parma_Polyhedra_Library::Powerset< D >::sequence.

942  {
943  const Pointset_Powerset& x = *this;
944  x.omega_reduce();
945  if (x.is_empty()) {
946  return false;
947  }
948 
949  bool first = true;
950 
951  PPL_DIRTY_TEMP_COEFFICIENT(best_sup_n);
952  PPL_DIRTY_TEMP_COEFFICIENT(best_sup_d);
953  best_sup_n = 0;
954  best_sup_d = 1;
955  bool best_max = false;
956 
957  PPL_DIRTY_TEMP_COEFFICIENT(iter_sup_n);
958  PPL_DIRTY_TEMP_COEFFICIENT(iter_sup_d);
959  iter_sup_n = 0;
960  iter_sup_d = 1;
961  bool iter_max = false;
962 
964 
965  for (Sequence_const_iterator si = x.sequence.begin(),
966  s_end = x.sequence.end(); si != s_end; ++si) {
967  if (!si->pointset().maximize(expr, iter_sup_n, iter_sup_d, iter_max)) {
968  return false;
969  }
970  else
971  if (first) {
972  first = false;
973  best_sup_n = iter_sup_n;
974  best_sup_d = iter_sup_d;
975  best_max = iter_max;
976  }
977  else {
978  tmp = (best_sup_n * iter_sup_d) - (iter_sup_n * best_sup_d);
979  if (tmp < 0) {
980  best_sup_n = iter_sup_n;
981  best_sup_d = iter_sup_d;
982  best_max = iter_max;
983  }
984  else if (tmp == 0) {
985  best_max = (best_max || iter_max);
986  }
987  }
988  }
989  sup_n = best_sup_n;
990  sup_d = best_sup_d;
991  maximum = best_max;
992  return true;
993 }
#define PPL_DIRTY_TEMP_COEFFICIENT(id)
Declare a local variable named id, of type Coefficient, and containing an unknown initial value...
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
Base::Sequence_const_iterator Sequence_const_iterator
template<typename PSET >
bool Parma_Polyhedra_Library::Pointset_Powerset< PSET >::maximize ( const Linear_Expression expr,
Coefficient sup_n,
Coefficient sup_d,
bool &  maximum,
Generator g 
) const

Returns true if and only if *this is not empty and expr is bounded from above in *this, in which case the supremum value and a point where expr reaches it are computed.

Parameters
exprThe linear expression to be maximized subject to *this;
sup_nThe numerator of the supremum value;
sup_dThe denominator of the supremum value;
maximumtrue if and only if the supremum is also the maximum value;
gWhen maximization succeeds, will be assigned the point or closure point where expr reaches its supremum value.
Exceptions
std::invalid_argumentThrown if expr and *this are dimension-incompatible.

If *this is empty or expr is not bounded from above, false is returned and sup_n, sup_d, maximum and g are left untouched.

Definition at line 997 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Pointset_Powerset< PSET >::is_empty(), Parma_Polyhedra_Library::Powerset< D >::omega_reduce(), PPL_DIRTY_TEMP_COEFFICIENT, and Parma_Polyhedra_Library::Powerset< D >::sequence.

1001  {
1002  const Pointset_Powerset& x = *this;
1003  x.omega_reduce();
1004  if (x.is_empty()) {
1005  return false;
1006  }
1007 
1008  bool first = true;
1009 
1010  PPL_DIRTY_TEMP_COEFFICIENT(best_sup_n);
1011  PPL_DIRTY_TEMP_COEFFICIENT(best_sup_d);
1012  best_sup_n = 0;
1013  best_sup_d = 1;
1014  bool best_max = false;
1015  Generator best_g = point();
1016 
1017  PPL_DIRTY_TEMP_COEFFICIENT(iter_sup_n);
1018  PPL_DIRTY_TEMP_COEFFICIENT(iter_sup_d);
1019  iter_sup_n = 0;
1020  iter_sup_d = 1;
1021  bool iter_max = false;
1022  Generator iter_g = point();
1023 
1025 
1026  for (Sequence_const_iterator si = x.sequence.begin(),
1027  s_end = x.sequence.end(); si != s_end; ++si) {
1028  if (!si->pointset().maximize(expr,
1029  iter_sup_n, iter_sup_d, iter_max, iter_g)) {
1030  return false;
1031  }
1032  else {
1033  if (first) {
1034  first = false;
1035  best_sup_n = iter_sup_n;
1036  best_sup_d = iter_sup_d;
1037  best_max = iter_max;
1038  best_g = iter_g;
1039  }
1040  else {
1041  tmp = (best_sup_n * iter_sup_d) - (iter_sup_n * best_sup_d);
1042  if (tmp < 0) {
1043  best_sup_n = iter_sup_n;
1044  best_sup_d = iter_sup_d;
1045  best_max = iter_max;
1046  best_g = iter_g;
1047  }
1048  else if (tmp == 0) {
1049  best_max = (best_max || iter_max);
1050  best_g = iter_g;
1051  }
1052  }
1053  }
1054  }
1055  sup_n = best_sup_n;
1056  sup_d = best_sup_d;
1057  maximum = best_max;
1058  g = best_g;
1059  return true;
1060 }
#define PPL_DIRTY_TEMP_COEFFICIENT(id)
Declare a local variable named id, of type Coefficient, and containing an unknown initial value...
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
Base::Sequence_const_iterator Sequence_const_iterator
template<typename PSET >
bool Parma_Polyhedra_Library::Pointset_Powerset< PSET >::minimize ( const Linear_Expression expr,
Coefficient inf_n,
Coefficient inf_d,
bool &  minimum 
) const

Returns true if and only if *this is not empty and expr is bounded from below in *this, in which case the infimum value is computed.

Parameters
exprThe linear expression to be minimized subject to *this;
inf_nThe numerator of the infimum value;
inf_dThe denominator of the infimum value;
minimumtrue if and only if the infimum is also the minimum value.
Exceptions
std::invalid_argumentThrown if expr and *this are dimension-incompatible.

If *this is empty or expr is not bounded from below, false is returned and inf_n, inf_d and minimum are left untouched.

Definition at line 1064 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Pointset_Powerset< PSET >::is_empty(), Parma_Polyhedra_Library::Powerset< D >::omega_reduce(), PPL_DIRTY_TEMP_COEFFICIENT, and Parma_Polyhedra_Library::Powerset< D >::sequence.

1067  {
1068  const Pointset_Powerset& x = *this;
1069  x.omega_reduce();
1070  if (x.is_empty()) {
1071  return false;
1072  }
1073 
1074  bool first = true;
1075 
1076  PPL_DIRTY_TEMP_COEFFICIENT(best_inf_n);
1077  PPL_DIRTY_TEMP_COEFFICIENT(best_inf_d);
1078  best_inf_n = 0;
1079  best_inf_d = 1;
1080  bool best_min = false;
1081 
1082  PPL_DIRTY_TEMP_COEFFICIENT(iter_inf_n);
1083  PPL_DIRTY_TEMP_COEFFICIENT(iter_inf_d);
1084  iter_inf_n = 0;
1085  iter_inf_d = 1;
1086  bool iter_min = false;
1087 
1089 
1090  for (Sequence_const_iterator si = x.sequence.begin(),
1091  s_end = x.sequence.end(); si != s_end; ++si) {
1092  if (!si->pointset().minimize(expr, iter_inf_n, iter_inf_d, iter_min)) {
1093  return false;
1094  }
1095  else {
1096  if (first) {
1097  first = false;
1098  best_inf_n = iter_inf_n;
1099  best_inf_d = iter_inf_d;
1100  best_min = iter_min;
1101  }
1102  else {
1103  tmp = (best_inf_n * iter_inf_d) - (iter_inf_n * best_inf_d);
1104  if (tmp > 0) {
1105  best_inf_n = iter_inf_n;
1106  best_inf_d = iter_inf_d;
1107  best_min = iter_min;
1108  }
1109  else if (tmp == 0) {
1110  best_min = (best_min || iter_min);
1111  }
1112  }
1113  }
1114  }
1115  inf_n = best_inf_n;
1116  inf_d = best_inf_d;
1117  minimum = best_min;
1118  return true;
1119 }
#define PPL_DIRTY_TEMP_COEFFICIENT(id)
Declare a local variable named id, of type Coefficient, and containing an unknown initial value...
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
Base::Sequence_const_iterator Sequence_const_iterator
template<typename PSET >
bool Parma_Polyhedra_Library::Pointset_Powerset< PSET >::minimize ( const Linear_Expression expr,
Coefficient inf_n,
Coefficient inf_d,
bool &  minimum,
Generator g 
) const

Returns true if and only if *this is not empty and expr is bounded from below in *this, in which case the infimum value and a point where expr reaches it are computed.

Parameters
exprThe linear expression to be minimized subject to *this;
inf_nThe numerator of the infimum value;
inf_dThe denominator of the infimum value;
minimumtrue if and only if the infimum is also the minimum value;
gWhen minimization succeeds, will be assigned a point or closure point where expr reaches its infimum value.
Exceptions
std::invalid_argumentThrown if expr and *this are dimension-incompatible.

If *this is empty or expr is not bounded from below, false is returned and inf_n, inf_d, minimum and g are left untouched.

Definition at line 1123 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Pointset_Powerset< PSET >::is_empty(), Parma_Polyhedra_Library::Powerset< D >::omega_reduce(), PPL_DIRTY_TEMP_COEFFICIENT, and Parma_Polyhedra_Library::Powerset< D >::sequence.

1127  {
1128  const Pointset_Powerset& x = *this;
1129  x.omega_reduce();
1130  if (x.is_empty()) {
1131  return false;
1132  }
1133 
1134  bool first = true;
1135 
1136  PPL_DIRTY_TEMP_COEFFICIENT(best_inf_n);
1137  PPL_DIRTY_TEMP_COEFFICIENT(best_inf_d);
1138  best_inf_n = 0;
1139  best_inf_d = 1;
1140  bool best_min = false;
1141  Generator best_g = point();
1142 
1143  PPL_DIRTY_TEMP_COEFFICIENT(iter_inf_n);
1144  PPL_DIRTY_TEMP_COEFFICIENT(iter_inf_d);
1145  iter_inf_n = 0;
1146  iter_inf_d = 1;
1147  bool iter_min = false;
1148  Generator iter_g = point();
1149 
1151 
1152  for (Sequence_const_iterator si = x.sequence.begin(),
1153  s_end = x.sequence.end(); si != s_end; ++si) {
1154  if (!si->pointset().minimize(expr,
1155  iter_inf_n, iter_inf_d, iter_min, iter_g)) {
1156  return false;
1157  }
1158  else {
1159  if (first) {
1160  first = false;
1161  best_inf_n = iter_inf_n;
1162  best_inf_d = iter_inf_d;
1163  best_min = iter_min;
1164  best_g = iter_g;
1165  }
1166  else {
1167  tmp = (best_inf_n * iter_inf_d) - (iter_inf_n * best_inf_d);
1168  if (tmp > 0) {
1169  best_inf_n = iter_inf_n;
1170  best_inf_d = iter_inf_d;
1171  best_min = iter_min;
1172  best_g = iter_g;
1173  }
1174  else if (tmp == 0) {
1175  best_min = (best_min || iter_min);
1176  best_g = iter_g;
1177  }
1178  }
1179  }
1180  }
1181  inf_n = best_inf_n;
1182  inf_d = best_inf_d;
1183  minimum = best_min;
1184  g = best_g;
1185  return true;
1186 }
#define PPL_DIRTY_TEMP_COEFFICIENT(id)
Declare a local variable named id, of type Coefficient, and containing an unknown initial value...
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
Base::Sequence_const_iterator Sequence_const_iterator
template<typename PSET >
bool Parma_Polyhedra_Library::Pointset_Powerset< PSET >::OK ( ) const

Checks if all the invariants are satisfied.

Definition at line 1599 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Powerset< D >::begin(), Parma_Polyhedra_Library::Powerset< D >::end(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::space_dim, and Parma_Polyhedra_Library::Pointset_Powerset< PSET >::space_dimension().

Referenced by Parma_Polyhedra_Library::Pointset_Powerset< PSET >::add_congruence(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::add_congruences(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::add_constraint(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::add_constraints(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::add_disjunct(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::add_space_dimensions_and_embed(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::add_space_dimensions_and_project(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::affine_image(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::affine_preimage(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::ascii_load(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::BGP99_heuristics_assign(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::bounded_affine_image(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::bounded_affine_preimage(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::concatenate_assign(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::difference_assign(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::drop_some_non_integer_points(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::expand_space_dimension(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::fold_space_dimensions(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::generalized_affine_image(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::generalized_affine_preimage(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::map_space_dimensions(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::pairwise_reduce(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::Pointset_Powerset(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::refine_with_congruence(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::refine_with_congruences(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::refine_with_constraint(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::refine_with_constraints(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::remove_higher_space_dimensions(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::remove_space_dimensions(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::simplify_using_context_assign(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::topological_closure_assign(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::unconstrain(), and Parma_Polyhedra_Library::Pointset_Powerset< PSET >::wrap_assign().

1599  {
1600  const Pointset_Powerset& x = *this;
1601  for (const_iterator xi = x.begin(), x_end = x.end(); xi != x_end; ++xi) {
1602  const PSET& pi = xi->pointset();
1603  if (pi.space_dimension() != x.space_dim) {
1604 #ifndef NDEBUG
1605  std::cerr << "Space dimension mismatch: is " << pi.space_dimension()
1606  << " in an element of the sequence,\nshould be "
1607  << x.space_dim << "."
1608  << std::endl;
1609 #endif
1610  return false;
1611  }
1612  }
1613  return x.Base::OK();
1614 }
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
template<typename PSET>
template<typename QH >
Pointset_Powerset<PSET>& Parma_Polyhedra_Library::Pointset_Powerset< PSET >::operator= ( const Pointset_Powerset< QH > &  y)
inline

Definition at line 212 of file Pointset_Powerset_inlines.hh.

References Parma_Polyhedra_Library::swap().

212  {
213  Pointset_Powerset& x = *this;
214  Pointset_Powerset<PSET> ps(y);
215  swap(x, ps);
216  return x;
217 }
void swap(Pointset_Powerset< PSET > &x, Pointset_Powerset< PSET > &y)
Swaps x with y.
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
template<typename PSET >
Pointset_Powerset< PSET > & Parma_Polyhedra_Library::Pointset_Powerset< PSET >::operator= ( const Pointset_Powerset< PSET > &  y)
inline

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

Definition at line 193 of file Pointset_Powerset_inlines.hh.

References Parma_Polyhedra_Library::Pointset_Powerset< PSET >::space_dim.

193  {
194  Pointset_Powerset& x = *this;
195  x.Base::operator=(y);
196  x.space_dim = y.space_dim;
197  return x;
198 }
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
template<typename PSET>
template<typename QH >
Pointset_Powerset& Parma_Polyhedra_Library::Pointset_Powerset< PSET >::operator= ( const Pointset_Powerset< QH > &  y)

Conversion assignment: the type QH of the disjuncts in the source powerset is different from PSET (*this and y can be dimension-incompatible).

template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::pairwise_reduce ( )

Assign to *this the result of (recursively) merging together the pairs of disjuncts whose upper-bound is the same as their set-theoretical union.

On exit, for all the pairs $\cP$, $\cQ$ of different disjuncts in *this, we have $\cP \uplus \cQ \neq \cP \union \cQ$.

Definition at line 1222 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Powerset< D >::add_non_bottom_disjunct_preserve_reduction(), Parma_Polyhedra_Library::Powerset< D >::begin(), Parma_Polyhedra_Library::EMPTY, Parma_Polyhedra_Library::Powerset< D >::end(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::OK(), Parma_Polyhedra_Library::Powerset< D >::omega_reduce(), Parma_Polyhedra_Library::Powerset< D >::sequence, Parma_Polyhedra_Library::Powerset< D >::size(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::space_dim, and Parma_Polyhedra_Library::swap().

Referenced by Parma_Polyhedra_Library::Pointset_Powerset< PSET >::BGP99_extrapolation_assign(), and Parma_Polyhedra_Library::Pointset_Powerset< PSET >::BHZ03_widening_assign().

1222  {
1223  Pointset_Powerset& x = *this;
1224  // It is wise to omega-reduce before pairwise-reducing.
1225  x.omega_reduce();
1226 
1227  size_type n = x.size();
1228  size_type deleted;
1229  do {
1230  Pointset_Powerset new_x(x.space_dim, EMPTY);
1231  std::deque<bool> marked(n, false);
1232  deleted = 0;
1233  Sequence_iterator s_begin = x.sequence.begin();
1234  Sequence_iterator s_end = x.sequence.end();
1235  unsigned si_index = 0;
1236  for (Sequence_iterator si = s_begin; si != s_end; ++si, ++si_index) {
1237  if (marked[si_index]) {
1238  continue;
1239  }
1240  PSET& pi = si->pointset();
1241  Sequence_const_iterator sj = si;
1242  unsigned sj_index = si_index;
1243  for (++sj, ++sj_index; sj != s_end; ++sj, ++sj_index) {
1244  if (marked[sj_index]) {
1245  continue;
1246  }
1247  const PSET& pj = sj->pointset();
1248  if (pi.upper_bound_assign_if_exact(pj)) {
1249  marked[si_index] = true;
1250  marked[sj_index] = true;
1251  new_x.add_non_bottom_disjunct_preserve_reduction(pi);
1252  ++deleted;
1253  goto next;
1254  }
1255  }
1256  next:
1257  ;
1258  }
1259  iterator new_x_begin = new_x.begin();
1260  iterator new_x_end = new_x.end();
1261  unsigned xi_index = 0;
1262  for (const_iterator xi = x.begin(),
1263  x_end = x.end(); xi != x_end; ++xi, ++xi_index) {
1264  if (!marked[xi_index]) {
1265  new_x_begin
1266  = new_x.add_non_bottom_disjunct_preserve_reduction(*xi,
1267  new_x_begin,
1268  new_x_end);
1269  }
1270  }
1271  using std::swap;
1272  swap(x.sequence, new_x.sequence);
1273  n -= deleted;
1274  } while (deleted > 0);
1275  PPL_ASSERT_HEAVY(x.OK());
1276 }
The empty element, i.e., the empty set.
void swap(CO_Tree &x, CO_Tree &y)
void swap(Pointset_Powerset< PSET > &x, Pointset_Powerset< PSET > &y)
Swaps x with y.
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
Base::Sequence_const_iterator Sequence_const_iterator
template<typename PSET>
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::print ( ) const

Prints *this to std::cerr using operator<<.

template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::refine_with_congruence ( const Congruence cg)

Use the congruence cg to refine *this.

Parameters
cgThe congruence to be used for refinement.
Exceptions
std::invalid_argumentThrown if *this and cg are dimension-incompatible.

Definition at line 205 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Pointset_Powerset< PSET >::OK(), Parma_Polyhedra_Library::Powerset< D >::reduced, Parma_Polyhedra_Library::Pointset_Powerset< PSET >::refine_with_congruence(), and Parma_Polyhedra_Library::Powerset< D >::sequence.

Referenced by Parma_Polyhedra_Library::Pointset_Powerset< PSET >::refine_with_congruence().

205  {
206  Pointset_Powerset& x = *this;
207  for (Sequence_iterator si = x.sequence.begin(),
208  s_end = x.sequence.end(); si != s_end; ++si) {
209  si->pointset().refine_with_congruence(cg);
210  }
211  x.reduced = false;
212  PPL_ASSERT_HEAVY(x.OK());
213 }
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::refine_with_congruences ( const Congruence_System cgs)

Use the congruences in cgs to refine *this.

Parameters
cgsThe congruences to be used for refinement.
Exceptions
std::invalid_argumentThrown if *this and cgs are dimension-incompatible.

Definition at line 229 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Pointset_Powerset< PSET >::OK(), Parma_Polyhedra_Library::Powerset< D >::reduced, Parma_Polyhedra_Library::Pointset_Powerset< PSET >::refine_with_congruences(), and Parma_Polyhedra_Library::Powerset< D >::sequence.

Referenced by Parma_Polyhedra_Library::Pointset_Powerset< PSET >::refine_with_congruences().

229  {
230  Pointset_Powerset& x = *this;
231  for (Sequence_iterator si = x.sequence.begin(),
232  s_end = x.sequence.end(); si != s_end; ++si) {
233  si->pointset().refine_with_congruences(cgs);
234  }
235  x.reduced = false;
236  PPL_ASSERT_HEAVY(x.OK());
237 }
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::refine_with_constraint ( const Constraint c)

Use the constraint c to refine *this.

Parameters
cThe constraint to be used for refinement.
Exceptions
std::invalid_argumentThrown if *this and c are dimension-incompatible.

Definition at line 157 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Pointset_Powerset< PSET >::OK(), Parma_Polyhedra_Library::Powerset< D >::reduced, Parma_Polyhedra_Library::Pointset_Powerset< PSET >::refine_with_constraint(), and Parma_Polyhedra_Library::Powerset< D >::sequence.

Referenced by Parma_Polyhedra_Library::Pointset_Powerset< PSET >::refine_with_constraint().

157  {
158  Pointset_Powerset& x = *this;
159  for (Sequence_iterator si = x.sequence.begin(),
160  s_end = x.sequence.end(); si != s_end; ++si) {
161  si->pointset().refine_with_constraint(c);
162  }
163  x.reduced = false;
164  PPL_ASSERT_HEAVY(x.OK());
165 }
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
Coefficient c
Definition: PIP_Tree.cc:64
template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::refine_with_constraints ( const Constraint_System cs)

Use the constraints in cs to refine *this.

Parameters
csThe constraints to be used for refinement.
Exceptions
std::invalid_argumentThrown if *this and cs are dimension-incompatible.

Definition at line 181 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Pointset_Powerset< PSET >::OK(), Parma_Polyhedra_Library::Powerset< D >::reduced, Parma_Polyhedra_Library::Pointset_Powerset< PSET >::refine_with_constraints(), and Parma_Polyhedra_Library::Powerset< D >::sequence.

Referenced by Parma_Polyhedra_Library::Pointset_Powerset< PSET >::refine_with_constraints().

181  {
182  Pointset_Powerset& x = *this;
183  for (Sequence_iterator si = x.sequence.begin(),
184  s_end = x.sequence.end(); si != s_end; ++si) {
185  si->pointset().refine_with_constraints(cs);
186  }
187  x.reduced = false;
188  PPL_ASSERT_HEAVY(x.OK());
189 }
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
template<typename PSET >
Poly_Con_Relation Parma_Polyhedra_Library::Pointset_Powerset< PSET >::relation_with ( const Constraint c) const
inline

Returns the relations holding between the powerset *this and the constraint c.

Exceptions
std::invalid_argumentThrown if *this and constraint c are dimension-incompatible.

Definition at line 237 of file Pointset_Powerset_inlines.hh.

237  {
238  return relation_with_aux(c);
239 }
Coefficient c
Definition: PIP_Tree.cc:64
Poly_Con_Relation relation_with_aux(const Cons_or_Congr &c) const
Template helper: common implementation for constraints and congruences.
template<typename PSET >
Poly_Gen_Relation Parma_Polyhedra_Library::Pointset_Powerset< PSET >::relation_with ( const Generator g) const

Returns the relations holding between the powerset *this and the generator g.

Exceptions
std::invalid_argumentThrown if *this and generator g are dimension-incompatible.

Definition at line 893 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Poly_Gen_Relation::implies(), Parma_Polyhedra_Library::Poly_Gen_Relation::nothing(), Parma_Polyhedra_Library::Powerset< D >::sequence, and Parma_Polyhedra_Library::Poly_Gen_Relation::subsumes().

893  {
894  const Pointset_Powerset& x = *this;
895 
896  for (Sequence_const_iterator si = x.sequence.begin(),
897  s_end = x.sequence.end(); si != s_end; ++si) {
898  Poly_Gen_Relation relation_i = si->pointset().relation_with(g);
899  if (relation_i.implies(Poly_Gen_Relation::subsumes())) {
901  }
902  }
903 
905 }
static Poly_Gen_Relation subsumes()
Adding the generator would not change the polyhedron.
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
static Poly_Gen_Relation nothing()
The assertion that says nothing.
Base::Sequence_const_iterator Sequence_const_iterator
template<typename PSET >
Poly_Con_Relation Parma_Polyhedra_Library::Pointset_Powerset< PSET >::relation_with ( const Congruence cg) const
inline

Returns the relations holding between the powerset *this and the congruence c.

Exceptions
std::invalid_argumentThrown if *this and congruence c are dimension-incompatible.

Definition at line 243 of file Pointset_Powerset_inlines.hh.

243  {
244  return relation_with_aux(cg);
245 }
Poly_Con_Relation relation_with_aux(const Cons_or_Congr &c) const
Template helper: common implementation for constraints and congruences.
template<typename PSET >
template<typename Cons_or_Congr >
Poly_Con_Relation Parma_Polyhedra_Library::Pointset_Powerset< PSET >::relation_with_aux ( const Cons_or_Congr &  c) const
private

Template helper: common implementation for constraints and congruences.

Definition at line 834 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Poly_Con_Relation::implies(), Parma_Polyhedra_Library::Poly_Con_Relation::is_disjoint(), Parma_Polyhedra_Library::Poly_Con_Relation::is_included(), Parma_Polyhedra_Library::Poly_Con_Relation::nothing(), Parma_Polyhedra_Library::Poly_Con_Relation::saturates(), Parma_Polyhedra_Library::Powerset< D >::sequence, and Parma_Polyhedra_Library::Poly_Con_Relation::strictly_intersects().

834  {
835  const Pointset_Powerset& x = *this;
836 
837  /* *this is included in c if every disjunct is included in c */
838  bool is_included = true;
839  /* *this is disjoint with c if every disjunct is disjoint with c */
840  bool is_disjoint = true;
841  /* *this strictly_intersects with c if:
842  - some disjunct strictly intersects with c
843  or
844  - there exists two disjoints d1 and d2
845  such that d1 is included in c and d2 is disjoint with c
846  */
847  bool is_strictly_intersecting = false;
848  bool included_once = false;
849  bool disjoint_once = false;
850  /* *this saturates c if all disjuncts saturate c */
851  bool saturates = true;
852  for (Sequence_const_iterator si = x.sequence.begin(),
853  s_end = x.sequence.end(); si != s_end; ++si) {
854  Poly_Con_Relation relation_i = si->pointset().relation_with(c);
855  if (relation_i.implies(Poly_Con_Relation::is_included())) {
856  included_once = true;
857  }
858  else {
859  is_included = false;
860  }
861  if (relation_i.implies(Poly_Con_Relation::is_disjoint())) {
862  disjoint_once = true;
863  }
864  else {
865  is_disjoint = false;
866  }
867  if (relation_i.implies(Poly_Con_Relation::strictly_intersects())) {
868  is_strictly_intersecting = true;
869  }
870  if (!relation_i.implies(Poly_Con_Relation::saturates())) {
871  saturates = false;
872  }
873  }
874 
875  Poly_Con_Relation result = Poly_Con_Relation::nothing();
876  if (is_included) {
877  result = result && Poly_Con_Relation::is_included();
878  }
879  if (is_disjoint) {
880  result = result && Poly_Con_Relation::is_disjoint();
881  }
882  if (is_strictly_intersecting || (included_once && disjoint_once)) {
883  result = result && Poly_Con_Relation::strictly_intersects();
884  }
885  if (saturates) {
886  result = result && Poly_Con_Relation::saturates();
887  }
888  return result;
889 }
static Poly_Con_Relation is_disjoint()
The polyhedron and the set of points satisfying the constraint are disjoint.
static Poly_Con_Relation is_included()
The polyhedron is included in the set of points satisfying the constraint.
static Poly_Con_Relation saturates()
The polyhedron is included in the set of points saturating the constraint.
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
Coefficient c
Definition: PIP_Tree.cc:64
static Poly_Con_Relation nothing()
The assertion that says nothing.
static Poly_Con_Relation strictly_intersects()
The polyhedron intersects the set of points satisfying the constraint, but it is not included in it...
Base::Sequence_const_iterator Sequence_const_iterator
template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::remove_higher_space_dimensions ( dimension_type  new_dimension)

Removes the higher space dimensions so that the resulting space will have dimension new_dimension.

Exceptions
std::invalid_argumentThrown if new_dimensions is greater than the space dimension of *this.

Definition at line 306 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Pointset_Powerset< PSET >::OK(), Parma_Polyhedra_Library::Powerset< D >::reduced, Parma_Polyhedra_Library::Pointset_Powerset< PSET >::remove_higher_space_dimensions(), Parma_Polyhedra_Library::Powerset< D >::sequence, and Parma_Polyhedra_Library::Pointset_Powerset< PSET >::space_dim.

Referenced by Parma_Polyhedra_Library::Pointset_Powerset< PSET >::remove_higher_space_dimensions().

306  {
307  Pointset_Powerset& x = *this;
308  if (new_dimension < x.space_dim) {
309  for (Sequence_iterator si = x.sequence.begin(),
310  s_end = x.sequence.end(); si != s_end; ++si) {
311  si->pointset().remove_higher_space_dimensions(new_dimension);
312  x.reduced = false;
313  }
314  x.space_dim = new_dimension;
315  PPL_ASSERT_HEAVY(x.OK());
316  }
317 }
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::remove_space_dimensions ( const Variables_Set vars)

Removes all the specified space dimensions.

Parameters
varsThe set of Variable objects corresponding to the space dimensions to be removed.
Exceptions
std::invalid_argumentThrown if *this is dimension-incompatible with one of the Variable objects contained in vars.

Definition at line 289 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Pointset_Powerset< PSET >::OK(), Parma_Polyhedra_Library::Powerset< D >::reduced, Parma_Polyhedra_Library::Powerset< D >::sequence, and Parma_Polyhedra_Library::Pointset_Powerset< PSET >::space_dim.

289  {
290  Pointset_Powerset& x = *this;
291  Variables_Set::size_type num_removed = vars.size();
292  if (num_removed > 0) {
293  for (Sequence_iterator si = x.sequence.begin(),
294  s_end = x.sequence.end(); si != s_end; ++si) {
295  si->pointset().remove_space_dimensions(vars);
296  x.reduced = false;
297  }
298  x.space_dim -= num_removed;
299  PPL_ASSERT_HEAVY(x.OK());
300  }
301 }
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
template<typename PSET >
bool Parma_Polyhedra_Library::Pointset_Powerset< PSET >::simplify_using_context_assign ( const Pointset_Powerset< PSET > &  y)

Assigns to *this a meet-preserving simplification of *this with respect to y. If false is returned, then the intersection is empty.

Exceptions
std::invalid_argumentThrown if *this and y are topology-incompatible or dimension-incompatible.

Definition at line 729 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Pointset_Powerset< PSET >::intersection_preserving_enlarge_element(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::is_empty(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::OK(), Parma_Polyhedra_Library::Powerset< D >::omega_reduce(), Parma_Polyhedra_Library::Powerset< D >::reduced, Parma_Polyhedra_Library::Powerset< D >::sequence, and Parma_Polyhedra_Library::Powerset< D >::size().

729  {
730  Pointset_Powerset& x = *this;
731 
732  // Omega reduction is required.
733  // TODO: check whether it would be more efficient to Omega-reduce x
734  // during the simplification process: when examining *si, we check
735  // if it has been made redundant by any of the elements preceding it
736  // (which have been already simplified).
737  x.omega_reduce();
738  if (x.is_empty()) {
739  return false;
740  }
741  y.omega_reduce();
742  if (y.is_empty()) {
743  x = y;
744  return false;
745  }
746 
747  if (y.size() == 1) {
748  // More efficient, special handling of the singleton context case.
749  const PSET& y_i = y.sequence.begin()->pointset();
750  for (Sequence_iterator si = x.sequence.begin(),
751  s_end = x.sequence.end(); si != s_end; ) {
752  PSET& x_i = si->pointset();
753  if (x_i.simplify_using_context_assign(y_i)) {
754  ++si;
755  }
756  else {
757  // Intersection is empty: drop the disjunct.
758  si = x.sequence.erase(si);
759  }
760  }
761  }
762  else {
763  // The context is not a singleton.
764  for (Sequence_iterator si = x.sequence.begin(),
765  s_end = x.sequence.end(); si != s_end; ) {
766  if (y.intersection_preserving_enlarge_element(si->pointset())) {
767  ++si;
768  }
769  else {
770  // Intersection with `*si' is empty: drop the disjunct.
771  si = x.sequence.erase(si);
772  }
773  }
774  }
775  x.reduced = false;
776  PPL_ASSERT_HEAVY(x.OK());
777  return !x.sequence.empty();
778 }
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
template<typename PSET >
bool Parma_Polyhedra_Library::Pointset_Powerset< PSET >::strictly_contains ( const Pointset_Powerset< PSET > &  y) const

Returns true if and only if each disjunct of y is strictly contained in a disjunct of *this.

Exceptions
std::invalid_argumentThrown if *this and y are topology-incompatible or dimension-incompatible.

Definition at line 806 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Powerset< D >::omega_reduce(), and Parma_Polyhedra_Library::Powerset< D >::sequence.

806  {
807  /* omega reduction ensures that a disjunct of y cannot be strictly
808  contained in one disjunct and also contained but not strictly
809  contained in another disjunct of *this */
810  const Pointset_Powerset& x = *this;
811  x.omega_reduce();
812  for (Sequence_const_iterator si = y.sequence.begin(),
813  y_s_end = y.sequence.end(); si != y_s_end; ++si) {
814  const PSET& pi = si->pointset();
815  bool pi_is_strictly_contained = false;
816  for (Sequence_const_iterator sj = x.sequence.begin(),
817  x_s_end = x.sequence.end();
818  (sj != x_s_end && !pi_is_strictly_contained); ++sj) {
819  const PSET& pj = sj->pointset();
820  if (pj.strictly_contains(pi)) {
821  pi_is_strictly_contained = true;
822  }
823  }
824  if (!pi_is_strictly_contained) {
825  return false;
826  }
827  }
828  return true;
829 }
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
Base::Sequence_const_iterator Sequence_const_iterator
template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::time_elapse_assign ( const Pointset_Powerset< PSET > &  y)
inline

Assigns to *this the result of computing the time-elapse between *this and y.

The result is obtained by computing the pairwise time elapse of each disjunct in *this with each disjunct in y.

Definition at line 229 of file Pointset_Powerset_inlines.hh.

References Parma_Polyhedra_Library::Powerset< D >::pairwise_apply_assign().

229  {
230  Pointset_Powerset& x = *this;
231  x.pairwise_apply_assign(y,
232  Det_PSET::lift_op_assign(std::mem_fun_ref(&PSET::time_elapse_assign)));
233 }
static Binary_Operator_Assign_Lifter< Binary_Operator_Assign > lift_op_assign(Binary_Operator_Assign op_assign)
Helper function returning a Binary_Operator_Assign_Lifter object, also allowing for the deduction of ...
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::topological_closure_assign ( )

Assigns to *this its topological closure.

Definition at line 692 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Pointset_Powerset< PSET >::OK(), Parma_Polyhedra_Library::Powerset< D >::sequence, and Parma_Polyhedra_Library::Pointset_Powerset< PSET >::topological_closure_assign().

Referenced by Parma_Polyhedra_Library::Pointset_Powerset< PSET >::topological_closure_assign().

692  {
693  Pointset_Powerset& x = *this;
694  for (Sequence_iterator si = x.sequence.begin(),
695  s_end = x.sequence.end(); si != s_end; ++si) {
696  si->pointset().topological_closure_assign();
697  }
698  PPL_ASSERT_HEAVY(x.OK());
699 }
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
template<typename PSET >
memory_size_type Parma_Polyhedra_Library::Pointset_Powerset< PSET >::total_memory_in_bytes ( ) const
inline

Returns a lower bound to the total size in bytes of the memory occupied by *this.

Definition at line 291 of file Pointset_Powerset_inlines.hh.

References Parma_Polyhedra_Library::external_memory_in_bytes().

291  {
292  return sizeof(*this) + external_memory_in_bytes();
293 }
memory_size_type external_memory_in_bytes() const
Returns a lower bound to the size in bytes of the memory managed by *this.
template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::unconstrain ( Variable  var)

Computes the cylindrification of *this with respect to space dimension var, assigning the result to *this.

Parameters
varThe space dimension that will be unconstrained.
Exceptions
std::invalid_argumentThrown if var is not a space dimension of *this.

Definition at line 241 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Pointset_Powerset< PSET >::OK(), Parma_Polyhedra_Library::Powerset< D >::reduced, Parma_Polyhedra_Library::Powerset< D >::sequence, and Parma_Polyhedra_Library::Pointset_Powerset< PSET >::unconstrain().

Referenced by Parma_Polyhedra_Library::Pointset_Powerset< PSET >::unconstrain().

241  {
242  Pointset_Powerset& x = *this;
243  for (Sequence_iterator si = x.sequence.begin(),
244  s_end = x.sequence.end(); si != s_end; ++si) {
245  si->pointset().unconstrain(var);
246  x.reduced = false;
247  }
248  PPL_ASSERT_HEAVY(x.OK());
249 }
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::unconstrain ( const Variables_Set vars)

Computes the cylindrification of *this with respect to the set of space dimensions vars, assigning the result to *this.

Parameters
varsThe set of space dimension that will be unconstrained.
Exceptions
std::invalid_argumentThrown if *this is dimension-incompatible with one of the Variable objects contained in vars.

Definition at line 253 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Pointset_Powerset< PSET >::OK(), Parma_Polyhedra_Library::Powerset< D >::reduced, Parma_Polyhedra_Library::Powerset< D >::sequence, and Parma_Polyhedra_Library::Pointset_Powerset< PSET >::unconstrain().

253  {
254  Pointset_Powerset& x = *this;
255  for (Sequence_iterator si = x.sequence.begin(),
256  s_end = x.sequence.end(); si != s_end; ++si) {
257  si->pointset().unconstrain(vars);
258  x.reduced = false;
259  }
260  PPL_ASSERT_HEAVY(x.OK());
261 }
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.
template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::wrap_assign ( const Variables_Set vars,
Bounded_Integer_Type_Width  w,
Bounded_Integer_Type_Representation  r,
Bounded_Integer_Type_Overflow  o,
const Constraint_System cs_p = 0,
unsigned  complexity_threshold = 16,
bool  wrap_individually = true 
)

Wraps the specified dimensions of the vector space.

Parameters
varsThe set of Variable objects corresponding to the space dimensions to be wrapped.
wThe width of the bounded integer type corresponding to all the dimensions to be wrapped.
rThe representation of the bounded integer type corresponding to all the dimensions to be wrapped.
oThe overflow behavior of the bounded integer type corresponding to all the dimensions to be wrapped.
cs_pPossibly null pointer to a constraint system whose variables are contained in vars. If *cs_p depends on variables not in vars, the behavior is undefined. When non-null, the pointed-to constraint system is assumed to represent the conditional or looping construct guard with respect to which wrapping is performed. Since wrapping requires the computation of upper bounds and due to non-distributivity of constraint refinement over upper bounds, passing a constraint system in this way can be more precise than refining the result of the wrapping operation with the constraints in *cs_p.
complexity_thresholdA precision parameter of the wrapping operator: higher values result in possibly improved precision.
wrap_individuallytrue if the dimensions should be wrapped individually (something that results in much greater efficiency to the detriment of precision).
Exceptions
std::invalid_argumentThrown if *cs_p is dimension-incompatible with vars, or if *this is dimension-incompatible vars or with *cs_p.

Definition at line 1203 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Pointset_Powerset< PSET >::OK(), Parma_Polyhedra_Library::Powerset< D >::reduced, Parma_Polyhedra_Library::Powerset< D >::sequence, and Parma_Polyhedra_Library::Pointset_Powerset< PSET >::wrap_assign().

Referenced by Parma_Polyhedra_Library::Pointset_Powerset< PSET >::wrap_assign().

1209  {
1210  Pointset_Powerset& x = *this;
1211  for (Sequence_iterator si = x.sequence.begin(),
1212  s_end = x.sequence.end(); si != s_end; ++si) {
1213  si->pointset().wrap_assign(vars, w, r, o, cs_p,
1214  complexity_threshold, wrap_individually);
1215  }
1216  x.reduced = false;
1217  PPL_ASSERT_HEAVY(x.OK());
1218 }
Pointset_Powerset(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Powerset.

Friends And Related Function Documentation

template<typename PSET>
std::pair< PPL::Grid, PPL::Pointset_Powerset< PPL::Grid > > approximate_partition ( const Grid p,
const Grid q,
bool &  finite_partition 
)
related

Definition at line 194 of file Pointset_Powerset.cc.

References Parma_Polyhedra_Library::Congruence_System::begin(), Parma_Polyhedra_Library::Grid::congruences(), Parma_Polyhedra_Library::EMPTY, Parma_Polyhedra_Library::Congruence_System::end(), Parma_Polyhedra_Library::Grid::minimized_congruences(), and Parma_Polyhedra_Library::Grid::space_dimension().

195  {
196  using namespace PPL;
197  finite_partition = true;
198  Pointset_Powerset<Grid> r(p.space_dimension(), EMPTY);
199  // Ensure that the congruence system of q is minimized
200  // before copying and calling approximate_partition_aux().
201  (void) q.minimized_congruences();
202  Grid gr = q;
203  const Congruence_System& p_congruences = p.congruences();
204  for (Congruence_System::const_iterator i = p_congruences.begin(),
205  p_congruences_end = p_congruences.end();
206  i != p_congruences_end; ++i) {
207  if (!approximate_partition_aux(*i, gr, r)) {
208  finite_partition = false;
209  const Pointset_Powerset<Grid> s(q);
210  return std::make_pair(gr, s);
211  }
212  }
213  return std::make_pair(gr, r);
214 }
The empty element, i.e., the empty set.
The entire library is confined to this namespace.
Definition: version.hh:61
bool approximate_partition_aux(const PPL::Congruence &c, PPL::Grid &gr, PPL::Pointset_Powerset< PPL::Grid > &r)
Uses the congruence c to approximately partition the grid gr.
template<typename PSET>
std::pair< Grid, Pointset_Powerset< Grid > > approximate_partition ( const Grid p,
const Grid q,
bool &  finite_partition 
)
related

Partitions the grid q with respect to grid p if and only if such a partition is finite.

Let p and q be two grids. The function returns an object r of type std::pair<PSET, Pointset_Powerset<Grid> > such that

  • r.first is the intersection of p and q;
  • If there is a finite partition of q with respect to p the Boolean finite_partition is set to true and r.second has the property that all its elements are pairwise disjoint and disjoint from p and the set-theoretical union of r.first with all the elements of r.second gives q (i.e., r is the representation of a partition of q).
  • Otherwise the Boolean finite_partition is set to false and the singleton set that contains q is stored in r.secondr.
template<typename PSET>
bool approximate_partition_aux ( const PPL::Congruence c,
PPL::Grid gr,
PPL::Pointset_Powerset< PPL::Grid > &  r 
)
related

Uses the congruence c to approximately partition the grid gr.

On exit, the intersection of gr and congruence c is stored in gr, whereas a finite set of grids whose set-theoretic union contains the intersection of gr with the negation of c is added, as a set of new disjuncts, to the powerset r.

Definition at line 133 of file Pointset_Powerset.cc.

References Parma_Polyhedra_Library::Grid::add_congruence(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::add_disjunct(), Parma_Polyhedra_Library::Grid::congruences(), Parma_Polyhedra_Library::Congruence::expression(), Parma_Polyhedra_Library::Congruence::inhomogeneous_term(), Parma_Polyhedra_Library::Grid::is_empty(), Parma_Polyhedra_Library::Boundary_NS::le(), Parma_Polyhedra_Library::Congruence::modulus(), Parma_Polyhedra_Library::Congruence_System::num_equalities(), Parma_Polyhedra_Library::Congruence_System::num_proper_congruences(), PPL_DIRTY_TEMP_COEFFICIENT, and Parma_Polyhedra_Library::rem_assign().

135  {
136  using namespace PPL;
137  const Coefficient& c_modulus = c.modulus();
138  const Grid gr_copy(gr);
139  gr.add_congruence(c);
140  if (gr.is_empty()) {
141  r.add_disjunct(gr_copy);
142  return true;
143  }
144 
145  const Congruence_System cgs = gr.congruences();
146  const Congruence_System cgs_copy = gr_copy.congruences();
147  // When c is an equality, not satisfied by Grid gr
148  // then add gr to the set r. There is no finite
149  // partition in this case.
150  if (c_modulus == 0) {
151  if (cgs.num_equalities() != cgs_copy.num_equalities()) {
152  r.add_disjunct(gr_copy);
153  return false;
154  }
155  return true;
156  }
157 
158  // When c is a proper congruence but, in gr, this direction has
159  // no congruence, then add gr to the set r. There is no finite
160  // partition in this case.
161  if (cgs.num_proper_congruences() != cgs_copy.num_proper_congruences()) {
162  r.add_disjunct(gr_copy);
163  return false;
164  }
165 
166  // When c is a proper congruence and gr also is discrete
167  // in this direction, then there is a finite partition and that
168  // is added to r.
169  const Coefficient& c_inhomogeneous_term = c.inhomogeneous_term();
170  Linear_Expression le(c.expression());
171  le -= c_inhomogeneous_term;
173  rem_assign(n, c_inhomogeneous_term, c_modulus);
174  if (n < 0) {
175  n += c_modulus;
176  }
178  for (i = c_modulus; i-- > 0; ) {
179  if (i != n) {
180  Grid gr_tmp(gr_copy);
181  gr_tmp.add_congruence((le+i %= 0) / c_modulus);
182  if (!gr_tmp.is_empty()) {
183  r.add_disjunct(gr_tmp);
184  }
185  }
186  }
187  return true;
188 }
Coefficient_traits::const_reference modulus() const
Returns a const reference to the modulus of *this.
const Congruence_System & congruences() const
Returns the system of congruences.
Definition: Grid_public.cc:300
#define PPL_DIRTY_TEMP_COEFFICIENT(id)
Declare a local variable named id, of type Coefficient, and containing an unknown initial value...
expr_type expression() const
Partial read access to the (adapted) internal expression.
Coefficient_traits::const_reference inhomogeneous_term() const
Returns the inhomogeneous term of *this.
void rem_assign(GMP_Integer &x, const GMP_Integer &y, const GMP_Integer &z)
PPL_COEFFICIENT_TYPE Coefficient
An alias for easily naming the type of PPL coefficients.
The entire library is confined to this namespace.
Definition: version.hh:61
void add_disjunct(const PSET &ph)
Adds to *this the disjunct ph.
void add_congruence(const Congruence &cg)
Adds a copy of congruence cg to *this.
bool le(Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
bool is_empty() const
Returns true if and only if *this is an empty grid.
Definition: Grid_public.cc:742
template<typename PSET>
bool check_containment ( const NNC_Polyhedron ph,
const Pointset_Powerset< NNC_Polyhedron > &  ps 
)
related

Definition at line 75 of file Pointset_Powerset.cc.

References Parma_Polyhedra_Library::Pointset_Powerset< PSET >::add_disjunct(), Parma_Polyhedra_Library::Powerset< Parma_Polyhedra_Library::Determinate< PSET > >::begin(), Parma_Polyhedra_Library::Polyhedron::contains(), Parma_Polyhedra_Library::EMPTY, Parma_Polyhedra_Library::Powerset< Parma_Polyhedra_Library::Determinate< PSET > >::end(), Parma_Polyhedra_Library::Polyhedron::is_disjoint_from(), Parma_Polyhedra_Library::Polyhedron::is_empty(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::linear_partition(), and Parma_Polyhedra_Library::Polyhedron::space_dimension().

76  {
77  if (ph.is_empty()) {
78  return true;
79  }
80  Pointset_Powerset<NNC_Polyhedron> tmp(ph.space_dimension(), EMPTY);
81  tmp.add_disjunct(ph);
82  for (Pointset_Powerset<NNC_Polyhedron>::const_iterator
83  i = ps.begin(), ps_end = ps.end(); i != ps_end; ++i) {
84  const NNC_Polyhedron& pi = i->pointset();
85  for (Pointset_Powerset<NNC_Polyhedron>::iterator
86  j = tmp.begin(); j != tmp.end(); ) {
87  const NNC_Polyhedron& pj = j->pointset();
88  if (pi.contains(pj)) {
89  j = tmp.drop_disjunct(j);
90  }
91  else {
92  ++j;
93  }
94  }
95  if (tmp.empty()) {
96  return true;
97  }
98  else {
99  Pointset_Powerset<NNC_Polyhedron> new_disjuncts(ph.space_dimension(),
100  EMPTY);
101  for (Pointset_Powerset<NNC_Polyhedron>::iterator
102  j = tmp.begin(); j != tmp.end(); ) {
103  const NNC_Polyhedron& pj = j->pointset();
104  if (pj.is_disjoint_from(pi)) {
105  ++j;
106  }
107  else {
108  const std::pair<NNC_Polyhedron, Pointset_Powerset<NNC_Polyhedron> >
109  partition = linear_partition(pi, pj);
110  new_disjuncts.upper_bound_assign(partition.second);
111  j = tmp.drop_disjunct(j);
112  }
113  }
114  tmp.upper_bound_assign(new_disjuncts);
115  }
116  }
117  return false;
118 }
The empty element, i.e., the empty set.
std::pair< PSET, Pointset_Powerset< NNC_Polyhedron > > linear_partition(const PSET &p, const PSET &q)
Partitions q with respect to p.
template<typename PSET>
bool check_containment ( const Grid ph,
const Pointset_Powerset< Grid > &  ps 
)
related

Definition at line 218 of file Pointset_Powerset.cc.

References Parma_Polyhedra_Library::Pointset_Powerset< PSET >::add_disjunct(), Parma_Polyhedra_Library::Powerset< Parma_Polyhedra_Library::Determinate< PSET > >::begin(), Parma_Polyhedra_Library::Grid::contains(), Parma_Polyhedra_Library::EMPTY, Parma_Polyhedra_Library::Powerset< Parma_Polyhedra_Library::Determinate< PSET > >::end(), Parma_Polyhedra_Library::Grid::is_disjoint_from(), Parma_Polyhedra_Library::Grid::is_empty(), and Parma_Polyhedra_Library::Grid::space_dimension().

219  {
220  if (ph.is_empty()) {
221  return true;
222  }
223  Pointset_Powerset<Grid> tmp(ph.space_dimension(), EMPTY);
224  tmp.add_disjunct(ph);
225  for (Pointset_Powerset<Grid>::const_iterator
226  i = ps.begin(), ps_end = ps.end(); i != ps_end; ++i) {
227  const Grid& pi = i->pointset();
228  for (Pointset_Powerset<Grid>::iterator
229  j = tmp.begin(); j != tmp.end(); ) {
230  const Grid& pj = j->pointset();
231  if (pi.contains(pj)) {
232  j = tmp.drop_disjunct(j);
233  }
234  else {
235  ++j;
236  }
237  }
238  if (tmp.empty()) {
239  return true;
240  }
241  else {
242  Pointset_Powerset<Grid> new_disjuncts(ph.space_dimension(),
243  EMPTY);
244  for (Pointset_Powerset<Grid>::iterator
245  j = tmp.begin(); j != tmp.end(); ) {
246  const Grid& pj = j->pointset();
247  if (pj.is_disjoint_from(pi)) {
248  ++j;
249  }
250  else {
251  bool finite_partition;
252  const std::pair<Grid, Pointset_Powerset<Grid> >
253  partition = approximate_partition(pi, pj, finite_partition);
254 
255  // If there is a finite partition, then we add the new
256  // disjuncts to the temporary set of disjuncts and drop pj.
257  // If there is no finite partition, then by the
258  // specification of approximate_partition(), we can
259  // ignore checking the remaining temporary disjuncts as they
260  // will all have the same lines and equalities and therefore
261  // also not have a finite partition with respect to pi.
262  if (!finite_partition) {
263  break;
264  }
265  new_disjuncts.upper_bound_assign(partition.second);
266  j = tmp.drop_disjunct(j);
267  }
268  }
269  tmp.upper_bound_assign(new_disjuncts);
270  }
271  }
272  return false;
273 }
The empty element, i.e., the empty set.
std::pair< PPL::Grid, PPL::Pointset_Powerset< PPL::Grid > > approximate_partition(const Grid &p, const Grid &q, bool &finite_partition)
template<typename PSET >
bool check_containment ( const PSET &  ph,
const Pointset_Powerset< PSET > &  ps 
)
related

Definition at line 315 of file Pointset_Powerset_inlines.hh.

315  {
316  // This code is only used when PSET is an abstraction of NNC_Polyhedron.
317  const NNC_Polyhedron ph_nnc = NNC_Polyhedron(ph.constraints());
318  const Pointset_Powerset<NNC_Polyhedron> ps_nnc(ps);
319  return check_containment(ph_nnc, ps_nnc);
320 }
bool check_containment(const NNC_Polyhedron &ph, const Pointset_Powerset< NNC_Polyhedron > &ps)
bool check_containment ( const C_Polyhedron ph,
const Pointset_Powerset< C_Polyhedron > &  ps 
)
related

Definition at line 325 of file Pointset_Powerset_inlines.hh.

326  {
327  return check_containment(NNC_Polyhedron(ph),
329 }
bool check_containment(const NNC_Polyhedron &ph, const Pointset_Powerset< NNC_Polyhedron > &ps)
template<typename PSET>
bool check_containment ( const NNC_Polyhedron ph,
const Pointset_Powerset< NNC_Polyhedron > &  ps 
)
related

Returns true if and only if the union of the NNC polyhedra in ps contains the NNC polyhedron ph.

template<typename PSET>
bool check_containment ( const Grid ph,
const Pointset_Powerset< Grid > &  ps 
)
related

Returns true if and only if the union of the grids ps contains the grid g.

template<typename PSET >
bool check_containment ( const PSET &  ph,
const Pointset_Powerset< PSET > &  ps 
)
related

Returns true if and only if the union of the objects in ps contains ph.

Note
It is assumed that the template parameter PSET can be converted without precision loss into an NNC_Polyhedron; otherwise, an incorrect result might be obtained.
template<typename PSET >
std::pair< PSET, Pointset_Powerset< NNC_Polyhedron > > linear_partition ( const PSET &  p,
const PSET &  q 
)
related

Partitions q with respect to p.

Let p and q be two polyhedra. The function returns an object r of type std::pair<PSET, Pointset_Powerset<NNC_Polyhedron> > such that

  • r.first is the intersection of p and q;
  • r.second has the property that all its elements are pairwise disjoint and disjoint from p;
  • the set-theoretical union of r.first with all the elements of r.second gives q (i.e., r is the representation of a partition of q).

See this paper for more information about the implementation.

Referenced by Parma_Polyhedra_Library::Pointset_Powerset< PSET >::check_containment(), and Parma_Polyhedra_Library::Pointset_Powerset< PSET >::difference_assign().

template<typename PSET >
std::pair< PSET, Pointset_Powerset< NNC_Polyhedron > > linear_partition ( const PSET &  p,
const PSET &  q 
)
related

Definition at line 1651 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Constraint_System::begin(), c, Parma_Polyhedra_Library::EMPTY, Parma_Polyhedra_Library::Constraint_System::end(), Parma_Polyhedra_Library::Constraint::expression(), Parma_Polyhedra_Library::Constraint::is_equality(), and Parma_Polyhedra_Library::Boundary_NS::le().

1651  {
1652  using Implementation::Pointset_Powersets::linear_partition_aux;
1653 
1654  Pointset_Powerset<NNC_Polyhedron> r(p.space_dimension(), EMPTY);
1655  PSET pset = q;
1656  const Constraint_System& p_constraints = p.constraints();
1657  for (Constraint_System::const_iterator i = p_constraints.begin(),
1658  p_constraints_end = p_constraints.end();
1659  i != p_constraints_end;
1660  ++i) {
1661  const Constraint& c = *i;
1662  if (c.is_equality()) {
1663  const Linear_Expression le(c.expression());
1664  linear_partition_aux(le <= 0, pset, r);
1665  linear_partition_aux(le >= 0, pset, r);
1666  }
1667  else {
1668  linear_partition_aux(c, pset, r);
1669  }
1670  }
1671  return std::make_pair(pset, r);
1672 }
The empty element, i.e., the empty set.
void linear_partition_aux(const Constraint &c, PSET &pset, Pointset_Powerset< NNC_Polyhedron > &r)
Partitions polyhedron pset according to constraint c.
Coefficient c
Definition: PIP_Tree.cc:64
bool le(Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
Constraint_System_const_iterator const_iterator
template<typename PSET >
void linear_partition_aux ( const Constraint c,
PSET &  pset,
Pointset_Powerset< NNC_Polyhedron > &  r 
)
related

Partitions polyhedron pset according to constraint c.

On exit, the intersection of pset and constraint c is stored in pset, whereas the intersection of pset with the negation of c is added as a new disjunct of the powerset r.

Definition at line 1630 of file Pointset_Powerset_templates.hh.

References Parma_Polyhedra_Library::Polyhedron::add_constraint(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::add_disjunct(), Parma_Polyhedra_Library::Constraint::expression(), Parma_Polyhedra_Library::Polyhedron::is_empty(), Parma_Polyhedra_Library::Constraint::is_strict_inequality(), and Parma_Polyhedra_Library::Boundary_NS::le().

1632  {
1633  const Linear_Expression le(c.expression());
1634  const Constraint& neg_c = c.is_strict_inequality() ? (le <= 0) : (le < 0);
1635  NNC_Polyhedron nnc_ph_pset(pset);
1636  nnc_ph_pset.add_constraint(neg_c);
1637  if (!nnc_ph_pset.is_empty()) {
1638  r.add_disjunct(nnc_ph_pset);
1639  }
1640  pset.add_constraint(c);
1641 }
Coefficient c
Definition: PIP_Tree.cc:64
bool le(Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
template<typename PSET>
friend class Pointset_Powerset< NNC_Polyhedron >
friend

Definition at line 1308 of file Pointset_Powerset_defs.hh.

template<typename PSET >
void swap ( Pointset_Powerset< PSET > &  x,
Pointset_Powerset< PSET > &  y 
)
related

Definition at line 334 of file Pointset_Powerset_inlines.hh.

References Parma_Polyhedra_Library::Pointset_Powerset< PSET >::m_swap().

334  {
335  x.m_swap(y);
336 }
template<typename PSET >
void swap ( Pointset_Powerset< PSET > &  x,
Pointset_Powerset< PSET > &  y 
)
related

Swaps x with y.

template<typename PSET >
Widening_Function< PSET > widen_fun_ref ( void(PSET::*)(const PSET &, unsigned *)  wm)
related

Definition at line 60 of file Widening_Function_inlines.hh.

60  {
61  return Widening_Function<PSET>(wm);
62 }
template<typename PSET , typename CSYS >
Limited_Widening_Function< PSET, CSYS > widen_fun_ref ( void(PSET::*)(const PSET &, const CSYS &, unsigned *)  lwm,
const CSYS &  cs 
)
related

Definition at line 67 of file Widening_Function_inlines.hh.

68  {
69  return Limited_Widening_Function<PSET, CSYS>(lwm, cs);
70 }
template<typename PSET >
Widening_Function< PSET > widen_fun_ref ( void(PSET::*)(const PSET &, unsigned *)  wm)
related

Wraps a widening method into a function object.

Parameters
wmThe widening method.
template<typename PSET , typename CSYS >
Limited_Widening_Function< PSET, CSYS > widen_fun_ref ( void(PSET::*)(const PSET &, const CSYS &, unsigned *)  lwm,
const CSYS &  cs 
)
related

Wraps a limited widening method into a function object.

Parameters
lwmThe limited widening method.
csThe constraint system limiting the widening.

Member Data Documentation


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