24 #ifndef PPL_Box_defs_hh
25 #define PPL_Box_defs_hh 1
59 template <
typename ITV>
67 template <
typename ITV>
75 template <
typename ITV>
78 namespace IO_Operators {
82 template <
typename ITV>
83 std::ostream& operator<<(std::ostream& s, const Box<ITV>& box);
98 template <
typename To,
typename ITV>
116 template <
typename Temp,
typename To,
typename ITV>
134 template <
typename Temp,
typename To,
typename ITV>
155 template <
typename To,
typename ITV>
173 template <
typename Temp,
typename To,
typename ITV>
191 template <
typename Temp,
typename To,
typename ITV>
212 template <
typename To,
typename ITV>
230 template <
typename Temp,
typename To,
typename ITV>
248 template <
typename Temp,
typename To,
typename ITV>
258 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
262 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
263 template <
typename Specialization,
264 typename Temp,
typename To,
typename ITV>
269 Temp& tmp0, Temp& tmp1, Temp& tmp2);
298 template <
typename ITV>
342 template <
typename Other_ITV>
434 template <
typename T>
443 template <
typename T>
470 template <
typename D1,
typename D2,
typename R>
1024 Coefficient_traits::const_reference denominator
1073 Coefficient_traits::const_reference denominator
1103 Coefficient_traits::const_reference denominator
1134 Coefficient_traits::const_reference denominator
1209 Coefficient_traits::const_reference denominator
1240 Coefficient_traits::const_reference denominator
1300 unsigned complexity_threshold = 16,
1301 bool wrap_individually =
true);
1351 template <
typename T>
1373 template <
typename T,
typename Iterator>
1375 && Is_Same_Or_Derived<Interval_Base, ITV>::value,
1378 Iterator first, Iterator last);
1426 template <
typename T>
1428 && Is_Same_Or_Derived<Interval_Base, ITV>::value,
1563 template <
typename Partial_Function>
1728 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
1734 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
1738 template <
typename Other_ITV>
1744 friend std::ostream&
1745 Parma_Polyhedra_Library
1746 ::IO_Operators::operator<<<>(std::ostream& s,
const Box<ITV>& box);
1748 template <
typename Specialization,
typename Temp,
typename To,
typename I>
1749 friend bool Parma_Polyhedra_Library
1753 Temp& tmp0, Temp& tmp1, Temp& tmp2);
1767 #define PPL_IN_Box_CLASS
1768 #include "Box_Status_idefs.hh"
1769 #undef PPL_IN_Box_CLASS
1814 Coefficient_traits::const_reference numer,
1815 Coefficient_traits::const_reference denom);
1823 Coefficient_traits::const_reference numer,
1824 Coefficient_traits::const_reference denom);
2169 Box& limiting_box)
const;
2174 const Box& y)
const;
2195 const char* le_name,
2198 template <
typename C>
2200 const char* lf_name,
2214 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
2236 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
2237 template <
typename ITV>
2241 Coefficient_traits::const_reference numer,
2242 Coefficient_traits::const_reference denom
2249 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
2270 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
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)
Congruence_System minimized_congruences() const
Returns a minimized system of congruences approximating *this.
void m_swap(Box &y)
Swaps *this with y (*this and y can be dimension-incompatible).
bool operator!=(const Box< ITV > &x, const Box< ITV > &y)
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.
void propagate_constraints(const Constraint_System &cs, dimension_type max_iterations=0)
Use the constraints in cs for constraint propagation on *this.
dimension_type space_dimension() const
Returns the dimension of the vector space enclosing *this.
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.
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.
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...
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.
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).
void unconstrain(Variable var)
Computes the cylindrification of *this with respect to space dimension var, assigning the result to *...
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.
void refine_with_constraints(const Constraint_System &cs)
Use the constraints in cs to refine *this.
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.
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.
A dimension of the vector space.
Bounded_Integer_Type_Overflow
const ITV & operator[](dimension_type k) const
Returns a reference the interval that bounds the box on the k-th space dimension. ...
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).
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.
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.
void propagate_constraint(const Constraint &c)
Use the constraint c for constraint propagation on *this.
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.
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.
dimension_type affine_dimension() const
Returns , if *this is empty; otherwise, returns the affine dimension of *this.
void reset_empty_up_to_date()
Invalidates empty flag of *this.
Bounded_Integer_Type_Width
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.
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...
Sequence seq
A sequence of intervals, one for each dimension of the vector space.
static dimension_type max_space_dimension()
Returns the maximum space dimension that a Box can handle.
static void throw_invalid_argument(const char *method, const char *reason)
A not necessarily closed, iso-oriented hyperrectangle.
static I_Result refine_interval_no_check(ITV &itv, Constraint::Type type, Coefficient_traits::const_reference numer, Coefficient_traits::const_reference denom)
WRITE ME.
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.
static bool can_recycle_constraint_systems()
Returns false indicating that this domain does not recycle constraints.
bool bounds_from_above(const Linear_Expression &expr) const
Returns true if and only if expr is bounded from above in *this.
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.
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.
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...
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.
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.
void add_congruence(const Congruence &cg)
Adds to *this a constraint equivalent to the congruence cg.
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.
void refine_with_congruences(const Congruence_System &cgs)
Use the congruences in cgs to refine *this.
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.
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.
bool strictly_contains(const Box &y) const
Returns true if and only if *this strictly contains y.
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.
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.
void add_congruences(const Congruence_System &cgs)
Adds to *this constraints equivalent to the congruences in cgs.
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.
The relation between a polyhedron and a generator.
Bounded_Integer_Type_Representation
void set_interval(Variable var, const ITV &i)
Sets to i the interval that bounds var.
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.
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.
void refine_with_congruence(const Congruence &cg)
Use the congruence cg to refine *this.