PPL  1.2
BD_Shape_defs.hh
Go to the documentation of this file.
1 /* BD_Shape 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_BD_Shape_defs_hh
25 #define PPL_BD_Shape_defs_hh 1
26 
27 #include "BD_Shape_types.hh"
28 #include "globals_defs.hh"
29 #include "Constraint_types.hh"
30 #include "Generator_types.hh"
31 #include "Congruence_types.hh"
38 #include "Polyhedron_types.hh"
39 #include "Box_types.hh"
40 #include "Grid_types.hh"
41 #include "Octagonal_Shape_types.hh"
42 #include "Variable_defs.hh"
43 #include "Variables_Set_types.hh"
44 #include "DB_Matrix_defs.hh"
45 #include "DB_Row_defs.hh"
46 #include "Checked_Number_defs.hh"
48 #include "Bit_Matrix_defs.hh"
49 #include "Coefficient_defs.hh"
50 #include "Interval_types.hh"
52 #include <cstddef>
53 #include <iosfwd>
54 #include <vector>
55 
56 namespace Parma_Polyhedra_Library {
57 
58 namespace IO_Operators {
59 
61 
68 template <typename T>
69 std::ostream&
70 operator<<(std::ostream& s, const BD_Shape<T>& bds);
71 
72 } // namespace IO_Operators
73 
75 
76 template <typename T>
77 void swap(BD_Shape<T>& x, BD_Shape<T>& y);
78 
80 
84 template <typename T>
85 bool operator==(const BD_Shape<T>& x, const BD_Shape<T>& y);
86 
88 
92 template <typename T>
93 bool operator!=(const BD_Shape<T>& x, const BD_Shape<T>& y);
94 
96 
106 template <typename To, typename T>
107 bool rectilinear_distance_assign(Checked_Number<To, Extended_Number_Policy>& r,
108  const BD_Shape<T>& x,
109  const BD_Shape<T>& y,
110  Rounding_Dir dir);
111 
113 
123 template <typename Temp, typename To, typename T>
124 bool rectilinear_distance_assign(Checked_Number<To, Extended_Number_Policy>& r,
125  const BD_Shape<T>& x,
126  const BD_Shape<T>& y,
127  Rounding_Dir dir);
128 
130 
140 template <typename Temp, typename To, typename T>
141 bool rectilinear_distance_assign(Checked_Number<To, Extended_Number_Policy>& r,
142  const BD_Shape<T>& x,
143  const BD_Shape<T>& y,
144  Rounding_Dir dir,
145  Temp& tmp0,
146  Temp& tmp1,
147  Temp& tmp2);
148 
150 
160 template <typename To, typename T>
161 bool euclidean_distance_assign(Checked_Number<To, Extended_Number_Policy>& r,
162  const BD_Shape<T>& x,
163  const BD_Shape<T>& y,
164  Rounding_Dir dir);
165 
167 
177 template <typename Temp, typename To, typename T>
178 bool euclidean_distance_assign(Checked_Number<To, Extended_Number_Policy>& r,
179  const BD_Shape<T>& x,
180  const BD_Shape<T>& y,
181  Rounding_Dir dir);
182 
184 
194 template <typename Temp, typename To, typename T>
195 bool euclidean_distance_assign(Checked_Number<To, Extended_Number_Policy>& r,
196  const BD_Shape<T>& x,
197  const BD_Shape<T>& y,
198  Rounding_Dir dir,
199  Temp& tmp0,
200  Temp& tmp1,
201  Temp& tmp2);
202 
204 
214 template <typename To, typename T>
215 bool l_infinity_distance_assign(Checked_Number<To, Extended_Number_Policy>& r,
216  const BD_Shape<T>& x,
217  const BD_Shape<T>& y,
218  Rounding_Dir dir);
219 
221 
231 template <typename Temp, typename To, typename T>
232 bool l_infinity_distance_assign(Checked_Number<To, Extended_Number_Policy>& r,
233  const BD_Shape<T>& x,
234  const BD_Shape<T>& y,
235  Rounding_Dir dir);
236 
238 
248 template <typename Temp, typename To, typename T>
249 bool l_infinity_distance_assign(Checked_Number<To, Extended_Number_Policy>& r,
250  const BD_Shape<T>& x,
251  const BD_Shape<T>& y,
252  Rounding_Dir dir,
253  Temp& tmp0,
254  Temp& tmp1,
255  Temp& tmp2);
256 
257 // This class contains some helper functions that need to be friends of
258 // Linear_Expression.
260 public:
261  #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
262 
293  #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
294  static bool extract_bounded_difference(const Constraint& c,
295  dimension_type& c_num_vars,
296  dimension_type& c_first_var,
297  dimension_type& c_second_var,
298  Coefficient& c_coeff);
299 };
300 
301 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
302 
304 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
305 void compute_leader_indices(const std::vector<dimension_type>& predecessor,
306  std::vector<dimension_type>& indices);
307 
308 } // namespace Parma_Polyhedra_Library
309 
311 
411 template <typename T>
413 private:
418 #ifndef NDEBUG
420 #else
422 #endif
423 
424 public:
427 
432  typedef N coefficient_type;
433 
436 
440  static bool can_recycle_constraint_systems();
441 
445  static bool can_recycle_congruence_systems();
446 
448 
449 
451 
458  explicit BD_Shape(dimension_type num_dimensions = 0,
460 
462 
465  BD_Shape(const BD_Shape& y,
466  Complexity_Class complexity = ANY_COMPLEXITY);
467 
469 
472  template <typename U>
473  explicit BD_Shape(const BD_Shape<U>& y,
474  Complexity_Class complexity = ANY_COMPLEXITY);
475 
477 
487  explicit BD_Shape(const Constraint_System& cs);
488 
490 
500  explicit BD_Shape(const Congruence_System& cgs);
501 
503 
510  explicit BD_Shape(const Generator_System& gs);
511 
513 
519  explicit BD_Shape(const Polyhedron& ph,
520  Complexity_Class complexity = ANY_COMPLEXITY);
521 
523 
538  template <typename Interval>
539  explicit BD_Shape(const Box<Interval>& box,
540  Complexity_Class complexity = ANY_COMPLEXITY);
541 
543 
558  explicit BD_Shape(const Grid& grid,
559  Complexity_Class complexity = ANY_COMPLEXITY);
560 
562 
577  template <typename U>
578  explicit BD_Shape(const Octagonal_Shape<U>& os,
579  Complexity_Class complexity = ANY_COMPLEXITY);
580 
585  BD_Shape& operator=(const BD_Shape& y);
586 
591  void m_swap(BD_Shape& y);
592 
594  ~BD_Shape();
595 
597 
599 
600 
603 
610 
613 
616 
619 
625 
633  bool bounds_from_above(const Linear_Expression& expr) const;
634 
642  bool bounds_from_below(const Linear_Expression& expr) const;
643 
668  bool maximize(const Linear_Expression& expr,
669  Coefficient& sup_n, Coefficient& sup_d, bool& maximum) const;
670 
699  bool maximize(const Linear_Expression& expr,
700  Coefficient& sup_n, Coefficient& sup_d, bool& maximum,
701  Generator& g) const;
702 
727  bool minimize(const Linear_Expression& expr,
728  Coefficient& inf_n, Coefficient& inf_d, bool& minimum) const;
729 
758  bool minimize(const Linear_Expression& expr,
759  Coefficient& inf_n, Coefficient& inf_d, bool& minimum,
760  Generator& g) const;
761 
790  bool frequency(const Linear_Expression& expr,
791  Coefficient& freq_n, Coefficient& freq_d,
792  Coefficient& val_n, Coefficient& val_d) const;
793 
795 
799  bool contains(const BD_Shape& y) const;
800 
802 
806  bool strictly_contains(const BD_Shape& y) const;
807 
809 
814  bool is_disjoint_from(const BD_Shape& y) const;
815 
817 
822 
824 
828  Poly_Con_Relation relation_with(const Congruence& cg) const;
829 
831 
835  Poly_Gen_Relation relation_with(const Generator& g) const;
836 
838  bool is_empty() const;
839 
841  bool is_universe() const;
842 
844  bool is_discrete() const;
845 
850  bool is_topologically_closed() const;
851 
853  bool is_bounded() const;
854 
859  bool contains_integer_point() const;
860 
868  bool constrains(Variable var) const;
869 
874  bool OK() const;
875 
877 
879 
880 
892  void add_constraint(const Constraint& c);
893 
904  void add_congruence(const Congruence& cg);
905 
918  void add_constraints(const Constraint_System& cs);
919 
938 
951  void add_congruences(const Congruence_System& cgs);
952 
970 
981  void refine_with_constraint(const Constraint& c);
982 
994  void refine_with_congruence(const Congruence& cg);
995 
1008 
1020  void refine_with_congruences(const Congruence_System& cgs);
1021 
1043  template <typename Interval_Info>
1046  const Linear_Form<Interval<T, Interval_Info> >& right);
1047 
1076  template <typename Interval_Info>
1079  const Linear_Form<Interval<T, Interval_Info> >& right,
1080  Relation_Symbol relsym);
1081 
1083 
1112  template <typename U>
1113  void export_interval_constraints(U& dest) const;
1114 
1125  void unconstrain(Variable var);
1126 
1139  void unconstrain(const Variables_Set& vars);
1140 
1142 
1146  void intersection_assign(const BD_Shape& y);
1147 
1155  void upper_bound_assign(const BD_Shape& y);
1156 
1165  bool upper_bound_assign_if_exact(const BD_Shape& y);
1166 
1182 
1190  void difference_assign(const BD_Shape& y);
1191 
1201  bool simplify_using_context_assign(const BD_Shape& y);
1202 
1222  void affine_image(Variable var,
1223  const Linear_Expression& expr,
1224  Coefficient_traits::const_reference denominator
1225  = Coefficient_one());
1226 
1227  // FIXME: To be completed.
1244  template <typename Interval_Info>
1245  void affine_form_image(Variable var,
1247 
1267  void affine_preimage(Variable var,
1268  const Linear_Expression& expr,
1269  Coefficient_traits::const_reference denominator
1270  = Coefficient_one());
1271 
1297  Relation_Symbol relsym,
1298  const Linear_Expression& expr,
1299  Coefficient_traits::const_reference denominator
1300  = Coefficient_one());
1301 
1322  Relation_Symbol relsym,
1323  const Linear_Expression& rhs);
1324 
1350  Relation_Symbol relsym,
1351  const Linear_Expression& expr,
1352  Coefficient_traits::const_reference
1353  denominator = Coefficient_one());
1354 
1375  Relation_Symbol relsym,
1376  const Linear_Expression& rhs);
1377 
1404  void bounded_affine_image(Variable var,
1405  const Linear_Expression& lb_expr,
1406  const Linear_Expression& ub_expr,
1407  Coefficient_traits::const_reference denominator
1408  = Coefficient_one());
1409 
1437  const Linear_Expression& lb_expr,
1438  const Linear_Expression& ub_expr,
1439  Coefficient_traits::const_reference denominator
1440  = Coefficient_one());
1448  void time_elapse_assign(const BD_Shape& y);
1449 
1496  void wrap_assign(const Variables_Set& vars,
1500  const Constraint_System* cs_p = 0,
1501  unsigned complexity_threshold = 16,
1502  bool wrap_individually = true);
1503 
1516  = ANY_COMPLEXITY);
1517 
1534  Complexity_Class complexity
1535  = ANY_COMPLEXITY);
1536 
1539 
1555  void CC76_extrapolation_assign(const BD_Shape& y, unsigned* tp = 0);
1556 
1578  template <typename Iterator>
1579  void CC76_extrapolation_assign(const BD_Shape& y,
1580  Iterator first, Iterator last,
1581  unsigned* tp = 0);
1582 
1598  void BHMZ05_widening_assign(const BD_Shape& y, unsigned* tp = 0);
1599 
1621  const Constraint_System& cs,
1622  unsigned* tp = 0);
1623 
1643  void CC76_narrowing_assign(const BD_Shape& y);
1644 
1666  const Constraint_System& cs,
1667  unsigned* tp = 0);
1668 
1684  void H79_widening_assign(const BD_Shape& y, unsigned* tp = 0);
1685 
1687  void widening_assign(const BD_Shape& y, unsigned* tp = 0);
1688 
1709  const Constraint_System& cs,
1710  unsigned* tp = 0);
1711 
1713 
1715 
1716 
1718 
1736 
1759 
1768  void concatenate_assign(const BD_Shape& y);
1769 
1771 
1779  void remove_space_dimensions(const Variables_Set& vars);
1780 
1789  void remove_higher_space_dimensions(dimension_type new_dimension);
1790 
1828  template <typename Partial_Function>
1829  void map_space_dimensions(const Partial_Function& pfunc);
1830 
1832 
1853 
1855 
1877  void fold_space_dimensions(const Variables_Set& vars, Variable dest);
1878 
1880 
1884  template <typename Interval_Info>
1886  store) const;
1887 
1888 
1890 
1892 
1898  bool ascii_load(std::istream& s);
1899 
1902 
1905 
1912  int32_t hash_code() const;
1913 
1914  friend bool operator==<T>(const BD_Shape<T>& x, const BD_Shape<T>& y);
1915 
1916  template <typename Temp, typename To, typename U>
1917  friend bool Parma_Polyhedra_Library
1918  ::rectilinear_distance_assign(Checked_Number<To, Extended_Number_Policy>& r,
1919  const BD_Shape<U>& x, const BD_Shape<U>& y,
1920  const Rounding_Dir dir,
1921  Temp& tmp0, Temp& tmp1, Temp& tmp2);
1922  template <typename Temp, typename To, typename U>
1923  friend bool Parma_Polyhedra_Library
1924  ::euclidean_distance_assign(Checked_Number<To, Extended_Number_Policy>& r,
1925  const BD_Shape<U>& x, const BD_Shape<U>& y,
1926  const Rounding_Dir dir,
1927  Temp& tmp0, Temp& tmp1, Temp& tmp2);
1928  template <typename Temp, typename To, typename U>
1929  friend bool Parma_Polyhedra_Library
1930  ::l_infinity_distance_assign(Checked_Number<To, Extended_Number_Policy>& r,
1931  const BD_Shape<U>& x, const BD_Shape<U>& y,
1932  const Rounding_Dir dir,
1933  Temp& tmp0, Temp& tmp1, Temp& tmp2);
1934 
1935 private:
1936  template <typename U> friend class Parma_Polyhedra_Library::BD_Shape;
1937  template <typename Interval> friend class Parma_Polyhedra_Library::Box;
1938 
1941 
1942 #define PPL_IN_BD_Shape_CLASS
1943 #include "BDS_Status_idefs.hh"
1944 #undef PPL_IN_BD_Shape_CLASS
1945 
1948 
1951 
1953  bool marked_zero_dim_univ() const;
1954 
1961  bool marked_empty() const;
1962 
1970  bool marked_shortest_path_closed() const;
1971 
1979  bool marked_shortest_path_reduced() const;
1980 
1982  void set_empty();
1983 
1985  void set_zero_dim_univ();
1986 
1988  void set_shortest_path_closed();
1989 
1992 
1995 
1998 
2000  void shortest_path_closure_assign() const;
2001 
2007  void shortest_path_reduction_assign() const;
2008 
2014  bool is_shortest_path_reduced() const;
2015 
2028 
2030 
2046  bool bounds(const Linear_Expression& expr, bool from_above) const;
2047 
2049 
2079  bool max_min(const Linear_Expression& expr,
2080  bool maximize,
2081  Coefficient& ext_n, Coefficient& ext_d, bool& included,
2082  Generator& g) const;
2083 
2085 
2110  bool max_min(const Linear_Expression& expr,
2111  bool maximize,
2112  Coefficient& ext_n, Coefficient& ext_d, bool& included) const;
2113 
2129 
2146  template <bool integer_upper_bound>
2148 
2159  void refine_no_check(const Constraint& c);
2160 
2173  void refine_no_check(const Congruence& cg);
2174 
2176  void add_dbm_constraint(dimension_type i, dimension_type j, const N& k);
2177 
2180  Coefficient_traits::const_reference numer,
2181  Coefficient_traits::const_reference denom);
2182 
2189  void refine(Variable var, Relation_Symbol relsym,
2190  const Linear_Expression& expr,
2191  Coefficient_traits::const_reference denominator
2192  = Coefficient_one());
2193 
2198 
2200 
2215  dimension_type last_v,
2216  const Linear_Expression& sc_expr,
2217  Coefficient_traits::const_reference sc_denom,
2218  const N& ub_v);
2219 
2224  template <typename Interval_Info>
2226  const Interval<T, Interval_Info>& b);
2227 
2232  template <typename Interval_Info>
2233  void
2235  const Interval<T, Interval_Info>& b,
2236  const Interval<T, Interval_Info>& w_coeff,
2237  const dimension_type& w_id,
2238  const dimension_type& space_dim);
2239 
2244  template <typename Interval_Info>
2245  void
2248  const dimension_type& space_dim);
2249 
2254  template <typename Interval_Info>
2255  void
2257  const dimension_type& right_w_id,
2259  const Linear_Form<Interval<T, Interval_Info> >& right);
2260 
2265  template <typename Interval_Info>
2266  void
2267  left_one_var_refine(const dimension_type& left_w_id,
2268  const dimension_type& right_t,
2269  const dimension_type& right_w_id,
2271  const Linear_Form<Interval<T, Interval_Info> >& right);
2272 
2277  template <typename Interval_Info>
2278  void general_refine(const dimension_type& left_w_id,
2279  const dimension_type& right_w_id,
2281  const Linear_Form<Interval<T, Interval_Info> >& right);
2282 
2283  template <typename Interval_Info>
2285  lf,
2286  N& result) const;
2287 
2289 
2305  dimension_type last_v,
2306  const Linear_Expression& sc_expr,
2307  Coefficient_traits::const_reference sc_denom,
2308  const N& minus_lb_v);
2309 
2314  void get_limiting_shape(const Constraint_System& cs,
2315  BD_Shape& limiting_shape) const;
2316 
2318 
2321  void compute_predecessors(std::vector<dimension_type>& predecessor) const;
2322 
2324 
2327  void compute_leaders(std::vector<dimension_type>& leaders) const;
2328 
2330 
2331  friend std::ostream&
2332  Parma_Polyhedra_Library::IO_Operators
2333  ::operator<<<>(std::ostream& s, const BD_Shape<T>& c);
2334 
2336 
2337  void throw_dimension_incompatible(const char* method,
2338  const BD_Shape& y) const;
2339 
2340  void throw_dimension_incompatible(const char* method,
2341  dimension_type required_dim) const;
2342 
2343  void throw_dimension_incompatible(const char* method,
2344  const Constraint& c) const;
2345 
2346  void throw_dimension_incompatible(const char* method,
2347  const Congruence& cg) const;
2348 
2349  void throw_dimension_incompatible(const char* method,
2350  const Generator& g) const;
2351 
2352  void throw_dimension_incompatible(const char* method,
2353  const char* le_name,
2354  const Linear_Expression& le) const;
2355 
2356  template<typename Interval_Info>
2357  void
2358  throw_dimension_incompatible(const char* method,
2359  const char* lf_name,
2361  lf) const;
2362 
2363  static void throw_expression_too_complex(const char* method,
2364  const Linear_Expression& le);
2365 
2366  static void throw_invalid_argument(const char* method, const char* reason);
2368 };
2369 
2370 #include "BDS_Status_inlines.hh"
2371 #include "BD_Shape_inlines.hh"
2372 #include "BD_Shape_templates.hh"
2373 
2374 #endif // !defined(PPL_BD_Shape_defs_hh)
bool marked_empty() const
Returns true if the BDS is known to be empty.
void BHMZ05_widening_assign(const BD_Shape &y, unsigned *tp=0)
Assigns to *this the result of computing the BHMZ05-widening of *this and y.
void limited_CC76_extrapolation_assign(const BD_Shape &y, const Constraint_System &cs, unsigned *tp=0)
Improves the result of the CC76-extrapolation computation by also enforcing those constraints in cs t...
void deduce_u_minus_v_bounds(dimension_type v, dimension_type last_v, const Linear_Expression &sc_expr, Coefficient_traits::const_reference sc_denom, const N &minus_lb_v)
An helper function for the computation of affine relations.
bool operator!=(const Box< ITV > &x, const Box< ITV > &y)
Definition: Box_inlines.hh:264
static bool can_recycle_congruence_systems()
Returns false indicating that this domain cannot recycle congruences.
A linear equality or inequality.
void unconstrain(Variable var)
Computes the cylindrification of *this with respect to space dimension var, assigning the result to *...
void left_inhomogeneous_refine(const dimension_type &right_t, const dimension_type &right_w_id, const Linear_Form< Interval< T, Interval_Info > > &left, const Linear_Form< Interval< T, Interval_Info > > &right)
Auxiliary function for refine with linear form that handle the general case: .
void swap(CO_Tree &x, CO_Tree &y)
void refine_with_constraint(const Constraint &c)
Uses a copy of constraint c to refine the system of bounded differences defining *this.
size_t dimension_type
An unsigned integral type for representing space dimensions.
An std::set of variables' indexes.
void fold_space_dimensions(const Variables_Set &vars, Variable dest)
Folds the space dimensions in vars into dest.
memory_size_type external_memory_in_bytes() const
Returns the size in bytes of the memory managed by *this.
void upper_bound_assign(const BD_Shape &y)
Assigns to *this the smallest BDS containing the union of *this and y.
bool max_min(const Linear_Expression &expr, bool maximize, Coefficient &ext_n, Coefficient &ext_d, bool &included, Generator &g) const
Maximizes or minimizes expr subject to *this.
bool is_disjoint_from(const BD_Shape &y) const
Returns true if and only if *this and y are disjoint.
void widening_assign(const BD_Shape &y, unsigned *tp=0)
Same as H79_widening_assign(y, tp).
A line, ray, point or closure point.
void map_space_dimensions(const Partial_Function &pfunc)
Remaps the dimensions of the vector space according to a partial function.
bool is_shortest_path_reduced() const
Returns true if and only if this->dbm is shortest-path closed and this->redundancy_dbm correctly flag...
Rounding_Dir
Rounding directions for arithmetic computations.
BD_Shape(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe or empty BDS of the specified space dimension.
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 . ...
void concatenate_assign(const BD_Shape &y)
Assigns to *this the concatenation of *this and y, taken in this order.
Checked_Number< T, Debug_WRD_Extended_Number_Policy > N
The (extended) numeric type of the inhomogeneous term of the inequalities defining a BDS...
void refine_with_constraints(const Constraint_System &cs)
Uses a copy of the constraints in cs to refine the system of bounded differences defining *this...
void get_limiting_shape(const Constraint_System &cs, BD_Shape &limiting_shape) const
Adds to limiting_shape the bounded differences in cs that are satisfied by *this. ...
void drop_some_non_integer_points(Complexity_Class complexity=ANY_COMPLEXITY)
Possibly tightens *this by dropping some points with non-integer coordinates.
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 into the affine ex...
void m_swap(BD_Shape &y)
Swaps *this with y (*this and y can be dimension-incompatible).
void throw_dimension_incompatible(const char *method, const BD_Shape &y) const
A conjunctive assertion about a BD_Shape object.
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.
T coefficient_type_base
The numeric base type upon which bounded differences are built.
bool BFT00_upper_bound_assign_if_exact(const BD_Shape &y)
If the upper bound of *this and y is exact it is assigned to *this and true is returned, otherwise false is returned.
void CC76_extrapolation_assign(const BD_Shape &y, unsigned *tp=0)
Assigns to *this the result of computing the CC76-extrapolation between *this and y...
BD_Shape & operator=(const BD_Shape &y)
The assignment operator (*this and y can be dimension-incompatible).
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 into the affine...
void affine_form_image(Variable var, const Linear_Form< Interval< T, Interval_Info > > &lf)
Assigns to *this the affine form image of *this under the function mapping variable var into the affi...
void add_constraint(const Constraint &c)
Adds a copy of constraint c to the system of bounded differences defining *this.
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 affine relation , where is the relation symb...
bool strictly_contains(const BD_Shape &y) const
Returns true if and only if *this strictly contains y.
bool marked_shortest_path_closed() const
Returns true if the system of bounded differences is known to be shortest-path closed.
void set_zero_dim_univ()
Turns *this into an zero-dimensional universe BDS.
void inhomogeneous_affine_form_image(const dimension_type &var_id, const Interval< T, Interval_Info > &b)
Auxiliary function for affine form image that handle the general case: .
bool marked_shortest_path_reduced() const
Returns true if the system of bounded differences is known to be shortest-path reduced.
void compute_predecessors(std::vector< dimension_type > &predecessor) const
Compute the (zero-equivalence classes) predecessor relation.
void add_space_dimensions_and_embed(dimension_type m)
Adds m new dimensions and embeds the old BDS into the new space.
bool is_empty() const
Returns true if and only if *this is an empty BDS.
void refine_no_check(const Constraint &c)
Uses the constraint c to refine *this.
void left_one_var_refine(const dimension_type &left_w_id, const dimension_type &right_t, const dimension_type &right_w_id, const Linear_Form< Interval< T, Interval_Info > > &left, const Linear_Form< Interval< T, Interval_Info > > &right)
Auxiliary function for refine with linear form that handle the general case: .
A dimension of the vector space.
void shortest_path_closure_assign() const
Assigns to this->dbm its shortest-path closure.
bool bounds(const Linear_Expression &expr, bool from_above) const
Checks if and how expr is bounded in *this.
bool upper_bound_assign_if_exact(const BD_Shape &y)
If the upper bound of *this and y is exact, it is assigned to *this and true is returned, otherwise false is returned.
Complexity_Class
Complexity pseudo-classes.
The base class for convex polyhedra.
void refine_with_congruence(const Congruence &cg)
Uses a copy of congruence cg to refine the system of bounded differences of *this.
static dimension_type max_space_dimension()
Returns the maximum space dimension that a BDS can handle.
A wrapper for numeric types implementing a given policy.
#define PPL_OUTPUT_DECLARATIONS
void time_elapse_assign(const BD_Shape &y)
Assigns to *this the result of computing the time-elapse between *this and y.
bool is_universe() const
Returns true if and only if *this is a universe BDS.
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 ...
void linear_form_upper_bound(const Linear_Form< Interval< T, Interval_Info > > &lf, N &result) const
bool bounds_from_above(const Linear_Expression &expr) const
Returns true if and only if expr is bounded from above in *this.
bool constrains(Variable var) const
Returns true if and only if var is constrained in *this.
void reset_shortest_path_closed()
Marks *this as possibly not shortest-path closed.
int32_t hash_code() const
Returns a 32-bit hash code for *this.
Relation_Symbol
Relation symbols.
Degenerate_Element
Kinds of degenerate abstract elements.
void add_dbm_constraint(dimension_type i, dimension_type j, const N &k)
Adds the constraint dbm[i][j] <= k.
void two_variables_affine_form_image(const dimension_type &var_id, const Linear_Form< Interval< T, Interval_Info > > &lf, const dimension_type &space_dim)
Auxiliary function for affine form image that handle the general case: .
static bool can_recycle_constraint_systems()
Returns false indicating that this domain cannot recycle constraints.
void add_recycled_constraints(Constraint_System &cs)
Adds the constraints in cs to the system of constraints of *this.
bool simplify_using_context_assign(const BD_Shape &y)
Assigns to *this a meet-preserving simplification of *this with respect to y. If false is returned...
bool bounds_from_below(const Linear_Expression &expr) const
Returns true if and only if expr is bounded from below in *this.
A linear form with interval coefficients.
static void throw_invalid_argument(const char *method, const char *reason)
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 affine relation , where is the relation s...
bool frequency(const Linear_Expression &expr, Coefficient &freq_n, Coefficient &freq_d, Coefficient &val_n, Coefficient &val_d) const
Returns true if and only if there exist a unique value val such that *this saturates the equality exp...
void export_interval_constraints(U &dest) const
Applies to dest the interval constraints embedded in *this.
bool is_bounded() const
Returns true if and only if *this is a bounded BDS.
Constraint_System constraints() const
Returns a system of constraints defining *this.
void difference_assign(const BD_Shape &y)
Assigns to *this the smallest BD shape containing the set difference of *this and y...
void intersection_assign(const BD_Shape &y)
Assigns to *this the intersection of *this and y.
memory_size_type total_memory_in_bytes() const
Returns the total size in bytes of the memory occupied by *this.
Congruence_System minimized_congruences() const
Returns a minimal system of (equality) congruences satisfied by *this with the same affine dimension ...
A not necessarily closed, iso-oriented hyperrectangle.
Definition: Box_defs.hh:299
bool ascii_load(std::istream &s)
Loads from s an ASCII representation (as produced by ascii_dump(std::ostream&) const) and sets *this ...
void refine(Variable var, Relation_Symbol relsym, const Linear_Expression &expr, Coefficient_traits::const_reference denominator=Coefficient_one())
Adds to the BDS the constraint .
bool marked_zero_dim_univ() const
Returns true if the BDS is the zero-dimensional universe.
PPL_COEFFICIENT_TYPE Coefficient
An alias for easily naming the type of PPL coefficients.
void deduce_v_minus_u_bounds(dimension_type v, dimension_type last_v, const Linear_Expression &sc_expr, Coefficient_traits::const_reference sc_denom, const N &ub_v)
An helper function for the computation of affine relations.
N coefficient_type
The (extended) numeric type of the inhomogeneous term of the inequalities defining a BDS...
void remove_space_dimensions(const Variables_Set &vars)
Removes all the specified dimensions.
The universe element, i.e., the whole vector space.
A generic, not necessarily closed, possibly restricted interval.
Constraint_System minimized_constraints() const
Returns a minimized system of constraints defining *this.
void add_recycled_congruences(Congruence_System &cgs)
Adds to *this constraints equivalent to the congruences in cgs.
bool OK() const
Returns true if and only if *this satisfies all its invariants.
void forget_binary_dbm_constraints(dimension_type v)
Removes all binary constraints on row/column v.
void one_variable_affine_form_image(const dimension_type &var_id, const Interval< T, Interval_Info > &b, const Interval< T, Interval_Info > &w_coeff, const dimension_type &w_id, const dimension_type &space_dim)
Auxiliary function for affine formimage" that handle the general case: .
void set_shortest_path_closed()
Marks *this as shortest-path closed.
void refine_with_congruences(const Congruence_System &cgs)
Uses a copy of the congruences in cgs to refine the system of bounded differences defining *this...
The entire library is confined to this namespace.
Definition: version.hh:61
bool contains(const BD_Shape &y) const
Returns true if and only if *this contains y.
void add_constraints(const Constraint_System &cs)
Adds the constraints in cs to the system of bounded differences defining *this.
bool integer_upper_bound_assign_if_exact(const BD_Shape &y)
If the integer upper bound of *this and y is exact, it is assigned to *this and true is returned; oth...
Poly_Con_Relation relation_with(const Constraint &c) const
Returns the relations holding between *this and the constraint c.
void incremental_shortest_path_closure_assign(Variable var) const
Incrementally computes shortest-path closure, assuming that only constraints affecting variable var n...
void general_refine(const dimension_type &left_w_id, const dimension_type &right_w_id, const Linear_Form< Interval< T, Interval_Info > > &left, const Linear_Form< Interval< T, Interval_Info > > &right)
Auxiliary function for refine with linear form that handle the general case.
A bounded difference shape.
bool is_discrete() const
Returns true if and only if *this is discrete.
dimension_type space_dimension() const
Returns the dimension of the vector space enclosing *this.
bool BHZ09_upper_bound_assign_if_exact(const BD_Shape &y)
If the upper bound of *this and y is exact it is assigned to *this and true is returned, otherwise false is returned.
void compute_leaders(std::vector< dimension_type > &leaders) const
Compute the leaders of zero-equivalence classes.
void refine_with_linear_form_inequality(const Linear_Form< Interval< T, Interval_Info > > &left, const Linear_Form< Interval< T, Interval_Info > > &right)
Refines the system of BD_Shape constraints defining *this using the constraint expressed by left rig...
Bit_Matrix redundancy_dbm
A matrix indicating which constraints are redundant.
bool operator==(const Box< ITV > &x, const Box< ITV > &y)
void forget_all_dbm_constraints(dimension_type v)
Removes all the constraints on row/column v.
void refine_fp_interval_abstract_store(Box< Interval< T, Interval_Info > > &store) const
Refines store with the constraints defining *this.
Congruence_System congruences() const
Returns a system of (equality) congruences satisfied by *this.
bool contains_integer_point() const
Returns true if and only if *this contains at least one integer point.
void wrap_assign(const Variables_Set &vars, Bounded_Integer_Type_Width w, Bounded_Integer_Type_Representation r, Bounded_Integer_Type_Overflow o, const Constraint_System *cs_p=0, unsigned complexity_threshold=16, bool wrap_individually=true)
Wraps the specified dimensions of the vector space.
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.
void limited_H79_extrapolation_assign(const BD_Shape &y, const Constraint_System &cs, unsigned *tp=0)
Improves the result of the H79-widening computation by also enforcing those constraints in cs that ar...
void remove_higher_space_dimensions(dimension_type new_dimension)
Removes the higher dimensions so that the resulting space will have dimension new_dimension.
static void throw_expression_too_complex(const char *method, const Linear_Expression &le)
static bool extract_bounded_difference(const Constraint &c, dimension_type &c_num_vars, dimension_type &c_first_var, dimension_type &c_second_var, Coefficient &c_coeff)
Decodes the constraint c as a bounded difference.
size_t memory_size_type
An unsigned integral type for representing memory size in bytes.
void generalized_refine_with_linear_form_inequality(const Linear_Form< Interval< T, Interval_Info > > &left, const Linear_Form< Interval< T, Interval_Info > > &right, Relation_Symbol relsym)
Refines the system of BD_Shape constraints defining *this using the constraint expressed by left rig...
Coefficient c
Definition: PIP_Tree.cc:64
void reset_shortest_path_reduced()
Marks *this as possibly not shortest-path reduced.
void topological_closure_assign()
Assigns to *this its topological closure.
Status status
The status flags to keep track of the internal state.
void set_empty()
Turns *this into an empty BDS.
void CC76_narrowing_assign(const BD_Shape &y)
Assigns to *this the result of restoring in y the constraints of *this that were lost by CC76-extrapo...
Coefficient_traits::const_reference Coefficient_one()
Returns a const reference to a Coefficient with value 1.
void add_congruence(const Congruence &cg)
Adds a copy of congruence cg to the system of congruences of *this.
void expand_space_dimension(Variable var, dimension_type m)
Creates m copies of the space dimension corresponding to var.
dimension_type affine_dimension() const
Returns , if *this is empty; otherwise, returns the affine dimension of *this.
The base class for the square matrices.
void shortest_path_reduction_assign() const
Assigns to this->dbm its shortest-path closure and records into this->redundancy_dbm which of the ent...
void add_congruences(const Congruence_System &cgs)
Adds to *this constraints equivalent to the congruences in cgs.
void H79_widening_assign(const BD_Shape &y, unsigned *tp=0)
Assigns to *this the result of computing the H79-widening between *this and y.
void add_space_dimensions_and_project(dimension_type m)
Adds m new dimensions to the BDS and does not embed it in the new vector space.
void limited_BHMZ05_extrapolation_assign(const BD_Shape &y, const Constraint_System &cs, unsigned *tp=0)
Improves the result of the BHMZ05-widening computation by also enforcing those constraints in cs that...
bool le(Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
The relation between a polyhedron and a generator.
DB_Matrix< N > dbm
The matrix representing the system of bounded differences.
void set_shortest_path_reduced()
Marks *this as shortest-path closed.
The relation between a polyhedron and a constraint.
bool is_topologically_closed() const
Returns true if and only if *this is a topologically closed subset of the vector space.