PPL  1.2
Pointset_Ask_Tell_defs.hh
Go to the documentation of this file.
1 /* Pointset_Ask_Tell class declaration.
2  Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it>
3  Copyright (C) 2010-2016 BUGSENG srl (http://bugseng.com)
4 
5 This file is part of the Parma Polyhedra Library (PPL).
6 
7 The PPL is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 The PPL is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software Foundation,
19 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA.
20 
21 For the most up-to-date information see the Parma Polyhedra Library
22 site: http://bugseng.com/products/ppl/ . */
23 
24 #ifndef PPL_Pointset_Ask_Tell_defs_hh
25 #define PPL_Pointset_Ask_Tell_defs_hh
26 
28 #include "globals_defs.hh"
30 #include "Constraint_types.hh"
32 #include "Congruence_types.hh"
34 #include "C_Polyhedron_defs.hh"
35 #include "NNC_Polyhedron_defs.hh"
36 #include "Variables_Set_types.hh"
37 #include "Determinate_defs.hh"
38 #include "Ask_Tell_defs.hh"
39 #include <iosfwd>
40 #include <list>
41 #include <map>
42 
44 
45 template <typename PSET>
48 <Parma_Polyhedra_Library::Determinate<PSET> > {
49 public:
50  typedef PSET element_type;
51 
52 private:
55  typedef typename Base::Pair Pair;
56 
57 public:
60 
62 
63 
65 
72  explicit
73  Pointset_Ask_Tell(dimension_type num_dimensions = 0,
75 
78 
83  explicit Pointset_Ask_Tell(const PSET& ph);
84 
89  template <typename QH>
90  explicit Pointset_Ask_Tell(const Pointset_Ask_Tell<QH>& y);
91 
96  explicit Pointset_Ask_Tell(const Constraint_System& cs);
97 
102  explicit Pointset_Ask_Tell(const Congruence_System& cgs);
103 
105 
107 
108 
111 
124  bool geometrically_covers(const Pointset_Ask_Tell& y) const;
125 
138  bool geometrically_equals(const Pointset_Ask_Tell& y) const;
139 
145 
151 
158  int32_t hash_code() const;
159 
161  bool OK() const;
162 
164 
166 
167 
169 
173  void add_disjunct(const PSET& ph);
174 
176 
181  void add_constraint(const Constraint& c);
182 
184 
192  void add_constraints(const Constraint_System& cs);
193 
202  void pairwise_reduce();
203 
214  void unconstrain(Variable var);
215 
228  void unconstrain(const Variables_Set& vars);
229 
231 
235  void intersection_assign(const Pointset_Ask_Tell& y);
236 
238 
245 
254  void time_elapse_assign(const Pointset_Ask_Tell& y);
255 
285  template <typename Widening>
287  Widening widen_fun,
288  unsigned max_disjuncts);
289 
319  template <typename Cert, typename Widening>
320  void BHZ03_widening_assign(const Pointset_Ask_Tell& y, Widening widen_fun);
321 
323 
325 
326 
332 
338  template <typename QH>
340 
342  void m_swap(Pointset_Ask_Tell& y);
343 
349 
355 
357 
362  void concatenate_assign(const Pointset_Ask_Tell& y);
363 
365 
374  void remove_space_dimensions(const Variables_Set& vars);
375 
385 
392  template <typename Partial_Function>
393  void map_space_dimensions(const Partial_Function& pfunc);
394 
396 
397 public:
398  typedef typename Base::size_type size_type;
399  typedef typename Base::value_type value_type;
400  typedef typename Base::iterator iterator;
404 
406 
412  bool ascii_load(std::istream& s);
413 
414 private:
415  typedef typename Base::Sequence Sequence;
418 
421 
426  template <typename Widening>
427  void BGP99_heuristics_assign(const Pointset_Ask_Tell& y, Widening widen_fun);
428 
430  template <typename Cert>
431  void collect_certificates(std::map<Cert, size_type,
432  typename Cert::Compare>& cert_ms) const;
433 
438  template <typename Cert>
439  bool is_cert_multiset_stabilizing(const std::map<Cert, size_type,
440  typename Cert::Compare>&
441  y_cert_ms) const;
442 
443  // FIXME: here it should be enough to befriend the template constructor
444  // template <typename QH>
445  // Pointset_Ask_Tell(const Pointset_Ask_Tell<QH>&),
446  // but, apparently, this cannot be done.
448 };
449 
450 
451 namespace Parma_Polyhedra_Library {
452 
454 
455 template <typename PSET>
457 
458 // CHECKME: according to the Intel compiler, the declaration of the
459 // following specialization (of the class template parameter) should come
460 // before the declaration of the corresponding full specialization
461 // (where the member template parameter is specialized too).
462 template <>
463 template <typename QH>
466 
467 // CHECKME: according to the Intel compiler, the declaration of the
468 // following specialization (of the class template parameter) should come
469 // before the declaration of the corresponding full specialization
470 // (where the member template parameter is specialized too).
471 template <>
472 template <typename QH>
475 
476 // Non-inline full specializations should be declared here
477 // so as to inhibit multiple instantiations of the generic template.
478 template <>
479 template <>
482 
483 template <>
484 template <>
487 
488 template <>
489 void
492 
493 template <>
494 bool
497 
498 } // namespace Parma_Polyhedra_Library
499 
502 
503 #endif // !defined(PPL_Pointset_Ask_Tell_defs_hh)
void time_elapse_assign(const Pointset_Ask_Tell &y)
Assigns to *this the result of computing the time-elapse between *this and y.
A linear equality or inequality.
void swap(CO_Tree &x, CO_Tree &y)
void BHZ03_widening_assign(const Pointset_Ask_Tell &y, Widening widen_fun)
Assigns to *this the result of computing the BHZ03-widening between *this and y, using the widening f...
size_t dimension_type
An unsigned integral type for representing 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...
dimension_type space_dimension() const
Returns the dimension of the vector space enclosing *this.
An std::set of variables' indexes.
Pointset_Ask_Tell(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe (top) or empty (bottom) Pointset_Ask_Tell.
void add_constraints(const Constraint_System &cs)
Intersects *this with the constraints in cs.
void intersection_assign(const Pointset_Ask_Tell &y)
Assigns to *this the intersection of *this and y.
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.
Sequence::iterator Sequence_iterator
Alias for the low-level iterator on the pairs.
A wrapper for PPL pointsets, providing them with a determinate constraint system interface, as defined in [Bag98].
void unconstrain(Variable var)
Computes the cylindrification of *this with respect to space dimension var, assigning the result to *...
std::reverse_iterator< iterator > reverse_iterator
The reverse iterator type built from Powerset::iterator.
void remove_space_dimensions(const Variables_Set &vars)
Removes all the specified space dimensions.
A dimension of the vector space.
void add_space_dimensions_and_embed(dimension_type m)
Adds m new dimensions to the vector space containing *this and embeds each polyhedron in *this in the...
bool geometrically_covers(const Pointset_Ask_Tell &y) const
Returns true if and only if *this geometrically covers y, i.e., if any point (in some element) of y i...
std::reverse_iterator< const_iterator > const_reverse_iterator
The reverse iterator type built from Powerset::const_iterator.
void BGP99_extrapolation_assign(const Pointset_Ask_Tell &y, Widening widen_fun, unsigned max_disjuncts)
Assigns to *this the result of applying the BGP99 extrapolation operator to *this and y...
#define PPL_OUTPUT_DECLARATIONS
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 polyhedra is stabilizing with respect to the multiset ...
void add_disjunct(const PSET &ph)
Adds to *this the disjunct ph.
static dimension_type max_space_dimension()
Returns the maximum space dimension a Pointset_Ask_Tell can handle.
std::list< Ask_Tell_Pair< D > > Sequence
An ask-tell agent is implemented as a sequence of ask-tell pairs.
bool ascii_load(std::istream &s)
Loads from s an ASCII representation (as produced by ascii_dump(std::ostream&) const) and sets *this ...
Degenerate_Element
Kinds of degenerate abstract elements.
The ask-and-tell construction instantiated on PPL polyhedra.
void concatenate_assign(const Pointset_Ask_Tell &y)
Assigns to *this the concatenation of *this and y.
A not necessarily closed convex polyhedron.
void map_space_dimensions(const Partial_Function &pfunc)
Remaps the dimensions of the vector space according to a partial function.
bool OK() const
Checks if all the invariants are satisfied.
void pairwise_reduce()
Assign to *this the result of (recursively) merging together the pairs of polyhedra whose poly-hull i...
dimension_type space_dim
The number of dimensions of the enclosing vector space.
The universe element, i.e., the whole vector space.
Base::Sequence_const_iterator Sequence_const_iterator
void m_swap(Pointset_Ask_Tell &y)
Swaps *this with y.
A const_iterator on a sequence of read-only objects.
void add_constraint(const Constraint &c)
Intersects *this with constraint c.
The entire library is confined to this namespace.
Definition: version.hh:61
void BGP99_heuristics_assign(const Pointset_Ask_Tell &y, Widening widen_fun)
Assigns to *this the result of applying the BGP99 heuristics to *this and y, using the widening funct...
Sequence::const_iterator Sequence_const_iterator
Alias for the low-level const_iterator on the pairs.
Pointset_Ask_Tell & operator=(const Pointset_Ask_Tell &y)
The assignment operator (*this and y can be dimension-incompatible).
void add_space_dimensions_and_project(dimension_type m)
Adds m new dimensions to the vector space containing *this without embedding the polyhedra in *this i...
void collect_certificates(std::map< Cert, size_type, typename Cert::Compare > &cert_ms) const
Records in cert_ms the certificates for this set of polyhedra.
int32_t hash_code() const
Returns a 32-bit hash code for *this.
A pair of ask and tell descriptions.
An iterator on a sequence of read-only objects.
size_t memory_size_type
An unsigned integral type for representing memory size in bytes.
Coefficient c
Definition: PIP_Tree.cc:64
The ask and tell construction on a base-level domain.
bool geometrically_equals(const Pointset_Ask_Tell &y) const
Returns true if and only if *this is geometrically equal to y, i.e., if (the elements of) *this and y...
void poly_difference_assign(const Pointset_Ask_Tell &y)
Assigns to *this the difference of *this and y.