Parma_Polyhedra_Library::Pointset_Powerset< PSET > Class Template Reference
[C++ Language Interface]

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

#include <Pointset_Powerset.defs.hh>

Inheritance diagram for Parma_Polyhedra_Library::Pointset_Powerset< PSET >:
Inheritance graph
[legend]
Collaboration diagram for Parma_Polyhedra_Library::Pointset_Powerset< PSET >:
Collaboration graph
[legend]

List of all members.

Public Types

typedef PSET element_type
typedef Base::size_type size_type
typedef Base::value_type value_type
typedef Base::iterator iterator
 Alias for a read-only bidirectional iterator on the disjuncts of a Powerset element.
typedef Base::const_iterator const_iterator
 A bidirectional const_iterator on the disjuncts of a Powerset element.
typedef Base::reverse_iterator reverse_iterator
 The reverse iterator type built from Powerset::iterator.
typedef
Base::const_reverse_iterator 
const_reverse_iterator
 The reverse iterator type built from Powerset::const_iterator.

Public Member Functions

void ascii_dump () const
 Writes to std::cerr an ASCII representation of *this.
void ascii_dump (std::ostream &s) const
 Writes to s an ASCII representation of *this.
void print () const
 Prints *this to std::cerr using operator<<.
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.
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<>
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)
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)
Constructors

 Pointset_Powerset (dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
 Builds a universe (top) or empty (bottom) Pointset_Powerset.
 Pointset_Powerset (const Pointset_Powerset &y, Complexity_Class complexity=ANY_COMPLEXITY)
 Ordinary copy constructor.
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.
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.
 Pointset_Powerset (const Constraint_System &cs)
 Creates a Pointset_Powerset with a single disjunct approximating the system of constraints cs.
 Pointset_Powerset (const Congruence_System &cgs)
 Creates a Pointset_Powerset with a single disjunct approximating the system of congruences cgs.
 Pointset_Powerset (const C_Polyhedron &ph, Complexity_Class complexity=ANY_COMPLEXITY)
 Builds a pointset_powerset out of a closed polyhedron.
 Pointset_Powerset (const NNC_Polyhedron &ph, Complexity_Class complexity=ANY_COMPLEXITY)
 Builds a pointset_powerset out of an nnc polyhedron.
 Pointset_Powerset (const Grid &gr, Complexity_Class complexity=ANY_COMPLEXITY)
 Builds a pointset_powerset out of a grid.
template<typename T >
 Pointset_Powerset (const Octagonal_Shape< T > &os, Complexity_Class complexity=ANY_COMPLEXITY)
 Builds a pointset_powerset out of an octagonal shape.
template<typename T >
 Pointset_Powerset (const BD_Shape< T > &bds, Complexity_Class complexity=ANY_COMPLEXITY)
 Builds a pointset_powerset out of a bd shape.
template<typename Interval >
 Pointset_Powerset (const Box< Interval > &box, Complexity_Class complexity=ANY_COMPLEXITY)
 Builds a pointset_powerset out of a box.
Member Functions that Do Not Modify the Pointset_Powerset

dimension_type space_dimension () const
 Returns the dimension of the vector space enclosing *this.
dimension_type affine_dimension () const
 Returns the dimension of the vector space enclosing *this.
bool is_empty () const
 Returns true if and only if *this is an empty powerset.
bool is_universe () const
 Returns true if and only if *this is the top element of the powerser lattice.
bool is_topologically_closed () const
 Returns true if and only if all the disjuncts in *this are topologically closed.
bool is_bounded () const
 Returns true if and only if all elements in *this are bounded.
bool is_disjoint_from (const Pointset_Powerset &y) const
 Returns true if and only if *this and y are disjoint.
bool is_discrete () const
 Returns true if and only if *this is discrete.
bool constrains (Variable var) const
 Returns true if and only if var is constrained in *this.
bool bounds_from_above (const Linear_Expression &expr) const
 Returns true if and only if expr is bounded from above in *this.
bool bounds_from_below (const Linear_Expression &expr) const
 Returns true if and only if expr is bounded from below in *this.
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.
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.
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.
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.
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.
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.
bool contains (const Pointset_Powerset &y) const
 Returns true if and only if each disjunct of y is contained in a disjunct of *this.
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.
bool contains_integer_point () const
 Returns true if and only if *this contains at least one integer point.
Poly_Con_Relation relation_with (const Constraint &c) const
 Returns the relations holding between the powerset *this and the constraint c.
Poly_Gen_Relation relation_with (const Generator &g) const
 Returns the relations holding between the powerset *this and the generator g.
Poly_Con_Relation relation_with (const Congruence &cg) const
 Returns the relations holding between the powerset *this and the congruence c.
memory_size_type total_memory_in_bytes () const
 Returns a lower bound to the total size in bytes of the memory occupied by *this.
memory_size_type external_memory_in_bytes () const
 Returns a lower bound to the size in bytes of the memory managed by *this.
int32_t hash_code () const
 Returns a 32-bit hash code for *this.
bool OK () const
 Checks if all the invariants are satisfied.
Space Dimension Preserving Member Functions that May Modify the Pointset_Powerset

void add_disjunct (const PSET &ph)
 Adds to *this the disjunct ph.
void add_constraint (const Constraint &c)
 Intersects *this with constraint c.
void refine_with_constraint (const Constraint &c)
 Use the constraint c to refine *this.
void add_constraints (const Constraint_System &cs)
 Intersects *this with the constraints in cs.
void refine_with_constraints (const Constraint_System &cs)
 Use the constraints in cs to refine *this.
void add_congruence (const Congruence &c)
 Intersects *this with congruence c.
void refine_with_congruence (const Congruence &cg)
 Use the congruence cg to refine *this.
void add_congruences (const Congruence_System &cgs)
 Intersects *this with the congruences in cgs.
void refine_with_congruences (const Congruence_System &cgs)
 Use the congruences in cgs to refine *this.
void unconstrain (Variable var)
 Computes the cylindrification of *this with respect to space dimension var, assigning the result to *this.
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.
void drop_some_non_integer_points (Complexity_Class complexity=ANY_COMPLEXITY)
 Possibly tightens *this by dropping some points with non-integer coordinates.
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.
void topological_closure_assign ()
 Assigns to *this its topological closure.
void intersection_assign (const Pointset_Powerset &y)
 Assigns to *this the intersection of *this and y.
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.
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.
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.
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.
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.
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.
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.
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.
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}}$.
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}}$.
void time_elapse_assign (const Pointset_Powerset &y)
 Assigns to *this the result of computing the time-elapse between *this and y.
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 *pcs=0, unsigned complexity_threshold=16, bool wrap_individually=true)
 Wraps the specified dimensions of the vector space.
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.
template<typename Widening >
void BGP99_extrapolation_assign (const Pointset_Powerset &y, Widening wf, unsigned max_disjuncts)
 Assigns to *this the result of applying the BGP99 extrapolation operator to *this and y, using the widening function wf and the cardinality threshold max_disjuncts.
template<typename Cert , typename Widening >
void BHZ03_widening_assign (const Pointset_Powerset &y, Widening wf)
 Assigns to *this the result of computing the BHZ03-widening between *this and y, using the widening function wf certified by the convergence certificate Cert.
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).
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).
void swap (Pointset_Powerset &y)
 Swaps *this with y.
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.
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.
void concatenate_assign (const Pointset_Powerset &y)
 Assigns to *this the concatenation of *this and y.
void remove_space_dimensions (const Variables_Set &vars)
 Removes all the specified space dimensions.
void remove_higher_space_dimensions (dimension_type new_dimension)
 Removes the higher space dimensions so that the resulting space will have dimension new_dimension.
template<typename Partial_Function >
void map_space_dimensions (const Partial_Function &pfunc)
 Remaps the dimensions of the vector space according to a partial function.
void expand_space_dimension (Variable var, dimension_type m)
 Creates m copies of the space dimension corresponding to var.
void fold_space_dimensions (const Variables_Set &vars, Variable dest)
 Folds the space dimensions in vars into dest.

Static Public Member Functions

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

Private Types

typedef Determinate< PSET > Det_PSET
typedef Powerset< Det_PSETBase
typedef Base::Sequence Sequence
 A powerset is implemented as a sequence of elements.
typedef Base::Sequence_iterator Sequence_iterator
 Alias for the low-level iterator on the disjuncts.
typedef
Base::Sequence_const_iterator 
Sequence_const_iterator
 Alias for the low-level const_iterator on the disjuncts.

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.
template<typename Widening >
void BGP99_heuristics_assign (const Pointset_Powerset &y, Widening wf)
 Assigns to *this the result of applying the BGP99 heuristics to *this and y, using the widening function wf.
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.
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 dijsuncts is stabilizing with respect to the multiset of certificates y_cert_ms.

Private Attributes

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

Friends

class Pointset_Powerset< NNC_Polyhedron >

Related Functions

(Note that these are not member functions.)



template<typename PSET >
Widening_Function< PSET > widen_fun_ref (void(PSET::*wm)(const PSET &, unsigned *))
 Wraps a widening method into a function object.
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.
template<typename PSET >
std::pair< PSET,
Pointset_Powerset
< NNC_Polyhedron > > 
linear_partition (const PSET &p, const PSET &q)
 Partitions q with respect to p.
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.
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.
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.
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.
template<typename PSET >
void swap (Parma_Polyhedra_Library::Pointset_Powerset< PSET > &x, Parma_Polyhedra_Library::Pointset_Powerset< PSET > &y)
 Specializes std::swap.
template<>
bool check_containment (const C_Polyhedron &ph, const Pointset_Powerset< C_Polyhedron > &ps)
template<typename PSET >
void linear_partition_aux (const Constraint &c, PSET &qq, Pointset_Powerset< NNC_Polyhedron > &r)
 Partitions polyhedron qq according to constraint c.
bool approximate_partition_aux (const PPL::Congruence &c, PPL::Grid &qq, PPL::Pointset_Powerset< PPL::Grid > &r)
 Uses the congruence c to approximately partition the grid qq.

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 62 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 70 of file Pointset_Powerset.defs.hh.

A bidirectional const_iterator on the disjuncts of a Powerset element.

Reimplemented from Parma_Polyhedra_Library::Powerset< Parma_Polyhedra_Library::Determinate< PSET > >.

Definition at line 1245 of file Pointset_Powerset.defs.hh.

The reverse iterator type built from Powerset::const_iterator.

Reimplemented from Parma_Polyhedra_Library::Powerset< Parma_Polyhedra_Library::Determinate< PSET > >.

Definition at line 1247 of file Pointset_Powerset.defs.hh.

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

Definition at line 69 of file Pointset_Powerset.defs.hh.

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

Definition at line 66 of file Pointset_Powerset.defs.hh.

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

Alias for a read-only bidirectional iterator on the disjuncts of a Powerset element.

By using this iterator type, the disjuncts cannot be overwritten, but they can be removed using methods drop_disjunct(iterator position) and drop_disjuncts(iterator first, iterator last), while still ensuring a correct handling of Omega-reduction.

Reimplemented from Parma_Polyhedra_Library::Powerset< Parma_Polyhedra_Library::Determinate< PSET > >.

Definition at line 1244 of file Pointset_Powerset.defs.hh.

The reverse iterator type built from Powerset::iterator.

Reimplemented from Parma_Polyhedra_Library::Powerset< Parma_Polyhedra_Library::Determinate< PSET > >.

Definition at line 1246 of file Pointset_Powerset.defs.hh.

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

A powerset is implemented as a sequence of elements.

The particular sequence employed must support efficient deletion in any position and efficient back insertion.

Reimplemented from Parma_Polyhedra_Library::Powerset< Parma_Polyhedra_Library::Determinate< PSET > >.

Definition at line 1259 of file Pointset_Powerset.defs.hh.

Alias for the low-level const_iterator on the disjuncts.

Reimplemented from Parma_Polyhedra_Library::Powerset< Parma_Polyhedra_Library::Determinate< PSET > >.

Definition at line 1261 of file Pointset_Powerset.defs.hh.

template<typename PSET>
typedef Base::Sequence_iterator Parma_Polyhedra_Library::Pointset_Powerset< PSET >::Sequence_iterator [private]

Alias for the low-level iterator on the disjuncts.

Reimplemented from Parma_Polyhedra_Library::Powerset< Parma_Polyhedra_Library::Determinate< PSET > >.

Definition at line 1260 of file Pointset_Powerset.defs.hh.

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

Constructor & Destructor Documentation

template<typename PSET >
Parma_Polyhedra_Library::Pointset_Powerset< PSET >::Pointset_Powerset ( dimension_type  num_dimensions = 0,
Degenerate_Element  kind = UNIVERSE 
) [inline, explicit]

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

Parameters:
num_dimensions The number of dimensions of the vector space enclosing the powerset;
kind Specifies 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.

00056   : Base(), space_dim(num_dimensions) {
00057   Pointset_Powerset& x = *this;
00058   if (kind == UNIVERSE)
00059     x.sequence.push_back(Determinate<PSET>(PSET(num_dimensions, kind)));
00060   PPL_ASSERT_HEAVY(x.OK());
00061 }

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 65 of file Pointset_Powerset.inlines.hh.

00067   : Base(y), space_dim(y.space_dim) {
00068 }

template<typename PSET >
template<typename QH >
Parma_Polyhedra_Library::Pointset_Powerset< PSET >::Pointset_Powerset ( const Pointset_Powerset< QH > &  y,
Complexity_Class  complexity = ANY_COMPLEXITY 
) [inline, explicit]

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

Parameters:
y The powerset to be used to build the new powerset.
complexity The maximal complexity of any algorithms used.

Definition at line 87 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.

00089   : Base(), space_dim(y.space_dimension()) {
00090   Pointset_Powerset& x = *this;
00091   for (typename Pointset_Powerset<QH>::const_iterator i = y.begin(),
00092          y_end = y.end(); i != y_end; ++i)
00093     x.sequence.push_back(Determinate<PSET>(PSET(i->pointset(), complexity)));
00094   // Note: this might be non-reduced even when `y' is known to be
00095   // omega-reduced, because the constructor of PSET may have made
00096   // different QH elements to become comparable.
00097   x.reduced = false;
00098   PPL_ASSERT_HEAVY(x.OK());
00099 }

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 
) [inline, explicit]

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 119 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.

00121   : Base(), space_dim(prp.space_dimension()) {
00122   Pointset_Powerset& x = *this;
00123   if (complexity == ANY_COMPLEXITY) {
00124     if (prp.is_empty())
00125       return;
00126   }
00127   else
00128     x.reduced = false;
00129   x.sequence.push_back(Determinate<PSET>(PSET(prp, complexity)));
00130   x.reduced = false;
00131   PPL_ASSERT_HEAVY(OK());
00132 }

template<typename PSET >
Parma_Polyhedra_Library::Pointset_Powerset< PSET >::Pointset_Powerset ( const Constraint_System cs  )  [inline, explicit]

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

Definition at line 169 of file Pointset_Powerset.inlines.hh.

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

00170   : Base(Determinate<PSET>(cs)), space_dim(cs.space_dimension()) {
00171   PPL_ASSERT_HEAVY(OK());
00172 }

template<typename PSET >
Parma_Polyhedra_Library::Pointset_Powerset< PSET >::Pointset_Powerset ( const Congruence_System cgs  )  [inline, explicit]

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

Definition at line 176 of file Pointset_Powerset.inlines.hh.

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

00177   : Base(Determinate<PSET>(cgs)), space_dim(cgs.space_dimension()) {
00178   PPL_ASSERT_HEAVY(OK());
00179 }

template<typename PSET >
Parma_Polyhedra_Library::Pointset_Powerset< PSET >::Pointset_Powerset ( const C_Polyhedron ph,
Complexity_Class  complexity = ANY_COMPLEXITY 
) [inline, explicit]

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:
ph The closed polyhedron to be used to build the powerset.
complexity The maximal complexity of any algorithms used.
Exceptions:
std::length_error Thrown if the space dimension of ph exceeds the maximum allowed space dimension.

Definition at line 72 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.

00074   : Base(), space_dim(ph.space_dimension()) {
00075   Pointset_Powerset& x = *this;
00076   if (complexity == ANY_COMPLEXITY) {
00077     if (ph.is_empty())
00078       return;
00079   }
00080   else
00081     x.reduced = false;
00082   x.sequence.push_back(Determinate<PSET>(PSET(ph, complexity)));
00083   x.reduced = false;
00084   PPL_ASSERT_HEAVY(OK());
00085 }

template<typename PSET >
Parma_Polyhedra_Library::Pointset_Powerset< PSET >::Pointset_Powerset ( const NNC_Polyhedron ph,
Complexity_Class  complexity = ANY_COMPLEXITY 
) [inline, explicit]

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:
ph The closed polyhedron to be used to build the powerset.
complexity The maximal complexity of any algorithms used.
Exceptions:
std::length_error Thrown if the space dimension of ph exceeds the maximum allowed space dimension.

Definition at line 89 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.

00091   : Base(), space_dim(ph.space_dimension()) {
00092   Pointset_Powerset& x = *this;
00093   if (complexity == ANY_COMPLEXITY) {
00094     if (ph.is_empty())
00095       return;
00096   }
00097   else
00098     x.reduced = false;
00099   x.sequence.push_back(Determinate<PSET>(PSET(ph, complexity)));
00100   PPL_ASSERT_HEAVY(OK());
00101 }

template<typename PSET >
Parma_Polyhedra_Library::Pointset_Powerset< PSET >::Pointset_Powerset ( const Grid gr,
Complexity_Class  complexity = ANY_COMPLEXITY 
) [inline, explicit]

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:
gr The grid to be used to build the powerset.
complexity This argument is ignored.
Exceptions:
std::length_error Thrown if the space dimension of gr exceeds the maximum allowed space dimension.

Definition at line 105 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.

00107   : Base(), space_dim(gr.space_dimension()) {
00108   Pointset_Powerset& x = *this;
00109   if (!gr.is_empty()) {
00110     x.sequence.push_back(Determinate<PSET>(PSET(gr)));
00111   }
00112   PPL_ASSERT_HEAVY(OK());
00113 }

template<typename PSET >
template<typename T >
Parma_Polyhedra_Library::Pointset_Powerset< PSET >::Pointset_Powerset ( const Octagonal_Shape< T > &  os,
Complexity_Class  complexity = ANY_COMPLEXITY 
) [inline, 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:
os The octagonal shape to be used to build the powerset.
complexity This argument is ignored.
Exceptions:
std::length_error Thrown if the space dimension of os exceeds the maximum allowed space dimension.

Definition at line 147 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.

00149   : Base(), space_dim(os.space_dimension()) {
00150   Pointset_Powerset& x = *this;
00151   if (!os.is_empty())
00152     x.sequence.push_back(Determinate<PSET>(PSET(os)));
00153   PPL_ASSERT_HEAVY(OK());
00154 }

template<typename PSET >
template<typename T >
Parma_Polyhedra_Library::Pointset_Powerset< PSET >::Pointset_Powerset ( const BD_Shape< T > &  bds,
Complexity_Class  complexity = ANY_COMPLEXITY 
) [inline, 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:
bds The bd shape to be used to build the powerset.
complexity This argument is ignored.
Exceptions:
std::length_error Thrown if the space dimension of bdss exceeds the maximum allowed space dimension.

Definition at line 158 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.

00160   : Base(), space_dim(bds.space_dimension()) {
00161   Pointset_Powerset& x = *this;
00162   if (!bds.is_empty())
00163     x.sequence.push_back(Determinate<PSET>(PSET(bds)));
00164   PPL_ASSERT_HEAVY(OK());
00165 }

template<typename PSET >
template<typename Interval >
Parma_Polyhedra_Library::Pointset_Powerset< PSET >::Pointset_Powerset ( const Box< Interval > &  box,
Complexity_Class  complexity = ANY_COMPLEXITY 
) [inline, 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:
box The box to be used to build the powerset.
complexity This argument is ignored.
Exceptions:
std::length_error Thrown if the space dimension of box exceeds the maximum allowed space dimension.

Definition at line 136 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.

00138   : Base(), space_dim(box.space_dimension()) {
00139   Pointset_Powerset& x = *this;
00140   if (!box.is_empty())
00141     x.sequence.push_back(Determinate<PSET>(PSET(box)));
00142   PPL_ASSERT_HEAVY(OK());
00143 }

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< Parma_Polyhedra_Library::Determinate< PSET > >::reduced, Parma_Polyhedra_Library::Powerset< D >::reduced, and Parma_Polyhedra_Library::Powerset< D >::sequence.

00063   : Base(), space_dim(y.space_dimension()) {
00064   Pointset_Powerset& x = *this;
00065   for (typename Pointset_Powerset<QH>::const_iterator i = y.begin(),
00066          y_end = y.end(); i != y_end; ++i)
00067     x.sequence.push_back(Determinate<NNC_Polyhedron>
00068                          (NNC_Polyhedron(i->pointset(), complexity)));
00069 
00070   // FIXME: If the domain elements can be represented _exactly_ as NNC
00071   // polyhedra, then having x.reduced = y.reduced is correct. This is
00072   // the case if the domains are both linear and convex which holds
00073   // for all the currently supported instantiations except for
00074   // Grids; for this reason the Grid specialization has a
00075   // separate implementation.  For any non-linear or non-convex
00076   // domains (e.g., a domain of Intervals with restrictions or a
00077   // domain of circles) that may be supported in the future, the
00078   // assignment x.reduced = y.reduced will be a bug.
00079   x.reduced = y.reduced;
00080 
00081   PPL_ASSERT_HEAVY(x.OK());
00082 }

Definition at line 297 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< Parma_Polyhedra_Library::Determinate< PSET > >::reduced, Parma_Polyhedra_Library::Powerset< D >::reduced, and Parma_Polyhedra_Library::Powerset< D >::sequence.

00299   : Base(), space_dim(y.space_dimension()) {
00300   Pointset_Powerset& x = *this;
00301   for (Pointset_Powerset<C_Polyhedron>::const_iterator i = y.begin(),
00302          y_end = y.end(); i != y_end; ++i)
00303     x.sequence.push_back(Determinate<NNC_Polyhedron>
00304                          (NNC_Polyhedron(i->pointset())));
00305   x.reduced = y.reduced;
00306   PPL_ASSERT_HEAVY(x.OK());
00307 }

Definition at line 312 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.

00314   : Base(), space_dim(y.space_dimension()) {
00315   Pointset_Powerset& x = *this;
00316   for (Pointset_Powerset<Grid>::const_iterator i = y.begin(),
00317          y_end = y.end(); i != y_end; ++i)
00318     x.sequence.push_back(Determinate<NNC_Polyhedron>
00319                          (NNC_Polyhedron(i->pointset())));
00320   x.reduced = false;
00321   PPL_ASSERT_HEAVY(x.OK());
00322 }

Definition at line 327 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.

00329   : Base(), space_dim(y.space_dimension()) {
00330   Pointset_Powerset& x = *this;
00331   for (Pointset_Powerset<NNC_Polyhedron>::const_iterator i = y.begin(),
00332          y_end = y.end(); i != y_end; ++i)
00333     x.sequence.push_back(Determinate<C_Polyhedron>
00334                          (C_Polyhedron(i->pointset())));
00335 
00336   // Note: this might be non-reduced even when `y' is known to be
00337   // omega-reduced, because the constructor of C_Polyhedron, by
00338   // enforcing topological closure, may have made different elements
00339   // comparable.
00340   x.reduced = false;
00341   PPL_ASSERT_HEAVY(x.OK());
00342 }


Member Function Documentation

template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::add_congruence ( const Congruence c  )  [inline]

Intersects *this with congruence c.

Exceptions:
std::invalid_argument Thrown if *this and congruence c are topology-incompatible or dimension-incompatible.

Definition at line 184 of file Pointset_Powerset.templates.hh.

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

00184                                                            {
00185   Pointset_Powerset& x = *this;
00186   for (Sequence_iterator si = x.sequence.begin(),
00187          s_end = x.sequence.end(); si != s_end; ++si)
00188     si->pointset().add_congruence(c);
00189   x.reduced = false;
00190   PPL_ASSERT_HEAVY(x.OK());
00191 }

template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::add_congruences ( const Congruence_System cgs  )  [inline]

Intersects *this with the congruences in cgs.

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

Definition at line 206 of file Pointset_Powerset.templates.hh.

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

00206                                                                     {
00207   Pointset_Powerset& x = *this;
00208   for (Sequence_iterator si = x.sequence.begin(),
00209          s_end = x.sequence.end(); si != s_end; ++si)
00210     si->pointset().add_congruences(cs);
00211   x.reduced = false;
00212   PPL_ASSERT_HEAVY(x.OK());
00213 }

template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::add_constraint ( const Constraint c  )  [inline]

Intersects *this with constraint c.

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

Definition at line 140 of file Pointset_Powerset.templates.hh.

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

00140                                                            {
00141   Pointset_Powerset& x = *this;
00142   for (Sequence_iterator si = x.sequence.begin(),
00143          s_end = x.sequence.end(); si != s_end; ++si)
00144     si->pointset().add_constraint(c);
00145   x.reduced = false;
00146   PPL_ASSERT_HEAVY(x.OK());
00147 }

template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::add_constraints ( const Constraint_System cs  )  [inline]

Intersects *this with the constraints in cs.

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

Definition at line 162 of file Pointset_Powerset.templates.hh.

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

00162                                                                     {
00163   Pointset_Powerset& x = *this;
00164   for (Sequence_iterator si = x.sequence.begin(),
00165          s_end = x.sequence.end(); si != s_end; ++si)
00166     si->pointset().add_constraints(cs);
00167   x.reduced = false;
00168   PPL_ASSERT_HEAVY(x.OK());
00169 }

template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::add_disjunct ( const PSET &  ph  )  [inline]

Adds to *this the disjunct ph.

Exceptions:
std::invalid_argument Thrown 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 >::concatenate_assign(), and Parma_Polyhedra_Library::Pointset_Powerset< PSET >::linear_partition_aux().

00044                                                     {
00045   Pointset_Powerset& x = *this;
00046   if (x.space_dimension() != ph.space_dimension()) {
00047     std::ostringstream s;
00048     s << "PPL::Pointset_Powerset<PSET>::add_disjunct(ph):\n"
00049       << "this->space_dimension() == " << x.space_dimension() << ", "
00050       << "ph.space_dimension() == " << ph.space_dimension() << ".";
00051     throw std::invalid_argument(s.str());
00052   }
00053   x.sequence.push_back(Determinate<PSET>(ph));
00054   x.reduced = false;
00055   PPL_ASSERT_HEAVY(x.OK());
00056 }

template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::add_space_dimensions_and_embed ( dimension_type  m  )  [inline]

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

Definition at line 252 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.

00252                                                                         {
00253   Pointset_Powerset& x = *this;
00254   for (Sequence_iterator si = x.sequence.begin(),
00255          s_end = x.sequence.end(); si != s_end; ++si)
00256     si->pointset().add_space_dimensions_and_embed(m);
00257   x.space_dim += m;
00258   PPL_ASSERT_HEAVY(x.OK());
00259 }

template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::add_space_dimensions_and_project ( dimension_type  m  )  [inline]

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

Definition at line 263 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.

00263                                                                           {
00264   Pointset_Powerset& x = *this;
00265   for (Sequence_iterator si = x.sequence.begin(),
00266          s_end = x.sequence.end(); si != s_end; ++si)
00267     si->pointset().add_space_dimensions_and_project(m);
00268   x.space_dim += m;
00269   PPL_ASSERT_HEAVY(x.OK());
00270 }

template<typename PSET >
dimension_type Parma_Polyhedra_Library::Pointset_Powerset< PSET >::affine_dimension (  )  const [inline]

Returns the dimension of the vector space enclosing *this.

Definition at line 492 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(), Parma_Polyhedra_Library::EMPTY, Parma_Polyhedra_Library::Constraint_System::end(), Parma_Polyhedra_Library::Constraint::is_equality(), Parma_Polyhedra_Library::Polyhedron::poly_hull_assign(), Parma_Polyhedra_Library::Powerset< D >::sequence, and Parma_Polyhedra_Library::Pointset_Powerset< PSET >::space_dim.

00492                                                 {
00493   // The affine dimension of the powerset is the affine dimension of
00494   // the smallest vector space in which it can be embedded.
00495   const Pointset_Powerset& x = *this;
00496   C_Polyhedron x_ph(space_dim, EMPTY);
00497 
00498   for (Sequence_const_iterator si = x.sequence.begin(),
00499          s_end = x.sequence.end(); si != s_end; ++si) {
00500     PSET pi(si->pointset());
00501     if (!pi.is_empty()) {
00502       C_Polyhedron phi(space_dim);
00503       const Constraint_System& cs = pi.minimized_constraints();
00504       for (Constraint_System::const_iterator i = cs.begin(),
00505              cs_end = cs.end(); i != cs_end; ++i) {
00506         const Constraint& c = *i;
00507         if (c.is_equality())
00508           phi.add_constraint(c);
00509       }
00510       x_ph.poly_hull_assign(phi);
00511     }
00512   }
00513 
00514   return x_ph.affine_dimension();
00515 }

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() 
) [inline]

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

Parameters:
var The variable to which the affine expression is assigned;
expr The numerator of the affine expression;
denominator The denominator of the affine expression (optional argument with default value 1).
Exceptions:
std::invalid_argument Thrown 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 358 of file Pointset_Powerset.templates.hh.

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

00361                                                    {
00362   Pointset_Powerset& x = *this;
00363   for (Sequence_iterator si = x.sequence.begin(),
00364          s_end = x.sequence.end(); si != s_end; ++si) {
00365     si->pointset().affine_image(var, expr, denominator);
00366     // Note that the underlying domain can apply conservative approximation:
00367     // that is why it would not be correct to make the loss of reduction
00368     // conditional on `var' and `expr'.
00369     x.reduced = false;
00370   }
00371   PPL_ASSERT_HEAVY(x.OK());
00372 }

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() 
) [inline]

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

Parameters:
var The variable to which the affine expression is assigned;
expr The numerator of the affine expression;
denominator The denominator of the affine expression (optional argument with default value 1).
Exceptions:
std::invalid_argument Thrown 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 376 of file Pointset_Powerset.templates.hh.

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

00379                                                       {
00380   Pointset_Powerset& x = *this;
00381   for (Sequence_iterator si = x.sequence.begin(),
00382          s_end = x.sequence.end(); si != s_end; ++si) {
00383     si->pointset().affine_preimage(var, expr, denominator);
00384     // Note that the underlying domain can apply conservative approximation:
00385     // that is why it would not be correct to make the loss of reduction
00386     // conditional on `var' and `expr'.
00387     x.reduced = false;
00388   }
00389   PPL_ASSERT_HEAVY(x.OK());
00390 }

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

Writes to s an ASCII representation of *this.

Definition at line 1480 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.

01480                                                        {
01481   const Pointset_Powerset& x = *this;
01482   s << "size " << x.size()
01483     << "\nspace_dim " << x.space_dim
01484     << "\n";
01485   for (const_iterator xi = x.begin(), x_end = x.end(); xi != x_end; ++xi)
01486     xi->pointset().ascii_dump(s);
01487 }

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 >
bool Parma_Polyhedra_Library::Pointset_Powerset< PSET >::ascii_load ( std::istream &  s  )  [inline]

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 1493 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::Pointset_Powerset< PSET >::swap().

01493                                                  {
01494   Pointset_Powerset& x = *this;
01495   std::string str;
01496 
01497   if (!(s >> str) || str != "size")
01498     return false;
01499 
01500   size_type sz;
01501 
01502   if (!(s >> sz))
01503     return false;
01504 
01505   if (!(s >> str) || str != "space_dim")
01506     return false;
01507 
01508   if (!(s >> x.space_dim))
01509     return false;
01510 
01511   Pointset_Powerset new_x(x.space_dim, EMPTY);
01512   while (sz-- > 0) {
01513     PSET ph;
01514     if (!ph.ascii_load(s))
01515       return false;
01516     new_x.add_disjunct(ph);
01517   }
01518   x.swap(new_x);
01519 
01520   // Check invariants.
01521   PPL_ASSERT_HEAVY(x.OK());
01522   return true;
01523 }

template<typename PSET >
template<typename Widening >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::BGP99_extrapolation_assign ( const Pointset_Powerset< PSET > &  y,
Widening  wf,
unsigned  max_disjuncts 
) [inline]

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

Parameters:
y A powerset that must definitely entail *this;
wf The 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_disjuncts The 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_argument Thrown if *this and y are dimension-incompatible.

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

Definition at line 1278 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().

01280                                                    {
01281   // `x' is the current iteration value.
01282   Pointset_Powerset& x = *this;
01283 
01284 #ifndef NDEBUG
01285   {
01286     // We assume that `y' entails `x'.
01287     const Pointset_Powerset<PSET> x_copy = x;
01288     const Pointset_Powerset<PSET> y_copy = y;
01289     PPL_ASSERT_HEAVY(y_copy.definitely_entails(x_copy));
01290   }
01291 #endif
01292 
01293   x.pairwise_reduce();
01294   if (max_disjuncts != 0)
01295     x.collapse(max_disjuncts);
01296   x.BGP99_heuristics_assign(y, wf);
01297 }

template<typename PSET >
template<typename Widening >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::BGP99_heuristics_assign ( const Pointset_Powerset< PSET > &  y,
Widening  wf 
) [inline, private]

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

Definition at line 1230 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::Pointset_Powerset< PSET >::swap().

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

01230                                                                  {
01231   // `x' is the current iteration value.
01232   Pointset_Powerset& x = *this;
01233 
01234 #ifndef NDEBUG
01235   {
01236     // We assume that `y' entails `x'.
01237     const Pointset_Powerset<PSET> x_copy = x;
01238     const Pointset_Powerset<PSET> y_copy = y;
01239     PPL_ASSERT_HEAVY(y_copy.definitely_entails(x_copy));
01240   }
01241 #endif
01242 
01243   size_type n = x.size();
01244   Pointset_Powerset new_x(x.space_dim, EMPTY);
01245   std::deque<bool> marked(n, false);
01246   const_iterator x_begin = x.begin();
01247   const_iterator x_end = x.end();
01248   unsigned i_index = 0;
01249   for (const_iterator i = x_begin,
01250          y_begin = y.begin(), y_end = y.end(); i != x_end; ++i, ++i_index)
01251     for (const_iterator j = y_begin; j != y_end; ++j) {
01252       const PSET& pi = i->pointset();
01253       const PSET& pj = j->pointset();
01254       if (pi.contains(pj)) {
01255         PSET pi_copy = pi;
01256         wf(pi_copy, pj);
01257         new_x.add_non_bottom_disjunct_preserve_reduction(pi_copy);
01258         marked[i_index] = true;
01259       }
01260     }
01261   iterator nx_begin = new_x.begin();
01262   iterator nx_end = new_x.end();
01263   i_index = 0;
01264   for (const_iterator i = x_begin; i != x_end; ++i, ++i_index)
01265     if (!marked[i_index])
01266       nx_begin = new_x.add_non_bottom_disjunct_preserve_reduction(*i,
01267                                                                   nx_begin,
01268                                                                   nx_end);
01269   std::swap(x.sequence, new_x.sequence);
01270   PPL_ASSERT_HEAVY(x.OK());
01271   PPL_ASSERT(x.is_omega_reduced());
01272 }

template<typename PSET >
template<typename Cert , typename Widening >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::BHZ03_widening_assign ( const Pointset_Powerset< PSET > &  y,
Widening  wf 
) [inline]

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

Parameters:
y The finite powerset computed in the previous iteration step. It must definitely entail *this;
wf The 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_argument Thrown 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 wf; 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 1364 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< Parma_Polyhedra_Library::Determinate< PSET > >::end(), Parma_Polyhedra_Library::Powerset< D >::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::Pointset_Powerset< PSET >::swap().

01365                                                             {
01366   // `x' is the current iteration value.
01367   Pointset_Powerset& x = *this;
01368 
01369 #ifndef NDEBUG
01370   {
01371     // We assume that `y' entails `x'.
01372     const Pointset_Powerset<PSET> x_copy = x;
01373     const Pointset_Powerset<PSET> y_copy = y;
01374     PPL_ASSERT_HEAVY(y_copy.definitely_entails(x_copy));
01375   }
01376 #endif
01377 
01378   // First widening technique: do nothing.
01379 
01380   // If `y' is the empty collection, do nothing.
01381   PPL_ASSERT(x.size() > 0);
01382   if (y.size() == 0)
01383     return;
01384 
01385   // Compute the poly-hull of `x'.
01386   PSET x_hull(x.space_dim, EMPTY);
01387   for (const_iterator i = x.begin(), x_end = x.end(); i != x_end; ++i)
01388     x_hull.upper_bound_assign(i->pointset());
01389 
01390   // Compute the poly-hull of `y'.
01391   PSET y_hull(y.space_dim, EMPTY);
01392   for (const_iterator i = y.begin(), y_end = y.end(); i != y_end; ++i)
01393     y_hull.upper_bound_assign(i->pointset());
01394   // Compute the certificate for `y_hull'.
01395   const Cert y_hull_cert(y_hull);
01396 
01397   // If the hull is stabilizing, do nothing.
01398   int hull_stabilization = y_hull_cert.compare(x_hull);
01399   if (hull_stabilization == 1)
01400     return;
01401 
01402   // Multiset ordering is only useful when `y' is not a singleton.
01403   const bool y_is_not_a_singleton = y.size() > 1;
01404 
01405   // The multiset certificate for `y':
01406   // we want to be lazy about its computation.
01407   typedef std::map<Cert, size_type, typename Cert::Compare> Cert_Multiset;
01408   Cert_Multiset y_cert_ms;
01409   bool y_cert_ms_computed = false;
01410 
01411   if (hull_stabilization == 0 && y_is_not_a_singleton) {
01412     // Collect the multiset certificate for `y'.
01413     y.collect_certificates(y_cert_ms);
01414     y_cert_ms_computed = true;
01415     // If multiset ordering is stabilizing, do nothing.
01416     if (x.is_cert_multiset_stabilizing(y_cert_ms))
01417       return;
01418   }
01419 
01420   // Second widening technique: try the BGP99 powerset heuristics.
01421   Pointset_Powerset<PSET> bgp99_heuristics = x;
01422   bgp99_heuristics.BGP99_heuristics_assign(y, wf);
01423 
01424   // Compute the poly-hull of `bgp99_heuristics'.
01425   PSET bgp99_heuristics_hull(x.space_dim, EMPTY);
01426   for (const_iterator i = bgp99_heuristics.begin(),
01427          bh_end = bgp99_heuristics.end(); i != bh_end; ++i)
01428     bgp99_heuristics_hull.upper_bound_assign(i->pointset());
01429 
01430   // Check for stabilization and, if successful,
01431   // commit to the result of the extrapolation.
01432   hull_stabilization = y_hull_cert.compare(bgp99_heuristics_hull);
01433   if (hull_stabilization == 1) {
01434     // The poly-hull is stabilizing.
01435     std::swap(x, bgp99_heuristics);
01436     return;
01437   }
01438   else if (hull_stabilization == 0 && y_is_not_a_singleton) {
01439     // If not already done, compute multiset certificate for `y'.
01440     if (!y_cert_ms_computed) {
01441       y.collect_certificates(y_cert_ms);
01442       y_cert_ms_computed = true;
01443     }
01444     if (bgp99_heuristics.is_cert_multiset_stabilizing(y_cert_ms)) {
01445       std::swap(x, bgp99_heuristics);
01446       return;
01447     }
01448     // Third widening technique: pairwise-reduction on `bgp99_heuristics'.
01449     // Note that pairwise-reduction does not affect the computation
01450     // of the poly-hulls, so that we only have to check the multiset
01451     // certificate relation.
01452     Pointset_Powerset<PSET> reduced_bgp99_heuristics(bgp99_heuristics);
01453     reduced_bgp99_heuristics.pairwise_reduce();
01454     if (reduced_bgp99_heuristics.is_cert_multiset_stabilizing(y_cert_ms)) {
01455       std::swap(x, reduced_bgp99_heuristics);
01456       return;
01457     }
01458   }
01459 
01460   // Fourth widening technique: this is applicable only when
01461   // `y_hull' is a proper subset of `bgp99_heuristics_hull'.
01462   if (bgp99_heuristics_hull.strictly_contains(y_hull)) {
01463     // Compute (y_hull \widen bgp99_heuristics_hull).
01464     PSET ph = bgp99_heuristics_hull;
01465     wf(ph, y_hull);
01466     // Compute the difference between `ph' and `bgp99_heuristics_hull'.
01467     ph.difference_assign(bgp99_heuristics_hull);
01468     x.add_disjunct(ph);
01469     return;
01470   }
01471 
01472   // Fall back to the computation of the poly-hull.
01473   Pointset_Powerset<PSET> x_hull_singleton(x.space_dim, EMPTY);
01474   x_hull_singleton.add_disjunct(x_hull);
01475   std::swap(x, x_hull_singleton);
01476 }

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() 
) [inline]

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:
var The variable updated by the affine relation;
lb_expr The numerator of the lower bounding affine expression;
ub_expr The numerator of the upper bounding affine expression;
denominator The (common) denominator for the lower and upper bounding affine expressions (optional argument with default value 1).
Exceptions:
std::invalid_argument Thrown 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 460 of file Pointset_Powerset.templates.hh.

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

00463                                                                       {
00464   Pointset_Powerset& x = *this;
00465   for (Sequence_iterator si = x.sequence.begin(),
00466          s_end = x.sequence.end(); si != s_end; ++si) {
00467     si->pointset().bounded_affine_image(var, lb_expr, ub_expr, denominator);
00468     x.reduced = false;
00469   }
00470   PPL_ASSERT_HEAVY(x.OK());
00471 }

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() 
) [inline]

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:
var The variable updated by the affine relation;
lb_expr The numerator of the lower bounding affine expression;
ub_expr The numerator of the upper bounding affine expression;
denominator The (common) denominator for the lower and upper bounding affine expressions (optional argument with default value 1).
Exceptions:
std::invalid_argument Thrown 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 476 of file Pointset_Powerset.templates.hh.

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

00479                                                                          {
00480   Pointset_Powerset& x = *this;
00481   for (Sequence_iterator si = x.sequence.begin(),
00482          s_end = x.sequence.end(); si != s_end; ++si) {
00483     si->pointset().bounded_affine_preimage(var, lb_expr, ub_expr,
00484                                           denominator);
00485     x.reduced = false;
00486   }
00487   PPL_ASSERT_HEAVY(x.OK());
00488 }

template<typename PSET >
bool Parma_Polyhedra_Library::Pointset_Powerset< PSET >::bounds_from_above ( const Linear_Expression expr  )  const [inline]

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

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

Definition at line 887 of file Pointset_Powerset.templates.hh.

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

00887                                                        {
00888   const Pointset_Powerset& x = *this;
00889   x.omega_reduce();
00890   for (Sequence_const_iterator si = x.sequence.begin(),
00891          s_end = x.sequence.end(); si != s_end; ++si)
00892     if (!si->pointset().bounds_from_above(expr))
00893       return false;
00894   return true;
00895 }

template<typename PSET >
bool Parma_Polyhedra_Library::Pointset_Powerset< PSET >::bounds_from_below ( const Linear_Expression expr  )  const [inline]

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

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

Definition at line 900 of file Pointset_Powerset.templates.hh.

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

00900                                                        {
00901   const Pointset_Powerset& x = *this;
00902   x.omega_reduce();
00903   for (Sequence_const_iterator si = x.sequence.begin(),
00904          s_end = x.sequence.end(); si != s_end; ++si)
00905     if (!si->pointset().bounds_from_below(expr))
00906       return false;
00907   return true;
00908 }

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 [inline, private]

Records in cert_ms the certificates for this set of disjuncts.

Definition at line 1303 of file Pointset_Powerset.templates.hh.

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

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

01304                                                            {
01305   const Pointset_Powerset& x = *this;
01306   PPL_ASSERT(x.is_omega_reduced());
01307   PPL_ASSERT(cert_ms.size() == 0);
01308   for (const_iterator i = x.begin(), end = x.end(); i != end; i++) {
01309     Cert ph_cert(i->pointset());
01310     ++cert_ms[ph_cert];
01311   }
01312 }

template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::concatenate_assign ( const Pointset_Powerset< PSET > &  y  )  [inline]

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 103 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::Pointset_Powerset< PSET >::swap().

00103                                                                       {
00104   Pointset_Powerset& x = *this;
00105   // Ensure omega-reduction here, since what follows has quadratic complexity.
00106   x.omega_reduce();
00107   y.omega_reduce();
00108   Pointset_Powerset<PSET> new_x(x.space_dim + y.space_dim, EMPTY);
00109   for (const_iterator xi = x.begin(), x_end = x.end(),
00110          y_begin = y.begin(), y_end = y.end(); xi != x_end; ) {
00111     for (const_iterator yi = y_begin; yi != y_end; ++yi) {
00112       Det_PSET zi = *xi;
00113       zi.concatenate_assign(*yi);
00114       PPL_ASSERT_HEAVY(!zi.is_bottom());
00115       new_x.sequence.push_back(zi);
00116     }
00117     ++xi;
00118     if (abandon_expensive_computations && xi != x_end && y_begin != y_end) {
00119       // Hurry up!
00120       PSET xph = xi->pointset();
00121       for (++xi; xi != x_end; ++xi)
00122         xph.upper_bound_assign(xi->pointset());
00123       const_iterator yi = y_begin;
00124       PSET yph = yi->pointset();
00125       for (++yi; yi != y_end; ++yi)
00126         yph.upper_bound_assign(yi->pointset());
00127       xph.concatenate_assign(yph);
00128       x.swap(new_x);
00129       x.add_disjunct(xph);
00130       PPL_ASSERT_HEAVY(x.OK());
00131       return;
00132     }
00133   }
00134   x.swap(new_x);
00135   PPL_ASSERT_HEAVY(x.OK());
00136 }

template<typename PSET >
bool Parma_Polyhedra_Library::Pointset_Powerset< PSET >::constrains ( Variable  var  )  const [inline]

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

Exceptions:
std::invalid_argument Thrown 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 588 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::Pointset_Powerset< PSET >::space_dimension(), and Parma_Polyhedra_Library::Variable::space_dimension().

00588                                                       {
00589   const Pointset_Powerset& x = *this;
00590   // `var' should be one of the dimensions of the powerset.
00591   const dimension_type var_space_dim = var.space_dimension();
00592   if (x.space_dimension() < var_space_dim) {
00593     std::ostringstream s;
00594     s << "PPL::Pointset_Powerset<PSET>::constrains(v):\n"
00595       << "this->space_dimension() == " << x.space_dimension() << ", "
00596       << "v.space_dimension() == " << var_space_dim << ".";
00597     throw std::invalid_argument(s.str());
00598   }
00599   // omega_reduction needed, since a redundant disjunct may constrain var.
00600   x.omega_reduce();
00601   // An empty powerset constrains all variables.
00602   if (x.is_empty())
00603     return true;
00604   for (const_iterator x_i = x.begin(), x_end = x.end(); x_i != x_end; ++x_i)
00605     if (x_i->pointset().constrains(var))
00606       return true;
00607   return false;
00608 }

template<typename PSET >
bool Parma_Polyhedra_Library::Pointset_Powerset< PSET >::contains ( const Pointset_Powerset< PSET > &  y  )  const [inline]

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

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

Definition at line 737 of file Pointset_Powerset.templates.hh.

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

00737                                                                   {
00738   const Pointset_Powerset& x = *this;
00739   for (Sequence_const_iterator si = y.sequence.begin(),
00740          ys_end = y.sequence.end(); si != ys_end; ++si) {
00741     const PSET& pi = si->pointset();
00742     bool pi_is_contained = false;
00743     for (Sequence_const_iterator sj = x.sequence.begin(),
00744            xs_end = x.sequence.end();
00745          (sj != xs_end && !pi_is_contained); ++sj) {
00746       const PSET& pj = sj->pointset();
00747       if (pj.contains(pi))
00748         pi_is_contained = true;
00749     }
00750     if (!pi_is_contained)
00751       return false;
00752   }
00753   return true;
00754 }

template<typename PSET >
bool Parma_Polyhedra_Library::Pointset_Powerset< PSET >::contains_integer_point (  )  const [inline]

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

Definition at line 1148 of file Pointset_Powerset.templates.hh.

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

01148                                                       {
01149   const Pointset_Powerset& x = *this;
01150   for (Sequence_const_iterator si = x.sequence.begin(),
01151          s_end = x.sequence.end(); si != s_end; ++si)
01152     if (si->pointset().contains_integer_point())
01153       return true;
01154   return false;
01155 }

template<>
void Parma_Polyhedra_Library::Pointset_Powerset< PPL::Grid >::difference_assign ( const Pointset_Powerset< PSET > &  y  )  [inline]

Definition at line 258 of file Pointset_Powerset.cc.

References Parma_Polyhedra_Library::Pointset_Powerset< PSET >::approximate_partition(), 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::Pointset_Powerset< PSET >::swap().

00258                                               {
00259   Pointset_Powerset& x = *this;
00260   // Ensure omega-reduction.
00261   x.omega_reduce();
00262   y.omega_reduce();
00263   Sequence new_sequence = x.sequence;
00264   for (const_iterator yi = y.begin(), y_end = y.end(); yi != y_end; ++yi) {
00265     const Grid& py = yi->pointset();
00266     Sequence tmp_sequence;
00267     for (Sequence_const_iterator nsi = new_sequence.begin(),
00268            ns_end = new_sequence.end(); nsi != ns_end; ++nsi) {
00269       bool finite_partition;
00270       std::pair<Grid, Pointset_Powerset<Grid> > partition
00271         = approximate_partition(py, nsi->pointset(), finite_partition);
00272       const Pointset_Powerset<Grid>& residues = partition.second;
00273       // Append the contents of `residues' to `tmp_sequence'.
00274       std::copy(residues.begin(), residues.end(), back_inserter(tmp_sequence));
00275     }
00276     std::swap(tmp_sequence, new_sequence);
00277   }
00278   std::swap(x.sequence, new_sequence);
00279   x.reduced = false;
00280   PPL_ASSERT_HEAVY(x.OK());
00281 }

template<>
void Parma_Polyhedra_Library::Pointset_Powerset< PPL::NNC_Polyhedron >::difference_assign ( const Pointset_Powerset< PSET > &  y  )  [inline]

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, and Parma_Polyhedra_Library::Pointset_Powerset< PSET >::swap().

00034                                               {
00035   Pointset_Powerset& x = *this;
00036   // Ensure omega-reduction.
00037   x.omega_reduce();
00038   y.omega_reduce();
00039   Sequence new_sequence = x.sequence;
00040   for (const_iterator yi = y.begin(), y_end = y.end(); yi != y_end; ++yi) {
00041     const NNC_Polyhedron& py = yi->pointset();
00042     Sequence tmp_sequence;
00043     for (Sequence_const_iterator nsi = new_sequence.begin(),
00044            ns_end = new_sequence.end(); nsi != ns_end; ++nsi) {
00045       std::pair<NNC_Polyhedron, Pointset_Powerset<NNC_Polyhedron> > partition
00046         = linear_partition(py, nsi->pointset());
00047       const Pointset_Powerset<NNC_Polyhedron>& residues = partition.second;
00048       // Append the contents of `residues' to `tmp_sequence'.
00049       std::copy(residues.begin(), residues.end(), back_inserter(tmp_sequence));
00050     }
00051     std::swap(tmp_sequence, new_sequence);
00052   }
00053   std::swap(x.sequence, new_sequence);
00054   x.reduced = false;
00055   PPL_ASSERT_HEAVY(x.OK());
00056 }

template<>
void Parma_Polyhedra_Library::Pointset_Powerset< Grid >::difference_assign ( const Pointset_Powerset< PSET > &  y  )  [inline]
template<>
void Parma_Polyhedra_Library::Pointset_Powerset< NNC_Polyhedron >::difference_assign ( const Pointset_Powerset< PSET > &  y  )  [inline]
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_argument Thrown if *this and y are dimension-incompatible.

Definition at line 283 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().

00283                                               {
00284   // This code is only used when PSET is an abstraction of NNC_Polyhedron.
00285   Pointset_Powerset<NNC_Polyhedron> nnc_this(*this);
00286   Pointset_Powerset<NNC_Polyhedron> nnc_y(y);
00287   nnc_this.difference_assign(nnc_y);
00288   *this = nnc_this;
00289 }

template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::drop_some_non_integer_points ( const Variables_Set vars,
Complexity_Class  complexity = ANY_COMPLEXITY 
) [inline]

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

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

Definition at line 630 of file Pointset_Powerset.templates.hh.

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

00631                                                             {
00632   Pointset_Powerset& x = *this;
00633   for (Sequence_iterator si = x.sequence.begin(),
00634          s_end = x.sequence.end(); si != s_end; ++si)
00635     si->pointset().drop_some_non_integer_points(vars, complexity);
00636   x.reduced = false;
00637   PPL_ASSERT_HEAVY(x.OK());
00638 }

template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::drop_some_non_integer_points ( Complexity_Class  complexity = ANY_COMPLEXITY  )  [inline]

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

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

Definition at line 643 of file Pointset_Powerset.templates.hh.

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

00643                                                           {
00644   Pointset_Powerset& x = *this;
00645   for (Sequence_iterator si = x.sequence.begin(),
00646          s_end = x.sequence.end(); si != s_end; ++si)
00647     si->pointset().drop_some_non_integer_points(complexity);
00648   x.reduced = false;
00649   PPL_ASSERT_HEAVY(x.OK());
00650 }

template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::expand_space_dimension ( Variable  var,
dimension_type  m 
) [inline]

Creates m copies of the space dimension corresponding to var.

Parameters:
var The variable corresponding to the space dimension to be replicated;
m The number of replicas to be created.
Exceptions:
std::invalid_argument Thrown if var does not correspond to a dimension of the vector space.
std::length_error Thrown 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 331 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.

00332                                                                   {
00333   Pointset_Powerset& x = *this;
00334   for (Sequence_iterator si = x.sequence.begin(),
00335          s_end = x.sequence.end(); si != s_end; ++si)
00336     si->pointset().expand_space_dimension(var, m);
00337   x.space_dim += m;
00338   PPL_ASSERT_HEAVY(x.OK());
00339 }

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.

Reimplemented from Parma_Polyhedra_Library::Powerset< Parma_Polyhedra_Library::Determinate< PSET > >.

Definition at line 264 of file Pointset_Powerset.inlines.hh.

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

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

00264                                                         {
00265   return Base::external_memory_in_bytes();
00266 }

template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::fold_space_dimensions ( const Variables_Set vars,
Variable  dest 
) [inline]

Folds the space dimensions in vars into dest.

Parameters:
vars The set of Variable objects corresponding to the space dimensions to be folded;
dest The variable corresponding to the space dimension that is the destination of the folding operation.
Exceptions:
std::invalid_argument Thrown 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 343 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.

00344                                                               {
00345   Pointset_Powerset& x = *this;
00346   Variables_Set::size_type num_folded = vars.size();
00347   if (num_folded > 0) {
00348     for (Sequence_iterator si = x.sequence.begin(),
00349            s_end = x.sequence.end(); si != s_end; ++si)
00350       si->pointset().fold_space_dimensions(vars, dest);
00351   }
00352   x.space_dim -= num_folded;
00353   PPL_ASSERT_HEAVY(x.OK());
00354 }

template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::generalized_affine_image ( const Linear_Expression lhs,
Relation_Symbol  relsym,
const Linear_Expression rhs 
) [inline]

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:
lhs The left hand side affine expression;
relsym The relation symbol;
rhs The right hand side affine expression.
Exceptions:
std::invalid_argument Thrown 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 396 of file Pointset_Powerset.templates.hh.

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

00398                                                          {
00399   Pointset_Powerset& x = *this;
00400   for (Sequence_iterator si = x.sequence.begin(),
00401          s_end = x.sequence.end(); si != s_end; ++si) {
00402     si->pointset().generalized_affine_image(lhs, relsym, rhs);
00403     x.reduced = false;
00404   }
00405   PPL_ASSERT_HEAVY(x.OK());
00406 }

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() 
) [inline]

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:
var The left hand side variable of the generalized affine relation;
relsym The relation symbol;
expr The numerator of the right hand side affine expression;
denominator The denominator of the right hand side affine expression (optional argument with default value 1).
Exceptions:
std::invalid_argument Thrown 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 426 of file Pointset_Powerset.templates.hh.

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

00429                                                                           {
00430   Pointset_Powerset& x = *this;
00431   for (Sequence_iterator si = x.sequence.begin(),
00432          s_end = x.sequence.end(); si != s_end; ++si) {
00433     si->pointset().generalized_affine_image(var, relsym, expr, denominator);
00434     x.reduced = false;
00435   }
00436   PPL_ASSERT_HEAVY(x.OK());
00437 }

template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::generalized_affine_preimage ( const Linear_Expression lhs,
Relation_Symbol  relsym,
const Linear_Expression rhs 
) [inline]

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:
lhs The left hand side affine expression;
relsym The relation symbol;
rhs The right hand side affine expression.
Exceptions:
std::invalid_argument Thrown 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 411 of file Pointset_Powerset.templates.hh.

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

00413                                                             {
00414   Pointset_Powerset& x = *this;
00415   for (Sequence_iterator si = x.sequence.begin(),
00416          s_end = x.sequence.end(); si != s_end; ++si) {
00417     si->pointset().generalized_affine_preimage(lhs, relsym, rhs);
00418     x.reduced = false;
00419   }
00420   PPL_ASSERT_HEAVY(x.OK());
00421 }

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() 
) [inline]

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:
var The left hand side variable of the generalized affine relation;
relsym The relation symbol;
expr The numerator of the right hand side affine expression;
denominator The denominator of the right hand side affine expression (optional argument with default value 1).
Exceptions:
std::invalid_argument Thrown 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 442 of file Pointset_Powerset.templates.hh.

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

00446                                            {
00447   Pointset_Powerset& x = *this;
00448   for (Sequence_iterator si = x.sequence.begin(),
00449          s_end = x.sequence.end(); si != s_end; ++si) {
00450     si->pointset().generalized_affine_preimage(var, relsym, expr, denominator);
00451     x.reduced = false;
00452   }
00453   PPL_ASSERT_HEAVY(x.OK());
00454 }

template<>
bool Parma_Polyhedra_Library::Pointset_Powerset< PPL::Grid >::geometrically_covers ( const Pointset_Powerset< PSET > &  y  )  const [inline]

Definition at line 286 of file Pointset_Powerset.cc.

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

00286                                                        {
00287   const Pointset_Powerset& x = *this;
00288   for (const_iterator yi = y.begin(), y_end = y.end(); yi != y_end; ++yi)
00289     if (!check_containment(yi->pointset(), x))
00290       return false;
00291   return true;
00292 }

template<>
bool Parma_Polyhedra_Library::Pointset_Powerset< PPL::NNC_Polyhedron >::geometrically_covers ( const Pointset_Powerset< PSET > &  y  )  const [inline]

Definition at line 61 of file Pointset_Powerset.cc.

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

00061                                                        {
00062   const Pointset_Powerset& x = *this;
00063   for (const_iterator yi = y.begin(), y_end = y.end(); yi != y_end; ++yi)
00064     if (!check_containment(yi->pointset(), x))
00065       return false;
00066   return true;
00067 }

template<>
bool Parma_Polyhedra_Library::Pointset_Powerset< Grid >::geometrically_covers ( const Pointset_Powerset< PSET > &  y  )  const [inline]
template<>
bool Parma_Polyhedra_Library::Pointset_Powerset< NNC_Polyhedron >::geometrically_covers ( const Pointset_Powerset< PSET > &  y  )  const [inline]
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_argument Thrown if *this and y are dimension-incompatible.
Warning:
This may be really expensive!

Definition at line 229 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().

00229                                                        {
00230   // This code is only used when PSET is an abstraction of NNC_Polyhedron.
00231   const Pointset_Powerset<NNC_Polyhedron> xx(*this);
00232   const Pointset_Powerset<NNC_Polyhedron> yy(y);
00233   return xx.geometrically_covers(yy);
00234 }

template<>
bool Parma_Polyhedra_Library::Pointset_Powerset< NNC_Polyhedron >::geometrically_equals ( const Pointset_Powerset< PSET > &  y  )  const [inline]

Definition at line 257 of file Pointset_Powerset.inlines.hh.

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

00257                                                        {
00258   const Pointset_Powerset& x = *this;
00259   return x.geometrically_covers(y) && y.geometrically_covers(x);
00260 }

template<>
bool Parma_Polyhedra_Library::Pointset_Powerset< Grid >::geometrically_equals ( const Pointset_Powerset< PSET > &  y  )  const [inline]

Definition at line 249 of file Pointset_Powerset.inlines.hh.

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

00249                                                        {
00250   const Pointset_Powerset& x = *this;
00251   return x.geometrically_covers(y) && y.geometrically_covers(x);
00252 }

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_argument Thrown if *this and y are dimension-incompatible.
Warning:
This may be really expensive!

Definition at line 239 of file Pointset_Powerset.inlines.hh.

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

00239                                                        {
00240   // This code is only used when PSET is an abstraction of NNC_Polyhedron.
00241   const Pointset_Powerset<NNC_Polyhedron> xx(*this);
00242   const Pointset_Powerset<NNC_Polyhedron> yy(y);
00243   return xx.geometrically_covers(yy) && yy.geometrically_covers(xx);
00244 }

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 276 of file Pointset_Powerset.inlines.hh.

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

00276                                          {
00277   return space_dimension() & 0x7fffffff;
00278 }

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 210 of file Pointset_Powerset.inlines.hh.

References Parma_Polyhedra_Library::Determinate< PSET >::lift_op_assign(), and Parma_Polyhedra_Library::Powerset< D >::pairwise_apply_assign().

00210                                                                        {
00211   Pointset_Powerset& x = *this;
00212   x.pairwise_apply_assign
00213     (y,
00214      Det_PSET::lift_op_assign(std::mem_fun_ref(&PSET::intersection_assign)));
00215 }

template<typename PSET >
bool Parma_Polyhedra_Library::Pointset_Powerset< PSET >::intersection_preserving_enlarge_element ( PSET &  dest  )  const [inline, 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 665 of file Pointset_Powerset.templates.hh.

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

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

00665                                                           {
00666   // FIXME: this is just an executable specification.
00667   const Pointset_Powerset& context = *this;
00668   PPL_ASSERT(context.space_dimension() == dest.space_dimension());
00669   bool nonempty_intersection = false;
00670   // TODO: maybe use a *sorted* constraint system?
00671   PSET enlarged(context.space_dimension(), UNIVERSE);
00672   for (Sequence_const_iterator si = context.sequence.begin(),
00673          s_end = context.sequence.end(); si != s_end; ++si) {
00674     PSET context_i(si->pointset());
00675     context_i.intersection_assign(enlarged);
00676     PSET enlarged_i(dest);
00677     nonempty_intersection
00678       |= enlarged_i.simplify_using_context_assign(context_i);
00679     // TODO: merge the sorted constraints of `enlarged' and `enlarged_i'?
00680     enlarged.intersection_assign(enlarged_i);
00681   }
00682   dest.swap(enlarged);
00683   return nonempty_intersection;
00684 }

template<typename PSET >
bool Parma_Polyhedra_Library::Pointset_Powerset< PSET >::is_bounded (  )  const [inline]

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

Definition at line 577 of file Pointset_Powerset.templates.hh.

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

00577                                           {
00578   const Pointset_Powerset& x = *this;
00579   for (Sequence_const_iterator si = x.sequence.begin(),
00580          s_end = x.sequence.end(); si != s_end; ++si)
00581     if (!si->pointset().is_bounded())
00582       return false;
00583   return true;
00584 }

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 [inline, private]

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

Definition at line 1318 of file Pointset_Powerset.templates.hh.

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

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

01319                                                                      {
01320   typedef std::map<Cert, size_type, typename Cert::Compare> Cert_Multiset;
01321   Cert_Multiset x_cert_ms;
01322   collect_certificates(x_cert_ms);
01323   typename Cert_Multiset::const_iterator
01324     xi = x_cert_ms.begin(),
01325     x_cert_ms_end = x_cert_ms.end(),
01326     yi = y_cert_ms.begin(),
01327     y_cert_ms_end = y_cert_ms.end();
01328   while (xi != x_cert_ms_end && yi != y_cert_ms_end) {
01329     const Cert& xi_cert = xi->first;
01330     const Cert& yi_cert = yi->first;
01331     switch (xi_cert.compare(yi_cert)) {
01332     case 0:
01333       // xi_cert == yi_cert: check the number of multiset occurrences.
01334       {
01335         const size_type& xi_count = xi->second;
01336         const size_type& yi_count = yi->second;
01337         if (xi_count == yi_count) {
01338           // Same number of occurrences: compare the next pair.
01339           ++xi;
01340           ++yi;
01341         }
01342         else
01343           // Different number of occurrences: can decide ordering.
01344           return xi_count < yi_count;
01345         break;
01346       }
01347     case 1:
01348       // xi_cert > yi_cert: it is not stabilizing.
01349       return false;
01350 
01351     case -1:
01352       // xi_cert < yi_cert: it is stabilizing.
01353       return true;
01354     }
01355   }
01356   // Here xi == x_cert_ms_end or yi == y_cert_ms_end.
01357   // Stabilization is achieved if `y_cert_ms' still has other elements.
01358   return yi != y_cert_ms_end;
01359 }

template<typename PSET >
bool Parma_Polyhedra_Library::Pointset_Powerset< PSET >::is_discrete (  )  const [inline]

Returns true if and only if *this is discrete.

Definition at line 552 of file Pointset_Powerset.templates.hh.

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

00552                                            {
00553   const Pointset_Powerset& x = *this;
00554   for (Sequence_const_iterator si = x.sequence.begin(),
00555          s_end = x.sequence.end(); si != s_end; ++si)
00556     if (!si->pointset().is_discrete())
00557       return false;
00558   return true;
00559 }

template<typename PSET >
bool Parma_Polyhedra_Library::Pointset_Powerset< PSET >::is_disjoint_from ( const Pointset_Powerset< PSET > &  y  )  const [inline]

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

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

Definition at line 612 of file Pointset_Powerset.templates.hh.

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

00612                                                                           {
00613   const Pointset_Powerset& x = *this;
00614   for (Sequence_const_iterator si = x.sequence.begin(),
00615          xs_end = x.sequence.end(); si != xs_end; ++si) {
00616     const PSET& pi = si->pointset();
00617     for (Sequence_const_iterator sj = y.sequence.begin(),
00618            ys_end = y.sequence.end(); sj != ys_end; ++sj) {
00619       const PSET& pj = sj->pointset();
00620       if (!pi.is_disjoint_from(pj))
00621         return false;
00622     }
00623   }
00624   return true;
00625 }

template<typename PSET >
bool Parma_Polyhedra_Library::Pointset_Powerset< PSET >::is_empty (  )  const [inline]

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

Definition at line 541 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().

00541                                         {
00542   const Pointset_Powerset& x = *this;
00543   for (Sequence_const_iterator si = x.sequence.begin(),
00544          s_end = x.sequence.end(); si != s_end; ++si)
00545     if (!si->pointset().is_empty())
00546       return false;
00547   return true;
00548 }

template<typename PSET >
bool Parma_Polyhedra_Library::Pointset_Powerset< PSET >::is_topologically_closed (  )  const [inline]

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

Definition at line 563 of file Pointset_Powerset.templates.hh.

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

00563                                                        {
00564   const Pointset_Powerset& x = *this;
00565   // The powerset must be omega-reduced before checking
00566   // topological closure.
00567   x.omega_reduce();
00568   for (Sequence_const_iterator si = x.sequence.begin(),
00569          s_end = x.sequence.end(); si != s_end; ++si)
00570     if (!si->pointset().is_topologically_closed())
00571       return false;
00572   return true;
00573 }

template<typename PSET >
bool Parma_Polyhedra_Library::Pointset_Powerset< PSET >::is_universe (  )  const [inline]

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

Definition at line 519 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::Pointset_Powerset< PSET >::swap(), and Parma_Polyhedra_Library::UNIVERSE.

00519                                            {
00520   const Pointset_Powerset& x = *this;
00521   // Exploit omega-reduction, if already computed.
00522   if (x.is_omega_reduced())
00523     return x.size() == 1 && x.begin()->pointset().is_universe();
00524 
00525   // A powerset is universe iff one of its disjuncts is.
00526   for (const_iterator x_i = x.begin(), x_end = x.end(); x_i != x_end; ++x_i)
00527     if (x_i->pointset().is_universe()) {
00528       // Speculative omega-reduction, if it is worth.
00529       if (x.size() > 1) {
00530         Pointset_Powerset<PSET> universe(x.space_dimension(), UNIVERSE);
00531         Pointset_Powerset& xx = const_cast<Pointset_Powerset&>(x);
00532         xx.swap(universe);
00533       }
00534       return true;
00535     }
00536   return false;
00537 }

template<typename PSET >
template<typename Partial_Function >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::map_space_dimensions ( const Partial_Function &  pfunc  )  [inline]

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

See also Polyhedron::map_space_dimensions.

Definition at line 307 of file Pointset_Powerset.templates.hh.

References Parma_Polyhedra_Library::Powerset< D >::is_bottom(), 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.

00307                                                                            {
00308   Pointset_Powerset& x = *this;
00309   if (x.is_bottom()) {
00310     dimension_type n = 0;
00311     for (dimension_type i = x.space_dim; i-- > 0; ) {
00312       dimension_type new_i;
00313       if (pfunc.maps(i, new_i))
00314         ++n;
00315     }
00316     x.space_dim = n;
00317   }
00318   else {
00319     Sequence_iterator s_begin = x.sequence.begin();
00320     for (Sequence_iterator si = s_begin,
00321            s_end = x.sequence.end(); si != s_end; ++si)
00322       si->pointset().map_space_dimensions(pfunc);
00323     x.space_dim = s_begin->pointset().space_dimension();
00324     x.reduced = false;
00325   }
00326   PPL_ASSERT_HEAVY(x.OK());
00327 }

template<typename PSET >
dimension_type Parma_Polyhedra_Library::Pointset_Powerset< PSET >::max_space_dimension (  )  [inline, static]

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

Definition at line 48 of file Pointset_Powerset.inlines.hh.

00048                                              {
00049   return PSET::max_space_dimension();
00050 }

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 [inline]

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:
expr The linear expression to be maximized subject to *this;
sup_n The numerator of the supremum value;
sup_d The denominator of the supremum value;
maximum true if and only if the supremum is also the maximum value;
g When maximization succeeds, will be assigned the point or closure point where expr reaches its supremum value.
Exceptions:
std::invalid_argument Thrown 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 967 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.

00971                                                       {
00972   const Pointset_Powerset& x = *this;
00973   x.omega_reduce();
00974   if (x.is_empty())
00975     return false;
00976 
00977   bool first = true;
00978 
00979   PPL_DIRTY_TEMP_COEFFICIENT(supt_n);
00980   PPL_DIRTY_TEMP_COEFFICIENT(supt_d);
00981   supt_n = 0;
00982   supt_d = 1;
00983   bool maxt = 0;
00984   Generator gt = point();
00985 
00986   PPL_DIRTY_TEMP_COEFFICIENT(supi_n);
00987   PPL_DIRTY_TEMP_COEFFICIENT(supi_d);
00988   supi_n = 0;
00989   supi_d = 1;
00990   bool maxi = 0;
00991   Generator gi = point();
00992 
00993   PPL_DIRTY_TEMP_COEFFICIENT(tmp);
00994 
00995   for (Sequence_const_iterator si = x.sequence.begin(),
00996          s_end = x.sequence.end(); si != s_end; ++si) {
00997     if (!si->pointset().maximize(expr, supi_n, supi_d, maxi, gi))
00998       return false;
00999     else
01000       if (first) {
01001         first = false;
01002         supt_n = supi_n;
01003         supt_d = supi_d;
01004         maxt = maxi;
01005         gt = gi;
01006       }
01007       else {
01008         tmp = (supt_n * supi_d) - (supi_n * supt_d);
01009         if (tmp < 0) {
01010           supt_n = supi_n;
01011           supt_d = supi_d;
01012           maxt = maxi;
01013           gt = gi;
01014         }
01015         else if (tmp == 0) {
01016           maxt = maxt || maxi;
01017           gt = gi;
01018         }
01019       }
01020   }
01021   sup_n = supt_n;
01022   sup_d = supt_d;
01023   maximum = maxt;
01024   g = gt;
01025   return true;
01026 }

template<typename PSET >
bool Parma_Polyhedra_Library::Pointset_Powerset< PSET >::maximize ( const Linear_Expression expr,
Coefficient sup_n,
Coefficient sup_d,
bool &  maximum 
) const [inline]

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:
expr The linear expression to be maximized subject to *this;
sup_n The numerator of the supremum value;
sup_d The denominator of the supremum value;
maximum true if and only if the supremum is also the maximum value.
Exceptions:
std::invalid_argument Thrown 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 912 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.

00915                                                        {
00916   const Pointset_Powerset& x = *this;
00917   x.omega_reduce();
00918   if (x.is_empty())
00919     return false;
00920 
00921   bool first = true;
00922 
00923   PPL_DIRTY_TEMP_COEFFICIENT(supt_n);
00924   PPL_DIRTY_TEMP_COEFFICIENT(supt_d);
00925   supt_n = 0;
00926   supt_d = 1;
00927   bool maxt = 0;
00928 
00929   PPL_DIRTY_TEMP_COEFFICIENT(supi_n);
00930   PPL_DIRTY_TEMP_COEFFICIENT(supi_d);
00931   supi_n = 0;
00932   supi_d = 1;
00933   bool maxi = 0;
00934 
00935   PPL_DIRTY_TEMP_COEFFICIENT(tmp);
00936 
00937   for (Sequence_const_iterator si = x.sequence.begin(),
00938          s_end = x.sequence.end(); si != s_end; ++si) {
00939     if (!si->pointset().maximize(expr, supi_n, supi_d, maxi))
00940       return false;
00941     else
00942       if (first) {
00943         first = false;
00944         supt_n = supi_n;
00945         supt_d = supi_d;
00946         maxt = maxi;
00947       }
00948       else {
00949         tmp = (supt_n * supi_d) - (supi_n * supt_d);
00950         if (tmp < 0) {
00951           supt_n = supi_n;
00952           supt_d = supi_d;
00953           maxt = maxi;
00954         }
00955         else if (tmp == 0)
00956           maxt = maxt || maxi;
00957       }
00958   }
00959   sup_n = supt_n;
00960   sup_d = supt_d;
00961   maximum = maxt;
00962   return true;
00963 }

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 [inline]

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:
expr The linear expression to be minimized subject to *this;
inf_n The numerator of the infimum value;
inf_d The denominator of the infimum value;
minimum true if and only if the infimum is also the minimum value;
g When minimization succeeds, will be assigned a point or closure point where expr reaches its infimum value.
Exceptions:
std::invalid_argument Thrown 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 1085 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.

01089                                                       {
01090   const Pointset_Powerset& x = *this;
01091   x.omega_reduce();
01092   if (x.is_empty())
01093     return false;
01094 
01095   bool first = true;
01096 
01097   PPL_DIRTY_TEMP_COEFFICIENT(inft_n);
01098   PPL_DIRTY_TEMP_COEFFICIENT(inft_d);
01099   inft_n = 0;
01100   inft_d = 1;
01101   bool mint = 0;
01102   Generator gt = point();
01103 
01104   PPL_DIRTY_TEMP_COEFFICIENT(infi_n);
01105   PPL_DIRTY_TEMP_COEFFICIENT(infi_d);
01106   infi_n = 0;
01107   infi_d = 1;
01108   bool mini = 0;
01109   Generator gi = point();
01110 
01111   PPL_DIRTY_TEMP_COEFFICIENT(tmp);
01112 
01113   for (Sequence_const_iterator si = x.sequence.begin(),
01114          s_end = x.sequence.end(); si != s_end; ++si) {
01115     if (!si->pointset().minimize(expr, infi_n, infi_d, mini, gi))
01116       return false;
01117     else
01118       if (first) {
01119         first = false;
01120         inft_n = infi_n;
01121         inft_d = infi_d;
01122         mint = mini;
01123         gt = gi;
01124       }
01125       else {
01126         tmp = (inft_n * infi_d) - (infi_n * inft_d);
01127         if (tmp > 0) {
01128           inft_n = infi_n;
01129           inft_d = infi_d;
01130           mint = mini;
01131           gt = gi;
01132         }
01133         else if (tmp == 0) {
01134           mint = mint || mini;
01135           gt = gi;
01136         }
01137       }
01138   }
01139   inf_n = inft_n;
01140   inf_d = inft_d;
01141   minimum = mint;
01142   g = gt;
01143   return true;
01144 }

template<typename PSET >
bool Parma_Polyhedra_Library::Pointset_Powerset< PSET >::minimize ( const Linear_Expression expr,
Coefficient inf_n,
Coefficient inf_d,
bool &  minimum 
) const [inline]

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:
expr The linear expression to be minimized subject to *this;
inf_n The numerator of the infimum value;
inf_d The denominator of the infimum value;
minimum true if and only if the infimum is also the minimum value.
Exceptions:
std::invalid_argument Thrown 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 1030 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.

01033                                                        {
01034   const Pointset_Powerset& x = *this;
01035   x.omega_reduce();
01036   if (x.is_empty())
01037     return false;
01038 
01039   bool first = true;
01040 
01041   PPL_DIRTY_TEMP_COEFFICIENT(inft_n);
01042   PPL_DIRTY_TEMP_COEFFICIENT(inft_d);
01043   inft_n = 0;
01044   inft_d = 1;
01045   bool mint = 0;
01046 
01047   PPL_DIRTY_TEMP_COEFFICIENT(infi_n);
01048   PPL_DIRTY_TEMP_COEFFICIENT(infi_d);
01049   infi_n = 0;
01050   infi_d = 1;
01051   bool mini = 0;
01052 
01053   PPL_DIRTY_TEMP_COEFFICIENT(tmp);
01054 
01055   for (Sequence_const_iterator si = x.sequence.begin(),
01056          s_end = x.sequence.end(); si != s_end; ++si) {
01057     if (!si->pointset().minimize(expr, infi_n, infi_d, mini))
01058       return false;
01059     else
01060       if (first) {
01061         first = false;
01062         inft_n = infi_n;
01063         inft_d = infi_d;
01064         mint = mini;
01065       }
01066       else {
01067         tmp = (inft_n * infi_d) - (infi_n * inft_d);
01068         if (tmp > 0) {
01069           inft_n = infi_n;
01070           inft_d = infi_d;
01071           mint = mini;
01072         }
01073         else if (tmp == 0)
01074           mint = mint || mini;
01075       }
01076   }
01077   inf_n = inft_n;
01078   inf_d = inft_d;
01079   minimum = mint;
01080   return true;
01081 }

template<typename PSET >
bool Parma_Polyhedra_Library::Pointset_Powerset< PSET >::OK (  )  const [inline]

Checks if all the invariants are satisfied.

Definition at line 1527 of file Pointset_Powerset.templates.hh.

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

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().

01527                                   {
01528   const Pointset_Powerset& x = *this;
01529   for (const_iterator xi = x.begin(), x_end = x.end(); xi != x_end; ++xi) {
01530     const PSET& pi = xi->pointset();
01531     if (pi.space_dimension() != x.space_dim) {
01532 #ifndef NDEBUG
01533       std::cerr << "Space dimension mismatch: is " << pi.space_dimension()
01534                 << " in an element of the sequence,\nshould be "
01535                 << x.space_dim << "."
01536                 << std::endl;
01537 #endif
01538       return false;
01539     }
01540   }
01541   return x.Base::OK();
01542 }

template<typename PSET >
template<typename QH >
Pointset_Powerset< PSET > & Parma_Polyhedra_Library::Pointset_Powerset< PSET >::operator= ( const Pointset_Powerset< QH > &  y  )  [inline]

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

Definition at line 201 of file Pointset_Powerset.inlines.hh.

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

00201                                                                  {
00202   Pointset_Powerset& x = *this;
00203   Pointset_Powerset<PSET> pps(y);
00204   x.swap(pps);
00205   return x;
00206 }

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 183 of file Pointset_Powerset.inlines.hh.

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

00183                                                              {
00184   Pointset_Powerset& x = *this;
00185   x.Base::operator=(y);
00186   x.space_dim = y.space_dim;
00187   return x;
00188 }

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

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 1177 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::Pointset_Powerset< PSET >::swap().

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

01177                                          {
01178   Pointset_Powerset& x = *this;
01179   // It is wise to omega-reduce before pairwise-reducing.
01180   x.omega_reduce();
01181 
01182   size_type n = x.size();
01183   size_type deleted;
01184   do {
01185     Pointset_Powerset new_x(x.space_dim, EMPTY);
01186     std::deque<bool> marked(n, false);
01187     deleted = 0;
01188     Sequence_iterator s_begin = x.sequence.begin();
01189     Sequence_iterator s_end = x.sequence.end();
01190     unsigned si_index = 0;
01191     for (Sequence_iterator si = s_begin; si != s_end; ++si, ++si_index) {
01192       if (marked[si_index])
01193         continue;
01194       PSET& pi = si->pointset();
01195       Sequence_const_iterator sj = si;
01196       unsigned sj_index = si_index;
01197       for (++sj, ++sj_index; sj != s_end; ++sj, ++sj_index) {
01198         if (marked[sj_index])
01199           continue;
01200         const PSET& pj = sj->pointset();
01201         if (pi.upper_bound_assign_if_exact(pj)) {
01202           marked[si_index] = marked[sj_index] = true;
01203           new_x.add_non_bottom_disjunct_preserve_reduction(pi);
01204           ++deleted;
01205           goto next;
01206         }
01207       }
01208     next:
01209       ;
01210     }
01211     iterator nx_begin = new_x.begin();
01212     iterator nx_end = new_x.end();
01213     unsigned xi_index = 0;
01214     for (const_iterator xi = x.begin(),
01215            x_end = x.end(); xi != x_end; ++xi, ++xi_index)
01216       if (!marked[xi_index])
01217         nx_begin = new_x.add_non_bottom_disjunct_preserve_reduction(*xi,
01218                                                                     nx_begin,
01219                                                                     nx_end);
01220     std::swap(x.sequence, new_x.sequence);
01221     n -= deleted;
01222   } while (deleted > 0);
01223   PPL_ASSERT_HEAVY(x.OK());
01224 }

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  )  [inline]

Use the congruence cg to refine *this.

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

Definition at line 195 of file Pointset_Powerset.templates.hh.

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

00195                                                                     {
00196   Pointset_Powerset& x = *this;
00197   for (Sequence_iterator si = x.sequence.begin(),
00198          s_end = x.sequence.end(); si != s_end; ++si)
00199     si->pointset().refine_with_congruence(cg);
00200   x.reduced = false;
00201   PPL_ASSERT_HEAVY(x.OK());
00202 }

template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::refine_with_congruences ( const Congruence_System cgs  )  [inline]

Use the congruences in cgs to refine *this.

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

Definition at line 217 of file Pointset_Powerset.templates.hh.

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

00217                                                                              {
00218   Pointset_Powerset& x = *this;
00219   for (Sequence_iterator si = x.sequence.begin(),
00220          s_end = x.sequence.end(); si != s_end; ++si)
00221     si->pointset().refine_with_congruences(cgs);
00222   x.reduced = false;
00223   PPL_ASSERT_HEAVY(x.OK());
00224 }

template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::refine_with_constraint ( const Constraint c  )  [inline]

Use the constraint c to refine *this.

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

Definition at line 151 of file Pointset_Powerset.templates.hh.

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

00151                                                                    {
00152   Pointset_Powerset& x = *this;
00153   for (Sequence_iterator si = x.sequence.begin(),
00154          s_end = x.sequence.end(); si != s_end; ++si)
00155     si->pointset().refine_with_constraint(c);
00156   x.reduced = false;
00157   PPL_ASSERT_HEAVY(x.OK());
00158 }

template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::refine_with_constraints ( const Constraint_System cs  )  [inline]

Use the constraints in cs to refine *this.

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

Definition at line 173 of file Pointset_Powerset.templates.hh.

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

00173                                                                             {
00174   Pointset_Powerset& x = *this;
00175   for (Sequence_iterator si = x.sequence.begin(),
00176          s_end = x.sequence.end(); si != s_end; ++si)
00177     si->pointset().refine_with_constraints(cs);
00178   x.reduced = false;
00179   PPL_ASSERT_HEAVY(x.OK());
00180 }

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_argument Thrown if *this and congruence c are dimension-incompatible.

Definition at line 783 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().

00783                                                                  {
00784   const Pointset_Powerset& x = *this;
00785 
00786   /* *this is included in cg if every disjunct is included in cg */
00787   bool is_included = true;
00788   /* *this is disjoint with cg if every disjunct is disjoint with cg */
00789   bool is_disjoint = true;
00790   /* *this strictly_intersects with cg if some disjunct strictly
00791      intersects with cg */
00792   bool is_strictly_intersecting = false;
00793   /* *this saturates cg if some disjunct saturates cg and
00794      every disjunct is either disjoint from cg or saturates cg */
00795   bool saturates_once = false;
00796   bool may_saturate = true;
00797   for (Sequence_const_iterator si = x.sequence.begin(),
00798          s_end = x.sequence.end(); si != s_end; ++si) {
00799     Poly_Con_Relation relation_i = si->pointset().relation_with(cg);
00800     if (!relation_i.implies(Poly_Con_Relation::is_included()))
00801       is_included = false;
00802     if (!relation_i.implies(Poly_Con_Relation::is_disjoint()))
00803       is_disjoint = false;
00804     if (relation_i.implies(Poly_Con_Relation::strictly_intersects()))
00805       is_strictly_intersecting = true;
00806     if (relation_i.implies(Poly_Con_Relation::saturates()))
00807       saturates_once = true;
00808     else if (!relation_i.implies(Poly_Con_Relation::is_disjoint()))
00809       may_saturate = false;
00810   }
00811 
00812   Poly_Con_Relation result = Poly_Con_Relation::nothing();
00813   if (is_included)
00814     result = result && Poly_Con_Relation::is_included();
00815   if (is_disjoint)
00816     result = result && Poly_Con_Relation::is_disjoint();
00817   if (is_strictly_intersecting)
00818     result = result && Poly_Con_Relation::strictly_intersects();
00819   if (saturates_once && may_saturate)
00820     result = result && Poly_Con_Relation::saturates();
00821 
00822   return result;
00823 }

template<typename PSET >
Poly_Gen_Relation Parma_Polyhedra_Library::Pointset_Powerset< PSET >::relation_with ( const Generator g  )  const [inline]

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

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

Definition at line 871 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().

00871                                                                {
00872   const Pointset_Powerset& x = *this;
00873 
00874   for (Sequence_const_iterator si = x.sequence.begin(),
00875          s_end = x.sequence.end(); si != s_end; ++si) {
00876     Poly_Gen_Relation relation_i = si->pointset().relation_with(g);
00877     if (relation_i.implies(Poly_Gen_Relation::subsumes()))
00878       return Poly_Gen_Relation::subsumes();
00879   }
00880 
00881   return Poly_Gen_Relation::nothing();
00882 }

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_argument Thrown if *this and constraint c are dimension-incompatible.

Definition at line 827 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().

00827                                                                 {
00828   const Pointset_Powerset& x = *this;
00829 
00830   /* *this is included in c if every disjunct is included in c */
00831   bool is_included = true;
00832   /* *this is disjoint with c if every disjunct is disjoint with c */
00833   bool is_disjoint = true;
00834   /* *this strictly_intersects with c if some disjunct strictly
00835      intersects with c */
00836   bool is_strictly_intersecting = false;
00837   /* *this saturates c if some disjunct saturates c and
00838      every disjunct is either disjoint from c or saturates c */
00839   bool saturates_once = false;
00840   bool may_saturate = true;
00841   for (Sequence_const_iterator si = x.sequence.begin(),
00842          s_end = x.sequence.end(); si != s_end; ++si) {
00843     Poly_Con_Relation relation_i = si->pointset().relation_with(c);
00844     if (!relation_i.implies(Poly_Con_Relation::is_included()))
00845       is_included = false;
00846     if (!relation_i.implies(Poly_Con_Relation::is_disjoint()))
00847       is_disjoint = false;
00848     if (relation_i.implies(Poly_Con_Relation::strictly_intersects()))
00849       is_strictly_intersecting = true;
00850     if (relation_i.implies(Poly_Con_Relation::saturates()))
00851       saturates_once = true;
00852     else if (!relation_i.implies(Poly_Con_Relation::is_disjoint()))
00853       may_saturate = false;
00854   }
00855 
00856   Poly_Con_Relation result = Poly_Con_Relation::nothing();
00857   if (is_included)
00858     result = result && Poly_Con_Relation::is_included();
00859   if (is_disjoint)
00860     result = result && Poly_Con_Relation::is_disjoint();
00861   if (is_strictly_intersecting)
00862     result = result && Poly_Con_Relation::strictly_intersects();
00863   if (saturates_once && may_saturate)
00864     result = result && Poly_Con_Relation::saturates();
00865 
00866   return result;
00867 }

template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::remove_higher_space_dimensions ( dimension_type  new_dimension  )  [inline]

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

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

Definition at line 291 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.

00291                                                              {
00292   Pointset_Powerset& x = *this;
00293   if (new_dimension < x.space_dim) {
00294     for (Sequence_iterator si = x.sequence.begin(),
00295            s_end = x.sequence.end(); si != s_end; ++si) {
00296       si->pointset().remove_higher_space_dimensions(new_dimension);
00297       x.reduced = false;
00298     }
00299     x.space_dim = new_dimension;
00300     PPL_ASSERT_HEAVY(x.OK());
00301   }
00302 }

template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::remove_space_dimensions ( const Variables_Set vars  )  [inline]

Removes all the specified space dimensions.

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

Definition at line 274 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.

00274                                                                           {
00275   Pointset_Powerset& x = *this;
00276   Variables_Set::size_type num_removed = vars.size();
00277   if (num_removed > 0) {
00278     for (Sequence_iterator si = x.sequence.begin(),
00279            s_end = x.sequence.end(); si != s_end; ++si) {
00280       si->pointset().remove_space_dimensions(vars);
00281       x.reduced = false;
00282     }
00283     x.space_dim -= num_removed;
00284     PPL_ASSERT_HEAVY(x.OK());
00285   }
00286 }

template<typename PSET >
bool Parma_Polyhedra_Library::Pointset_Powerset< PSET >::simplify_using_context_assign ( const Pointset_Powerset< PSET > &  y  )  [inline]

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_argument Thrown if *this and y are topology-incompatible or dimension-incompatible.

Definition at line 689 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().

00689                                                           {
00690   Pointset_Powerset& x = *this;
00691 
00692   // Omega reduction is required.
00693   // TODO: check whether it would be more efficient to Omega-reduce x
00694   // during the simplification process: when examining *si, we check
00695   // if it has been made redundant by any of the elements preceding it
00696   // (which have been already simplified).
00697   x.omega_reduce();
00698   if (x.is_empty())
00699     return false;
00700   y.omega_reduce();
00701   if (y.is_empty()) {
00702     x = y;
00703     return false;
00704   }
00705 
00706   if (y.size() == 1) {
00707     // More efficient, special handling of the singleton context case.
00708     const PSET& y_i = y.sequence.begin()->pointset();
00709     for (Sequence_iterator si = x.sequence.begin(),
00710            s_end = x.sequence.end(); si != s_end; ) {
00711       PSET& x_i = si->pointset();
00712       if (x_i.simplify_using_context_assign(y_i))
00713         ++si;
00714       else
00715         // Intersection is empty: drop the disjunct.
00716         si = x.sequence.erase(si);
00717     }
00718   }
00719   else {
00720     // The context is not a singleton.
00721     for (Sequence_iterator si = x.sequence.begin(),
00722            s_end = x.sequence.end(); si != s_end; ) {
00723       if (y.intersection_preserving_enlarge_element(si->pointset()))
00724         ++si;
00725       else
00726         // Intersection with `*si' is empty: drop the disjunct.
00727         si = x.sequence.erase(si);
00728     }
00729   }
00730   x.reduced = false;
00731   PPL_ASSERT_HEAVY(x.OK());
00732   return !x.sequence.empty();
00733 }

template<typename PSET >
dimension_type Parma_Polyhedra_Library::Pointset_Powerset< PSET >::space_dimension (  )  const [inline]
template<typename PSET >
bool Parma_Polyhedra_Library::Pointset_Powerset< PSET >::strictly_contains ( const Pointset_Powerset< PSET > &  y  )  const [inline]

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

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

Definition at line 758 of file Pointset_Powerset.templates.hh.

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

00758                                                                            {
00759   /* omega reduction ensures that a disjunct of y cannot be strictly
00760      contained in one disjunct and also contained but not strictly
00761      contained in another disjunct of *this */
00762   const Pointset_Powerset& x = *this;
00763   x.omega_reduce();
00764   for (Sequence_const_iterator si = y.sequence.begin(),
00765          ys_end = y.sequence.end(); si != ys_end; ++si) {
00766     const PSET& pi = si->pointset();
00767     bool pi_is_strictly_contained = false;
00768     for (Sequence_const_iterator sj = x.sequence.begin(),
00769            xs_end = x.sequence.end();
00770          (sj != xs_end && !pi_is_strictly_contained); ++sj) {
00771       const PSET& pj = sj->pointset();
00772       if (pj.strictly_contains(pi))
00773         pi_is_strictly_contained = true;
00774     }
00775     if (!pi_is_strictly_contained)
00776       return false;
00777   }
00778   return true;
00779 }

template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::swap ( Pointset_Powerset< PSET > &  y  )  [inline]
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 219 of file Pointset_Powerset.inlines.hh.

References Parma_Polyhedra_Library::Determinate< PSET >::lift_op_assign(), and Parma_Polyhedra_Library::Powerset< D >::pairwise_apply_assign().

00219                                                                       {
00220   Pointset_Powerset& x = *this;
00221   x.pairwise_apply_assign
00222     (y,
00223      Det_PSET::lift_op_assign(std::mem_fun_ref(&PSET::time_elapse_assign)));
00224 }

template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::topological_closure_assign (  )  [inline]

Assigns to *this its topological closure.

Definition at line 654 of file Pointset_Powerset.templates.hh.

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

00654                                                     {
00655   Pointset_Powerset& x = *this;
00656   for (Sequence_iterator si = x.sequence.begin(),
00657          s_end = x.sequence.end(); si != s_end; ++si)
00658     si->pointset().topological_closure_assign();
00659   PPL_ASSERT_HEAVY(x.OK());
00660 }

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.

Reimplemented from Parma_Polyhedra_Library::Powerset< Parma_Polyhedra_Library::Determinate< PSET > >.

Definition at line 270 of file Pointset_Powerset.inlines.hh.

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

00270                                                      {
00271   return sizeof(*this) + external_memory_in_bytes();
00272 }

template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::unconstrain ( const Variables_Set vars  )  [inline]

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

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

Definition at line 240 of file Pointset_Powerset.templates.hh.

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

00240                                                               {
00241   Pointset_Powerset& x = *this;
00242   for (Sequence_iterator si = x.sequence.begin(),
00243          s_end = x.sequence.end(); si != s_end; ++si) {
00244     si->pointset().unconstrain(vars);
00245     x.reduced = false;
00246   }
00247   PPL_ASSERT_HEAVY(x.OK());
00248 }

template<typename PSET >
void Parma_Polyhedra_Library::Pointset_Powerset< PSET >::unconstrain ( Variable  var  )  [inline]

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

Parameters:
var The space dimension that will be unconstrained.
Exceptions:
std::invalid_argument Thrown if var is not a space dimension of *this.

Definition at line 228 of file Pointset_Powerset.templates.hh.

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

00228                                                        {
00229   Pointset_Powerset& x = *this;
00230   for (Sequence_iterator si = x.sequence.begin(),
00231          s_end = x.sequence.end(); si != s_end; ++si) {
00232     si->pointset().unconstrain(var);
00233     x.reduced = false;
00234   }
00235   PPL_ASSERT_HEAVY(x.OK());
00236 }

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 pcs = 0,
unsigned  complexity_threshold = 16,
bool  wrap_individually = true 
) [inline]

Wraps the specified dimensions of the vector space.

Parameters:
vars The set of Variable objects corresponding to the space dimensions to be wrapped.
w The width of the bounded integer type corresponding to all the dimensions to be wrapped.
r The representation of the bounded integer type corresponding to all the dimensions to be wrapped.
o The overflow behavior of the bounded integer type corresponding to all the dimensions to be wrapped.
pcs Possibly null pointer to a constraint system whose variables are contained in vars. If *pcs 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 *pcs.
complexity_threshold A precision parameter of the wrapping operator: higher values result in possibly improved precision.
wrap_individually true if the dimensions should be wrapped individually (something that results in much greater efficiency to the detriment of precision).
Exceptions:
std::invalid_argument Thrown if *pcs is dimension-incompatible with vars, or if *this is dimension-incompatible vars or with *pcs.

Definition at line 1159 of file Pointset_Powerset.templates.hh.

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

01165                                                              {
01166   Pointset_Powerset& x = *this;
01167   for (Sequence_iterator si = x.sequence.begin(),
01168          s_end = x.sequence.end(); si != s_end; ++si)
01169     si->pointset().wrap_assign(vars, w, r, o, pcs,
01170                                complexity_threshold, wrap_individually);
01171   x.reduced = false;
01172   PPL_ASSERT_HEAVY(x.OK());
01173 }


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]

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 wrt 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.

Definition at line 182 of file Pointset_Powerset.cc.

References Parma_Polyhedra_Library::Pointset_Powerset< PSET >::approximate_partition_aux(), 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().

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

00183                                                    {
00184   using namespace PPL;
00185   finite_partition = true;
00186   Pointset_Powerset<Grid> r(p.space_dimension(), EMPTY);
00187   // Ensure that the congruence system of q is minimized
00188   // before copying and calling approximate_partition_aux().
00189   (void) q.minimized_congruences();
00190   Grid qq = q;
00191   const Congruence_System& pcs = p.congruences();
00192   for (Congruence_System::const_iterator i = pcs.begin(),
00193          pcs_end = pcs.end(); i != pcs_end; ++i)
00194     if (!approximate_partition_aux(*i, qq, r)) {
00195       finite_partition = false;
00196       Pointset_Powerset<Grid> s(q);
00197       return std::make_pair(qq, s);
00198     }
00199   return std::make_pair(qq, r);
00200 }

template<typename PSET>
bool approximate_partition_aux ( const PPL::Congruence c,
PPL::Grid qq,
PPL::Pointset_Powerset< PPL::Grid > &  r 
) [related]

Uses the congruence c to approximately partition the grid qq.

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

Definition at line 124 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::inhomogeneous_term(), Parma_Polyhedra_Library::Grid::is_empty(), Parma_Polyhedra_Library::Checked::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().

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

00126                                                             {
00127   using namespace PPL;
00128   const Coefficient& c_modulus = c.modulus();
00129   Grid qq_copy(qq);
00130   qq.add_congruence(c);
00131   if (qq.is_empty()) {
00132     r.add_disjunct(qq_copy);
00133     return true;
00134   }
00135 
00136   Congruence_System cgs = qq.congruences();
00137   Congruence_System cgs_copy = qq_copy.congruences();
00138   // When c is an equality, not satisfied by Grid qq
00139   // then add qq to the set r. There is no finite
00140   // partition in this case.
00141   if (c_modulus == 0) {
00142     if (cgs.num_equalities() != cgs_copy.num_equalities()) {
00143       r.add_disjunct(qq_copy);
00144       return false;
00145     }
00146     return true;
00147   }
00148 
00149   // When c is a proper congruence but, in qq, this direction has
00150   // no congruence, then add qq to the set r. There is no finite
00151   // partition in this case.
00152   if (cgs.num_proper_congruences() != cgs_copy.num_proper_congruences()) {
00153     r.add_disjunct(qq_copy);
00154     return false;
00155   }
00156 
00157   // When  c is a proper congruence and qq also is discrete
00158   // in this direction, then there is a finite partition and that
00159   // is added to r.
00160   const Coefficient& c_inhomogeneous_term = c.inhomogeneous_term();
00161   Linear_Expression le(c);
00162   le -= c_inhomogeneous_term;
00163   PPL_DIRTY_TEMP_COEFFICIENT(n);
00164   rem_assign(n, c_inhomogeneous_term, c_modulus);
00165   if (n < 0)
00166     n += c_modulus;
00167   PPL_DIRTY_TEMP_COEFFICIENT(i);
00168   for (i = c_modulus; i-- > 0; )
00169     if (i != n) {
00170       Grid qqq(qq_copy);
00171       qqq.add_congruence((le+i %= 0) / c_modulus);
00172       if (!qqq.is_empty())
00173         r.add_disjunct(qqq);
00174     }
00175   return true;
00176 }

bool check_containment ( const C_Polyhedron ph,
const Pointset_Powerset< C_Polyhedron > &  ps 
) [related]

Definition at line 304 of file Pointset_Powerset.inlines.hh.

00305                                                              {
00306   return check_containment(NNC_Polyhedron(ph),
00307                            Pointset_Powerset<NNC_Polyhedron>(ps));
00308 }

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.

Definition at line 294 of file Pointset_Powerset.inlines.hh.

00294                                                                      {
00295   // This code is only used when PSET is an abstraction of NNC_Polyhedron.
00296   const NNC_Polyhedron pph = NNC_Polyhedron(ph.constraints());
00297   const Pointset_Powerset<NNC_Polyhedron> pps(ps);
00298   return check_containment(pph, pps);
00299 }

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.

Definition at line 204 of file Pointset_Powerset.cc.

References Parma_Polyhedra_Library::Pointset_Powerset< PSET >::approximate_partition(), 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().

00205                                                           {
00206   if (ph.is_empty())
00207     return true;
00208   Pointset_Powerset<Grid> tmp(ph.space_dimension(), EMPTY);
00209   tmp.add_disjunct(ph);
00210   for (Pointset_Powerset<Grid>::const_iterator
00211          i = ps.begin(), ps_end = ps.end(); i != ps_end; ++i) {
00212     const Grid& pi = i->pointset();
00213     for (Pointset_Powerset<Grid>::iterator
00214            j = tmp.begin(); j != tmp.end(); ) {
00215       const Grid& pj = j->pointset();
00216       if (pi.contains(pj))
00217         j = tmp.drop_disjunct(j);
00218       else
00219         ++j;
00220     }
00221     if (tmp.empty())
00222       return true;
00223     else {
00224       Pointset_Powerset<Grid> new_disjuncts(ph.space_dimension(),
00225                                                       EMPTY);
00226       for (Pointset_Powerset<Grid>::iterator
00227              j = tmp.begin(); j != tmp.end(); ) {
00228         const Grid& pj = j->pointset();
00229         if (pj.is_disjoint_from(pi))
00230           ++j;
00231         else {
00232           bool finite_partition;
00233           std::pair<Grid, Pointset_Powerset<Grid> >
00234             partition = approximate_partition(pi, pj, finite_partition);
00235 
00236           // If there is a finite partition, then we add the new
00237           // disjuncts to the temporary set of disjuncts and drop pj.
00238           // If there is no finite partition, then by the
00239           // specification of approximate_partition(), we can
00240           // ignore checking the remaining temporary disjuncts as they
00241           // will all have the same lines and equalities and therefore
00242           // also not have a finite partition wrt pi.
00243           if (!finite_partition)
00244             break;
00245           new_disjuncts.upper_bound_assign(partition.second);
00246           j = tmp.drop_disjunct(j);
00247         }
00248       }
00249       tmp.upper_bound_assign(new_disjuncts);
00250     }
00251   }
00252   return false;
00253 }

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.

Definition at line 71 of file Pointset_Powerset.cc.

References 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().

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

00072                                                                     {
00073   if (ph.is_empty())
00074     return true;
00075   Pointset_Powerset<NNC_Polyhedron> tmp(ph.space_dimension(), EMPTY);
00076   tmp.add_disjunct(ph);
00077   for (Pointset_Powerset<NNC_Polyhedron>::const_iterator
00078          i = ps.begin(), ps_end = ps.end(); i != ps_end; ++i) {
00079     const NNC_Polyhedron& pi = i->pointset();
00080     for (Pointset_Powerset<NNC_Polyhedron>::iterator
00081            j = tmp.begin(); j != tmp.end(); ) {
00082       const NNC_Polyhedron& pj = j->pointset();
00083       if (pi.contains(pj))
00084         j = tmp.drop_disjunct(j);
00085       else
00086         ++j;
00087     }
00088     if (tmp.empty())
00089       return true;
00090     else {
00091       Pointset_Powerset<NNC_Polyhedron> new_disjuncts(ph.space_dimension(),
00092                                                       EMPTY);
00093       for (Pointset_Powerset<NNC_Polyhedron>::iterator
00094              j = tmp.begin(); j != tmp.end(); ) {
00095         const NNC_Polyhedron& pj = j->pointset();
00096         if (pj.is_disjoint_from(pi))
00097           ++j;
00098         else {
00099           std::pair<NNC_Polyhedron, Pointset_Powerset<NNC_Polyhedron> >
00100             partition = linear_partition(pi, pj);
00101           new_disjuncts.upper_bound_assign(partition.second);
00102           j = tmp.drop_disjunct(j);
00103         }
00104       }
00105       tmp.upper_bound_assign(new_disjuncts);
00106     }
00107   }
00108   return false;
00109 }

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.

Definition at line 1578 of file Pointset_Powerset.templates.hh.

References Parma_Polyhedra_Library::Constraint_System::begin(), Parma_Polyhedra_Library::EMPTY, Parma_Polyhedra_Library::Constraint_System::end(), Parma_Polyhedra_Library::Constraint::is_equality(), and Parma_Polyhedra_Library::Checked::le.

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

01578                                                {
01579   using Implementation::Pointset_Powersets::linear_partition_aux;
01580 
01581   Pointset_Powerset<NNC_Polyhedron> r(p.space_dimension(), EMPTY);
01582   PSET qq = q;
01583   const Constraint_System& pcs = p.constraints();
01584   for (Constraint_System::const_iterator i = pcs.begin(),
01585          pcs_end = pcs.end(); i != pcs_end; ++i) {
01586     const Constraint& c = *i;
01587     if (c.is_equality()) {
01588       Linear_Expression le(c);
01589       linear_partition_aux(le <= 0, qq, r);
01590       linear_partition_aux(le >= 0, qq, r);
01591     }
01592     else
01593       linear_partition_aux(c, qq, r);
01594   }
01595   return std::make_pair(qq, r);
01596 }

template<typename PSET >
void linear_partition_aux ( const Constraint c,
PSET &  qq,
Pointset_Powerset< NNC_Polyhedron > &  r 
) [related]

Partitions polyhedron qq according to constraint c.

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

Definition at line 1558 of file Pointset_Powerset.templates.hh.

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

01560                                                            {
01561   Linear_Expression le(c);
01562   const Constraint& neg_c = c.is_strict_inequality() ? (le <= 0) : (le < 0);
01563   NNC_Polyhedron qqq(qq);
01564   qqq.add_constraint(neg_c);
01565   if (!qqq.is_empty())
01566     r.add_disjunct(qqq);
01567   qq.add_constraint(c);
01568 }

template<typename PSET>
friend class Pointset_Powerset< NNC_Polyhedron > [friend]

Definition at line 1302 of file Pointset_Powerset.defs.hh.

template<typename PSET >
void swap ( Parma_Polyhedra_Library::Pointset_Powerset< PSET > &  x,
Parma_Polyhedra_Library::Pointset_Powerset< PSET > &  y 
) [related]

Specializes std::swap.

Definition at line 318 of file Pointset_Powerset.inlines.hh.

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

00319                                                         {
00320   x.swap(y);
00321 }

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:
lwm The limited widening method.
cs The constraint system limiting the widening.

Definition at line 67 of file Widening_Function.inlines.hh.

00068                               {
00069   return Limited_Widening_Function<PSET, CSYS>(lwm, cs);
00070 }

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:
wm The widening method.

Definition at line 60 of file Widening_Function.inlines.hh.

00060                                                        {
00061   return Widening_Function<PSET>(wm);
00062 }


Member Data Documentation

template<typename PSET>
dimension_type Parma_Polyhedra_Library::Pointset_Powerset< PSET >::space_dim [private]

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