PPL  1.2
Box_defs.hh
Go to the documentation of this file.
1 /* Box 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_Box_defs_hh
25 #define PPL_Box_defs_hh 1
26 
27 #include "Box_types.hh"
28 #include "globals_types.hh"
29 #include "Coefficient_defs.hh"
30 #include "Variable_types.hh"
31 #include "Variables_Set_types.hh"
33 #include "Constraint_types.hh"
34 #include "Constraint_defs.hh"
36 #include "Generator_types.hh"
38 #include "Congruence_types.hh"
40 #include "BD_Shape_types.hh"
41 #include "Octagonal_Shape_types.hh"
44 #include "Polyhedron_types.hh"
45 #include "Grid_types.hh"
47 #include "intervals_defs.hh"
48 #include "Interval_types.hh"
49 #include "Linear_Form_types.hh"
50 #include <vector>
51 #include <iosfwd>
52 
53 namespace Parma_Polyhedra_Library {
54 
55 struct Interval_Base;
56 
58 
59 template <typename ITV>
60 void swap(Box<ITV>& x, Box<ITV>& y);
61 
63 
67 template <typename ITV>
68 bool operator==(const Box<ITV>& x, const Box<ITV>& y);
69 
71 
75 template <typename ITV>
76 bool operator!=(const Box<ITV>& x, const Box<ITV>& y);
77 
78 namespace IO_Operators {
79 
81 
82 template <typename ITV>
83 std::ostream& operator<<(std::ostream& s, const Box<ITV>& box);
84 
85 } // namespace IO_Operators
86 
88 
98 template <typename To, typename ITV>
99 bool
100 rectilinear_distance_assign(Checked_Number<To, Extended_Number_Policy>& r,
101  const Box<ITV>& x,
102  const Box<ITV>& y,
103  Rounding_Dir dir);
104 
106 
116 template <typename Temp, typename To, typename ITV>
117 bool
118 rectilinear_distance_assign(Checked_Number<To, Extended_Number_Policy>& r,
119  const Box<ITV>& x,
120  const Box<ITV>& y,
121  Rounding_Dir dir);
122 
124 
134 template <typename Temp, typename To, typename ITV>
135 bool
136 rectilinear_distance_assign(Checked_Number<To, Extended_Number_Policy>& r,
137  const Box<ITV>& x,
138  const Box<ITV>& y,
139  Rounding_Dir dir,
140  Temp& tmp0,
141  Temp& tmp1,
142  Temp& tmp2);
143 
145 
155 template <typename To, typename ITV>
156 bool
157 euclidean_distance_assign(Checked_Number<To, Extended_Number_Policy>& r,
158  const Box<ITV>& x,
159  const Box<ITV>& y,
160  Rounding_Dir dir);
161 
163 
173 template <typename Temp, typename To, typename ITV>
174 bool
175 euclidean_distance_assign(Checked_Number<To, Extended_Number_Policy>& r,
176  const Box<ITV>& x,
177  const Box<ITV>& y,
178  Rounding_Dir dir);
179 
181 
191 template <typename Temp, typename To, typename ITV>
192 bool
193 euclidean_distance_assign(Checked_Number<To, Extended_Number_Policy>& r,
194  const Box<ITV>& x,
195  const Box<ITV>& y,
196  Rounding_Dir dir,
197  Temp& tmp0,
198  Temp& tmp1,
199  Temp& tmp2);
200 
202 
212 template <typename To, typename ITV>
213 bool
214 l_infinity_distance_assign(Checked_Number<To, Extended_Number_Policy>& r,
215  const Box<ITV>& x,
216  const Box<ITV>& y,
217  Rounding_Dir dir);
218 
220 
230 template <typename Temp, typename To, typename ITV>
231 bool
232 l_infinity_distance_assign(Checked_Number<To, Extended_Number_Policy>& r,
233  const Box<ITV>& x,
234  const Box<ITV>& y,
235  Rounding_Dir dir);
236 
238 
248 template <typename Temp, typename To, typename ITV>
249 bool
250 l_infinity_distance_assign(Checked_Number<To, Extended_Number_Policy>& r,
251  const Box<ITV>& x,
252  const Box<ITV>& y,
253  Rounding_Dir dir,
254  Temp& tmp0,
255  Temp& tmp1,
256  Temp& tmp2);
257 
258 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
259 
262 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
263 template <typename Specialization,
264  typename Temp, typename To, typename ITV>
265 bool
266 l_m_distance_assign(Checked_Number<To, Extended_Number_Policy>& r,
267  const Box<ITV>& x, const Box<ITV>& y,
268  Rounding_Dir dir,
269  Temp& tmp0, Temp& tmp1, Temp& tmp2);
270 
271 } // namespace Parma_Polyhedra_Library
272 
274 
298 template <typename ITV>
300 public:
302  typedef ITV interval_type;
303 
306 
310  static bool can_recycle_constraint_systems();
311 
315  static bool can_recycle_congruence_systems();
316 
318 
319 
321 
328  explicit Box(dimension_type num_dimensions = 0,
330 
332 
335  Box(const Box& y,
336  Complexity_Class complexity = ANY_COMPLEXITY);
337 
339 
342  template <typename Other_ITV>
343  explicit Box(const Box<Other_ITV>& y,
344  Complexity_Class complexity = ANY_COMPLEXITY);
345 
347 
356  explicit Box(const Constraint_System& cs);
357 
359 
372  Box(const Constraint_System& cs, Recycle_Input dummy);
373 
375 
382  explicit Box(const Generator_System& gs);
383 
385 
399  Box(const Generator_System& gs, Recycle_Input dummy);
400 
411  explicit Box(const Congruence_System& cgs);
412 
427  Box(const Congruence_System& cgs, Recycle_Input dummy);
428 
430 
434  template <typename T>
435  explicit Box(const BD_Shape<T>& bds,
437 
439 
443  template <typename T>
444  explicit Box(const Octagonal_Shape<T>& oct,
446 
448 
454  explicit Box(const Polyhedron& ph,
455  Complexity_Class complexity = ANY_COMPLEXITY);
456 
458 
462  explicit Box(const Grid& gr,
464 
466 
470  template <typename D1, typename D2, typename R>
471  explicit Box(const Partially_Reduced_Product<D1, D2, R>& dp,
472  Complexity_Class complexity = ANY_COMPLEXITY);
473 
478  Box& operator=(const Box& y);
479 
484  void m_swap(Box& y);
485 
487 
489 
490 
493 
500 
502  bool is_empty() const;
503 
505  bool is_universe() const;
506 
511  bool is_topologically_closed() const;
512 
514  bool is_discrete() const;
515 
517  bool is_bounded() const;
518 
523  bool contains_integer_point() const;
524 
532  bool constrains(Variable var) const;
533 
535 
540 
542 
546  Poly_Con_Relation relation_with(const Congruence& cg) const;
547 
549 
553  Poly_Gen_Relation relation_with(const Generator& g) const;
554 
562  bool bounds_from_above(const Linear_Expression& expr) const;
563 
571  bool bounds_from_below(const Linear_Expression& expr) const;
572 
597  bool maximize(const Linear_Expression& expr,
598  Coefficient& sup_n, Coefficient& sup_d, bool& maximum) const;
599 
628  bool maximize(const Linear_Expression& expr,
629  Coefficient& sup_n, Coefficient& sup_d, bool& maximum,
630  Generator& g) const;
631 
656  bool minimize(const Linear_Expression& expr,
657  Coefficient& inf_n, Coefficient& inf_d, bool& minimum) const;
658 
687  bool minimize(const Linear_Expression& expr,
688  Coefficient& inf_n, Coefficient& inf_d, bool& minimum,
689  Generator& g) const;
690 
719  bool frequency(const Linear_Expression& expr,
720  Coefficient& freq_n, Coefficient& freq_d,
721  Coefficient& val_n, Coefficient& val_d) const;
722 
729  bool contains(const Box& y) const;
730 
737  bool strictly_contains(const Box& y) const;
738 
745  bool is_disjoint_from(const Box& y) const;
746 
751  bool OK() const;
752 
754 
756 
757 
769  void add_constraint(const Constraint& c);
770 
783  void add_constraints(const Constraint_System& cs);
784 
802 
813  void add_congruence(const Congruence& cg);
814 
826  void add_congruences(const Congruence_System& cgs);
827 
845 
855  void refine_with_constraint(const Constraint& c);
856 
877 
887  void refine_with_congruence(const Congruence& cg);
888 
899 
909  void propagate_constraint(const Constraint& c);
910 
929  dimension_type max_iterations = 0);
930 
941  void unconstrain(Variable var);
942 
955  void unconstrain(const Variables_Set& vars);
956 
958 
962  void intersection_assign(const Box& y);
963 
971  void upper_bound_assign(const Box& y);
972 
981  bool upper_bound_assign_if_exact(const Box& y);
982 
989  void difference_assign(const Box& y);
990 
999  bool simplify_using_context_assign(const Box& y);
1000 
1022  void affine_image(Variable var,
1023  const Linear_Expression& expr,
1024  Coefficient_traits::const_reference denominator
1025  = Coefficient_one());
1026 
1027  // FIXME: To be completed.
1048  void affine_form_image(Variable var,
1049  const Linear_Form<ITV>& lf);
1050 
1071  void affine_preimage(Variable var,
1072  const Linear_Expression& expr,
1073  Coefficient_traits::const_reference denominator
1074  = Coefficient_one());
1075 
1101  Relation_Symbol relsym,
1102  const Linear_Expression& expr,
1103  Coefficient_traits::const_reference denominator
1104  = Coefficient_one());
1105 
1130  void
1132  Relation_Symbol relsym,
1133  const Linear_Expression& expr,
1134  Coefficient_traits::const_reference denominator
1135  = Coefficient_one());
1136 
1156  Relation_Symbol relsym,
1157  const Linear_Expression& rhs);
1158 
1178  Relation_Symbol relsym,
1179  const Linear_Expression& rhs);
1180 
1206  void bounded_affine_image(Variable var,
1207  const Linear_Expression& lb_expr,
1208  const Linear_Expression& ub_expr,
1209  Coefficient_traits::const_reference denominator
1210  = Coefficient_one());
1211 
1238  const Linear_Expression& lb_expr,
1239  const Linear_Expression& ub_expr,
1240  Coefficient_traits::const_reference denominator
1241  = Coefficient_one());
1242 
1250  void time_elapse_assign(const Box& y);
1251 
1254 
1295  void wrap_assign(const Variables_Set& vars,
1299  const Constraint_System* cs_p = 0,
1300  unsigned complexity_threshold = 16,
1301  bool wrap_individually = true);
1302 
1315  = ANY_COMPLEXITY);
1316 
1333  Complexity_Class complexity
1334  = ANY_COMPLEXITY);
1335 
1351  template <typename T>
1354  void>::type
1355  CC76_widening_assign(const T& y, unsigned* tp = 0);
1356 
1373  template <typename T, typename Iterator>
1375  && Is_Same_Or_Derived<Interval_Base, ITV>::value,
1376  void>::type
1377  CC76_widening_assign(const T& y,
1378  Iterator first, Iterator last);
1379 
1381  void widening_assign(const Box& y, unsigned* tp = 0);
1382 
1403  void limited_CC76_extrapolation_assign(const Box& y,
1404  const Constraint_System& cs,
1405  unsigned* tp = 0);
1406 
1426  template <typename T>
1428  && Is_Same_Or_Derived<Interval_Base, ITV>::value,
1429  void>::type
1430  CC76_narrowing_assign(const T& y);
1431 
1433 
1435 
1436 
1438 
1456 
1479 
1503  void concatenate_assign(const Box& y);
1504 
1506 
1514  void remove_space_dimensions(const Variables_Set& vars);
1515 
1524  void remove_higher_space_dimensions(dimension_type new_dimension);
1525 
1563  template <typename Partial_Function>
1564  void map_space_dimensions(const Partial_Function& pfunc);
1565 
1567 
1588 
1590 
1612  void fold_space_dimensions(const Variables_Set& vars, Variable dest);
1613 
1615 
1622  const ITV& get_interval(Variable var) const;
1623 
1630  void set_interval(Variable var, const ITV& i);
1631 
1663  bool has_lower_bound(Variable var,
1664  Coefficient& n, Coefficient& d, bool& closed) const;
1665 
1697  bool has_upper_bound(Variable var,
1698  Coefficient& n, Coefficient& d, bool& closed) const;
1699 
1702 
1705 
1708 
1711 
1714 
1717 
1724  int32_t hash_code() const;
1725 
1727 
1728 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
1729 
1734 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
1735  bool ascii_load(std::istream& s);
1736 
1737 private:
1738  template <typename Other_ITV>
1740 
1741  friend bool
1742  operator==<ITV>(const Box<ITV>& x, const Box<ITV>& y);
1743 
1744  friend std::ostream&
1745  Parma_Polyhedra_Library
1746  ::IO_Operators::operator<<<>(std::ostream& s, const Box<ITV>& box);
1747 
1748  template <typename Specialization, typename Temp, typename To, typename I>
1749  friend bool Parma_Polyhedra_Library
1750  ::l_m_distance_assign(Checked_Number<To, Extended_Number_Policy>& r,
1751  const Box<I>& x, const Box<I>& y,
1752  const Rounding_Dir dir,
1753  Temp& tmp0, Temp& tmp1, Temp& tmp2);
1754 
1756  typedef std::vector<ITV> Sequence;
1757 
1762  typedef ITV Tmp_Interval_Type;
1763 
1765  Sequence seq;
1766 
1767 #define PPL_IN_Box_CLASS
1768 #include "Box_Status_idefs.hh"
1769 #undef PPL_IN_Box_CLASS
1770 
1773 
1780  bool marked_empty() const;
1781 
1782 public:
1784  void set_empty();
1785 
1786 private:
1788  void set_nonempty();
1789 
1791  void set_empty_up_to_date();
1792 
1794  void reset_empty_up_to_date();
1795 
1800  bool check_empty() const;
1801 
1806  const ITV& operator[](dimension_type k) const;
1807 
1811  static I_Result
1812  refine_interval_no_check(ITV& itv,
1813  Constraint::Type type,
1814  Coefficient_traits::const_reference numer,
1815  Coefficient_traits::const_reference denom);
1816 
1820  void
1822  Constraint::Type type,
1823  Coefficient_traits::const_reference numer,
1824  Coefficient_traits::const_reference denom);
1825 
1829  void add_constraint_no_check(const Constraint& c);
1830 
1835 
1839  void add_congruence_no_check(const Congruence& cg);
1840 
1845 
1856  void refine_no_check(const Constraint& c);
1857 
1870  void refine_no_check(const Constraint_System& cs);
1871 
1883  void refine_no_check(const Congruence& cg);
1884 
1896  void refine_no_check(const Congruence_System& cgs);
1897 
2059 
2079  dimension_type max_iterations);
2080 
2082 
2098  bool bounds(const Linear_Expression& expr, bool from_above) const;
2099 
2101 
2130  bool max_min(const Linear_Expression& expr,
2131  bool maximize,
2132  Coefficient& ext_n, Coefficient& ext_d, bool& included,
2133  Generator& g) const;
2134 
2136 
2160  bool max_min(const Linear_Expression& expr,
2161  bool maximize,
2162  Coefficient& ext_n, Coefficient& ext_d, bool& included) const;
2163 
2168  void get_limiting_box(const Constraint_System& cs,
2169  Box& limiting_box) const;
2170 
2172 
2173  void throw_dimension_incompatible(const char* method,
2174  const Box& y) const;
2175 
2176  void throw_dimension_incompatible(const char* method,
2177  dimension_type required_dim) const;
2178 
2179  void throw_dimension_incompatible(const char* method,
2180  const Constraint& c) const;
2181 
2182  void throw_dimension_incompatible(const char* method,
2183  const Congruence& cg) const;
2184 
2185  void throw_dimension_incompatible(const char* method,
2186  const Constraint_System& cs) const;
2187 
2188  void throw_dimension_incompatible(const char* method,
2189  const Congruence_System& cgs) const;
2190 
2191  void throw_dimension_incompatible(const char* method,
2192  const Generator& g) const;
2193 
2194  void throw_dimension_incompatible(const char* method,
2195  const char* le_name,
2196  const Linear_Expression& le) const;
2197 
2198  template <typename C>
2199  void throw_dimension_incompatible(const char* method,
2200  const char* lf_name,
2201  const Linear_Form<C>& lf) const;
2202 
2203  static void throw_constraint_incompatible(const char* method);
2204 
2205  static void throw_expression_too_complex(const char* method,
2206  const Linear_Expression& le);
2207 
2208  static void throw_invalid_argument(const char* method, const char* reason);
2210 };
2211 
2212 namespace Parma_Polyhedra_Library {
2213 
2214 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
2215 
2236 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
2237 template <typename ITV>
2239 interval_relation(const ITV& i,
2240  const Constraint::Type constraint_type,
2241  Coefficient_traits::const_reference numer,
2242  Coefficient_traits::const_reference denom
2243  = Coefficient_one());
2244 
2246 public:
2247  // This is declared here so that Linear_Expression needs to be friend of
2248  // Box_Helpers only, and doesn't need to be friend of this, too.
2249  #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
2250 
2270  #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
2271  static bool extract_interval_constraint(const Constraint& c,
2272  dimension_type& c_num_vars,
2273  dimension_type& c_only_var);
2274 
2275  // This is declared here so that Linear_Expression needs to be friend of
2276  // Box_Helpers only, and doesn't need to be friend of this, too.
2277  static bool extract_interval_congruence(const Congruence& cg,
2278  dimension_type& cg_num_vars,
2279  dimension_type& cg_only_var);
2280 };
2281 
2282 } // namespace Parma_Polyhedra_Library
2283 
2284 #include "Box_Status_inlines.hh"
2285 #include "Box_inlines.hh"
2286 #include "Box_templates.hh"
2287 
2288 #endif // !defined(PPL_Box_defs_hh)
Congruence_System congruences() const
Returns a system of congruences approximating *this.
static bool extract_interval_congruence(const Congruence &cg, dimension_type &cg_num_vars, dimension_type &cg_only_var)
Definition: Box.cc:48
Congruence_System minimized_congruences() const
Returns a minimized system of congruences approximating *this.
Definition: Box_inlines.hh:393
void m_swap(Box &y)
Swaps *this with y (*this and y can be dimension-incompatible).
Definition: Box_inlines.hh:84
bool operator!=(const Box< ITV > &x, const Box< ITV > &y)
Definition: Box_inlines.hh:264
The partially reduced product of two abstractions.
bool is_disjoint_from(const Box &y) const
Returns true if and only if *this and y are disjoint.
void throw_dimension_incompatible(const char *method, const Box &y) const
A linear equality or inequality.
std::vector< ITV > Sequence
The type of sequence used to implement the box.
Definition: Box_defs.hh:1756
void propagate_constraints(const Constraint_System &cs, dimension_type max_iterations=0)
Use the constraints in cs for constraint propagation on *this.
Definition: Box_inlines.hh:538
dimension_type space_dimension() const
Returns the dimension of the vector space enclosing *this.
Definition: Box_inlines.hh:123
void swap(CO_Tree &x, CO_Tree &y)
I_Result
The result of an operation on intervals.
void add_congruences_no_check(const Congruence_System &cgs)
WRITE ME.
size_t dimension_type
An unsigned integral type for representing space dimensions.
void limited_CC76_extrapolation_assign(const Box &y, const Constraint_System &cs, unsigned *tp=0)
Improves the result of the CC76-extrapolation computation by also enforcing those constraints in cs t...
Box(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe or empty box of the specified space dimension.
Status status
The status flags to keep track of the internal state.
Definition: Box_defs.hh:1772
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 ...
An std::set of variables' indexes.
void refine_with_constraint(const Constraint &c)
Use the constraint c to refine *this.
Definition: Box_inlines.hh:459
A line, ray, point or closure point.
void remove_higher_space_dimensions(dimension_type new_dimension)
Removes the higher dimensions so that the resulting space will have dimension new_dimension.
Rounding_Dir
Rounding directions for arithmetic computations.
ITV Tmp_Interval_Type
The type of intervals used by inner computations when trying to limit the cumulative effect of approx...
Definition: Box_defs.hh:1762
void add_congruence_no_check(const Congruence &cg)
WRITE ME.
bool is_topologically_closed() const
Returns true if and only if *this is a topologically closed subset of the vector space.
bool contains_integer_point() const
Returns true if and only if *this contains at least one integer point.
bool is_empty() const
Returns true if and only if *this is an empty box.
Definition: Box_inlines.hh:183
void propagate_constraints_no_check(const Constraint_System &cs, dimension_type max_iterations)
Propagates the constraints in cs to refine *this.
From bool Type Type Rounding_Dir To
void add_constraints_no_check(const Constraint_System &cs)
WRITE ME.
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...
Box & operator=(const Box &y)
The assignment operator (*this and y can be dimension-incompatible).
Definition: Box_inlines.hh:76
void unconstrain(Variable var)
Computes the cylindrification of *this with respect to space dimension var, assigning the result to *...
Definition: Box_inlines.hh:555
void upper_bound_assign(const Box &y)
Assigns to *this the smallest box containing the union of *this and y.
void add_constraints(const Constraint_System &cs)
Adds the constraints in cs to the system of constraints defining *this.
Definition: Box_inlines.hh:331
void refine_with_constraints(const Constraint_System &cs)
Use the constraints in cs to refine *this.
Definition: Box_inlines.hh:476
bool ascii_load(std::istream &s)
Loads from s an ASCII representation (as produced by ascii_dump(std::ostream&) const) and sets *this ...
ITV interval_type
The type of intervals used to implement the box.
Definition: Box_defs.hh:302
bool check_empty() const
Checks the hard way whether *this is an empty box: returns true if and only if it is so...
Worst-case polynomial complexity.
static bool extract_interval_constraint(const Constraint &c, dimension_type &c_num_vars, dimension_type &c_only_var)
Decodes the constraint c as an interval constraint.
Definition: Box.cc:30
A dimension of the vector space.
const ITV & operator[](dimension_type k) const
Returns a reference the interval that bounds the box on the k-th space dimension. ...
Definition: Box_inlines.hh:143
void topological_closure_assign()
Assigns to *this its topological closure.
Enable_If< Is_Same< T, Box >::value &&Is_Same_Or_Derived< Interval_Base, ITV >::value, void >::type CC76_narrowing_assign(const T &y)
Assigns to *this the result of restoring in y the constraints of *this that were lost by CC76-extrapo...
Constraint_System minimized_constraints() const
Returns a minimized system of constraints defining *this.
void widening_assign(const Box &y, unsigned *tp=0)
Same as CC76_widening_assign(y, tp).
Definition: Box_inlines.hh:387
Complexity_Class
Complexity pseudo-classes.
memory_size_type total_memory_in_bytes() const
Returns the total size in bytes of the memory occupied by *this.
Definition: Box_inlines.hh:117
The base class for convex polyhedra.
void expand_space_dimension(Variable var, dimension_type m)
Creates m copies of the space dimension corresponding to var.
Definition: Box_inlines.hh:240
void propagate_constraint(const Constraint &c)
Use the constraint c for constraint propagation on *this.
Definition: Box_inlines.hh:522
void get_limiting_box(const Constraint_System &cs, Box &limiting_box) const
Adds to limiting_box the interval constraints in cs that are satisfied by *this.
A wrapper for numeric types implementing a given policy.
#define PPL_OUTPUT_DECLARATIONS
Poly_Con_Relation interval_relation(const ITV &i, const Constraint::Type constraint_type, Coefficient_traits::const_reference numer, Coefficient_traits::const_reference denom=Coefficient_one())
Returns the relations holding between an interval and an interval constraint.
void intersection_assign(const Box &y)
Assigns to *this the intersection of *this and y.
A class holding a constant called value that evaluates to true if and only if Base is the same type a...
void add_recycled_constraints(Constraint_System &cs)
Adds the constraints in cs to the system of constraints defining *this.
Definition: Box_inlines.hh:342
Relation_Symbol
Relation symbols.
Degenerate_Element
Kinds of degenerate abstract elements.
void add_recycled_congruences(Congruence_System &cgs)
Adds to *this constraints equivalent to the congruences in cgs.
Definition: Box_inlines.hh:369
dimension_type affine_dimension() const
Returns , if *this is empty; otherwise, returns the affine dimension of *this.
A linear form with interval coefficients.
void reset_empty_up_to_date()
Invalidates empty flag of *this.
Definition: Box_inlines.hh:64
void drop_some_non_integer_points(Complexity_Class complexity=ANY_COMPLEXITY)
Possibly tightens *this by dropping some points with non-integer coordinates.
static void throw_constraint_incompatible(const char *method)
void set_nonempty()
Marks *this as definitely not empty.
Definition: Box_inlines.hh:51
void propagate_constraint_no_check(const Constraint &c)
Propagates the constraint c to refine *this.
bool has_upper_bound(Variable var, Coefficient &n, Coefficient &d, bool &closed) const
If the space dimension of var is unbounded above, return false. Otherwise return true and set n...
Definition: Box_inlines.hh:294
Sequence seq
A sequence of intervals, one for each dimension of the vector space.
Definition: Box_defs.hh:1765
static dimension_type max_space_dimension()
Returns the maximum space dimension that a Box can handle.
Definition: Box_inlines.hh:129
static void throw_invalid_argument(const char *method, const char *reason)
A not necessarily closed, iso-oriented hyperrectangle.
Definition: Box_defs.hh:299
static I_Result refine_interval_no_check(ITV &itv, Constraint::Type type, Coefficient_traits::const_reference numer, Coefficient_traits::const_reference denom)
WRITE ME.
Definition: Box_inlines.hh:401
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.
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 ...
PPL_COEFFICIENT_TYPE Coefficient
An alias for easily naming the type of PPL coefficients.
int32_t hash_code() const
Returns a 32-bit hash code for *this.
Definition: Box_inlines.hh:137
static bool can_recycle_constraint_systems()
Returns false indicating that this domain does not recycle constraints.
Definition: Box_inlines.hh:375
bool bounds_from_above(const Linear_Expression &expr) const
Returns true if and only if expr is bounded from above in *this.
Definition: Box_inlines.hh:189
void add_space_dimensions_and_project(dimension_type m)
Adds m new dimensions to the box and does not embed it in the new vector space.
void fold_space_dimensions(const Variables_Set &vars, Variable dest)
Folds the space dimensions in vars into dest.
bool upper_bound_assign_if_exact(const Box &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 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 . ...
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.
Definition: Box_inlines.hh:217
The universe element, i.e., the whole vector space.
void add_constraint_no_check(const Constraint &c)
WRITE ME.
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.
Definition: Box_inlines.hh:201
bool has_lower_bound(Variable var, Coefficient &n, Coefficient &d, bool &closed) const
If the space dimension of var is unbounded below, return false. Otherwise return true and set n...
Definition: Box_inlines.hh:270
memory_size_type external_memory_in_bytes() const
Returns the size in bytes of the memory managed by *this.
The entire library is confined to this namespace.
Definition: version.hh:61
void refine_no_check(const Constraint &c)
Uses the constraint c to refine *this.
const ITV & get_interval(Variable var) const
Returns a reference the interval that bounds var.
Definition: Box_inlines.hh:150
void add_congruence(const Congruence &cg)
Adds to *this a constraint equivalent to the congruence cg.
Definition: Box_inlines.hh:348
bool bounds(const Linear_Expression &expr, bool from_above) const
Checks if and how expr is bounded in *this.
void concatenate_assign(const Box &y)
Seeing a box as a set of tuples (its points), assigns to *this all the tuples that can be obtained by...
void set_empty_up_to_date()
Asserts the validity of the empty flag of *this.
Definition: Box_inlines.hh:58
void refine_with_congruences(const Congruence_System &cgs)
Use the congruences in cgs to refine *this.
Definition: Box_inlines.hh:506
Constraint_System constraints() const
Returns a system of constraints defining *this.
static bool can_recycle_congruence_systems()
Returns false indicating that this domain does not recycle congruences.
Definition: Box_inlines.hh:381
bool is_bounded() const
Returns true if and only if *this is a bounded box.
void difference_assign(const Box &y)
Assigns to *this the difference of *this and y.
A bounded difference shape.
bool bounds_from_below(const Linear_Expression &expr) const
Returns true if and only if expr is bounded from below in *this.
Definition: Box_inlines.hh:195
bool strictly_contains(const Box &y) const
Returns true if and only if *this strictly contains y.
Definition: Box_inlines.hh:233
void time_elapse_assign(const Box &y)
Assigns to *this the result of computing the time-elapse between *this and y.
static void throw_expression_too_complex(const char *method, const Linear_Expression &le)
bool simplify_using_context_assign(const Box &y)
Assigns to *this a meet-preserving simplification of *this with respect to y. If false is returned...
void affine_form_image(Variable var, const Linear_Form< ITV > &lf)
Assigns to *this the affine form image of *this under the function mapping variable var into the affi...
bool operator==(const Box< ITV > &x, const Box< ITV > &y)
bool constrains(Variable var) const
Returns true if and only if var is constrained in *this.
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 ...
size_t memory_size_type
An unsigned integral type for representing memory size in bytes.
Coefficient c
Definition: PIP_Tree.cc:64
bool contains(const Box &y) const
Returns true if and only if *this contains y.
void map_space_dimensions(const Partial_Function &pfunc)
Remaps the dimensions of the vector space according to a partial function.
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 e...
Poly_Con_Relation relation_with(const Constraint &c) const
Returns the relations holding between *this and the constraint c.
Coefficient_traits::const_reference Coefficient_one()
Returns a const reference to a Coefficient with value 1.
A class that provides a type member called type equivalent to T if and only if b is true...
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 expr...
bool OK() const
Returns true if and only if *this satisfies all its invariants.
bool is_discrete() const
Returns true if and only if *this is discrete.
void add_constraint(const Constraint &c)
Adds a copy of constraint c to the system of constraints defining *this.
Definition: Box_inlines.hh:319
void add_congruences(const Congruence_System &cgs)
Adds to *this constraints equivalent to the congruences in cgs.
Definition: Box_inlines.hh:360
Enable_If< Is_Same< T, Box >::value &&Is_Same_Or_Derived< Interval_Base, ITV >::value, void >::type CC76_widening_assign(const T &y, unsigned *tp=0)
Assigns to *this the result of computing the CC76-widening between *this and y.
void remove_space_dimensions(const Variables_Set &vars)
Removes all the specified dimensions.
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 le(Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
void add_interval_constraint_no_check(dimension_type var_id, Constraint::Type type, Coefficient_traits::const_reference numer, Coefficient_traits::const_reference denom)
WRITE ME.
Definition: Box_inlines.hh:442
The relation between a polyhedron and a generator.
void set_interval(Variable var, const ITV &i)
Sets to i the interval that bounds var.
Definition: Box_inlines.hh:164
bool is_universe() const
Returns true if and only if *this is a universe box.
bool marked_empty() const
Returns true if and only if the box is known to be empty.
Definition: Box_inlines.hh:38
The relation between a polyhedron and a constraint.
void add_space_dimensions_and_embed(dimension_type m)
Adds m new dimensions and embeds the old box into the new space.
void set_empty()
Causes the box to become empty, i.e., to represent the empty set.
Definition: Box_inlines.hh:44
void refine_with_congruence(const Congruence &cg)
Use the congruence cg to refine *this.
Definition: Box_inlines.hh:491