25 #include "ppl-config.h"
31 #include "assertions.hh"
43 PPL_ASSERT(topology() == y.
topology()
44 && topology() == cs_selection.
topology()
46 PPL_ASSERT(!marked_empty()
47 && !has_pending_constraints()
48 && generators_are_up_to_date());
60 if (gen_sys.satisfied_by_all_generators(c)) {
73 PPL_ASSERT(topology() == y.
topology()
74 && topology() == cs_selected.
topology()
75 && topology() == cs_not_selected.
topology());
77 PPL_ASSERT(!marked_empty()
78 && !has_pending_generators()
79 && constraints_are_up_to_date());
106 if (y_cs[i].is_tautological()) {
109 swap(tmp_sat_g[i], tmp_sat_g[num_rows]);
136 for (
dimension_type i = 0, end = con_sys.num_rows(); i < end; ++i) {
145 PPL_ASSERT(sp_sgn >= 0
146 || (!is_necessarily_closed()
159 cs_not_selected.
insert(ci);
177 PPL_EXPECT_HEAVY(copy_contains(x, y));
232 if (tp != 0 && *tp > 0) {
243 PPL_ASSERT_HEAVY(x.
OK(
true));
284 if (tp != 0 && *tp > 0) {
295 PPL_ASSERT_HEAVY(x.
OK(
true));
307 if (cs_num_rows == 0) {
315 throw_topology_incompatible(
"limited_H79_extrapolation_assign(y, cs)",
319 throw_topology_incompatible(
"limited_H79_extrapolation_assign(y, cs)",
324 throw_topology_incompatible(
"limited_H79_extrapolation_assign(y, cs)",
329 throw_dimension_incompatible(
"limited_H79_extrapolation_assign(y, cs)",
335 throw_dimension_incompatible(
"limited_H79_extrapolation_assign(y, cs)",
339 PPL_EXPECT_HEAVY(copy_contains(x, y));
382 PPL_ASSERT_HEAVY(OK());
392 limited_H79_extrapolation_assign(y, cs, tp);
394 add_recycled_constraints(x_box_cs);
426 if (x_minus_H79_cs_num_rows <= 1) {
443 bool lies_on_the_boundary_of_H79 =
false;
448 lies_on_the_boundary_of_H79 =
true;
452 if (lies_on_the_boundary_of_H79) {
458 combining_cs.
clear();
467 if (combining_cs_num_rows > 0) {
468 if (combining_cs_num_rows == 1) {
470 new_cs.
insert(combining_cs[0]);
474 bool strict_inequality =
false;
476 if (combining_cs[h].is_strict_inequality()) {
477 strict_inequality =
true;
483 if (strict_inequality) {
497 bool improves_upon_H79 =
false;
501 improves_upon_H79 =
true;
505 if (!improves_upon_H79) {
521 PPL_ASSERT_HEAVY(x.
OK(
true));
571 PPL_ASSERT(
compare(g1, g2) != 0);
574 candidate_rays.insert(ray_from_g2_to_g1);
592 PPL_ASSERT_HEAVY(x.
OK(
true));
611 x_k != x_end; ++x_k) {
612 const Variable k_var = x_k.variable();
618 while (y_k != y_end && y_k.
variable().
id() < k) {
634 for ( ; x_h != x_end; ++x_h) {
640 while (y_h != y_end && y_h.
variable().
id() < h) {
646 if (y_h != y_end && y_h.
variable().
id() == h) {
647 tmp = (*x_k) * (*y_h);
653 if (y_k_var.
id() == k) {
659 const int clockwise =
sgn(tmp);
660 const int first_or_third_quadrant =
sgn(*x_k) *
sgn(*x_h);
661 switch (clockwise * first_or_third_quadrant) {
664 considered[k] =
true;
668 considered[h] =
true;
710 modify_according_to_evolution(new_ray.
expr, x_g.
expr, y_g.
expr);
711 PPL_ASSERT(new_ray.
OK());
712 candidate_rays.
insert(new_ray);
734 PPL_ASSERT_HEAVY(x.
OK(
true));
748 throw_topology_incompatible(
"BHRZ03_widening_assign(y)",
"y", y);
752 throw_dimension_incompatible(
"BHRZ03_widening_assign(y)",
"y", y);
756 PPL_EXPECT_HEAVY(copy_contains(x, y));
779 PPL_ASSERT_HEAVY(OK());
786 if (tp != 0 && *tp > 0) {
788 PPL_ASSERT_HEAVY(OK());
806 H79.add_recycled_constraints(H79_cs);
816 PPL_ASSERT_HEAVY(H79.OK() && x.
OK() && y.
OK());
822 PPL_ASSERT_HEAVY(H79.OK() && x.
OK() && y.
OK());
828 PPL_ASSERT_HEAVY(H79.OK() && x.
OK() && y.
OK());
832 PPL_ASSERT_HEAVY(x.
OK(
true));
846 if (cs_num_rows == 0) {
854 throw_topology_incompatible(
"limited_BHRZ03_extrapolation_assign(y, cs)",
858 throw_topology_incompatible(
"limited_BHRZ03_extrapolation_assign(y, cs)",
863 throw_topology_incompatible(
"limited_BHRZ03_extrapolation_assign(y, cs)",
868 throw_dimension_incompatible(
"limited_BHRZ03_extrapolation_assign(y, cs)",
874 throw_dimension_incompatible(
"limited_BHRZ03_extrapolation_assign(y, cs)",
879 PPL_EXPECT_HEAVY(copy_contains(x, y));
923 PPL_ASSERT_HEAVY(OK());
934 limited_BHRZ03_extrapolation_assign(y, cs, tp);
936 add_recycled_constraints(x_box_cs);
void linear_combine(const Generator &y, dimension_type i)
Linearly combines *this with y so that i-th coefficient is 0.
bool has_pending_constraints() const
Returns true if there are pending constraints.
bool constraints_are_minimized() const
Returns true if the system of constraints is minimized.
bool marked_empty() const
Returns true if the polyhedron is known to be empty.
A linear equality or inequality.
const_iterator begin() const
void swap(CO_Tree &x, CO_Tree &y)
bool strongly_minimize_constraints() const
Applies strong minimization to the constraints of an NNC polyhedron.
void select_CH78_constraints(const Polyhedron &y, Constraint_System &cs_selection) const
Copies to cs_selection the constraints of y corresponding to the definition of the CH78-widening of *...
size_t dimension_type
An unsigned integral type for representing space dimensions.
void update_constraints() const
Updates constraints starting from generators and minimizes them.
Generator_System gen_sys
The system of generators.
A line, ray, point or closure point.
Variable variable() const
Returns the variable of the coefficient pointed to by *this.
Linear_Expression expr
The linear expression encoding *this.
bool generators_are_minimized() const
Returns true if the system of generators is minimized.
bool is_empty() const
Returns true if and only if *this is an empty polyhedron.
#define PPL_DIRTY_TEMP_COEFFICIENT(id)
Declare a local variable named id, of type Coefficient, and containing an unknown initial value...
void insert(const Constraint &c)
Inserts in *this a copy of the constraint c, increasing the number of space dimensions if needed...
void BHRZ03_widening_assign(const Polyhedron &y, unsigned *tp=0)
Assigns to *this the result of computing the BHRZ03-widening between *this and y. ...
void set(unsigned long k)
Sets the bit in position k.
bool update_generators() const
Updates generators starting from constraints and minimizes them.
bool sat_g_is_up_to_date() const
Returns true if the saturation matrix sat_g is up-to-date.
void throw_dimension_incompatible(const char *method, const char *other_name, dimension_type other_dim) const
Topology topology() const
Returns the system topology.
void clear()
Removes all the constraints from the constraint system and sets its space dimension to 0...
dimension_type space_dimension() const
Returns the dimension of the vector space enclosing *this.
void H79_widening_assign(const Polyhedron &y, unsigned *tp=0)
Assigns to *this the result of computing the H79_widening between *this and y.
void clear(unsigned long k)
Clears the bit in position k.
void set_coefficient(Variable v, Coefficient_traits::const_reference n)
Sets the coefficient of v in *this to n.
A row in a matrix of bits.
void limited_BHRZ03_extrapolation_assign(const Polyhedron &y, const Constraint_System &cs, unsigned *tp=0)
Assigns to *this the result of computing the limited extrapolation between *this and y using the BHRZ...
void add_recycled_constraints(Constraint_System &cs)
Adds the constraints in cs to the system of constraints of *this (without minimizing the result)...
dimension_type id() const
Returns the index of the Cartesian axis associated to the variable.
A dimension of the vector space.
bool is_strict_inequality() const
Returns true if and only if *this is a strict inequality constraint.
The base class for convex polyhedra.
void limited_H79_extrapolation_assign(const Polyhedron &y, const Constraint_System &cs, unsigned *tp=0)
Assigns to *this the result of computing the limited extrapolation between *this and y using the H79-...
static void modify_according_to_evolution(Linear_Expression &ray, const Linear_Expression &x, const Linear_Expression &y)
void update_sat_g() const
Updates sat_g using the updated constraints and generators.
bool is_inequality() const
Returns true if and only if *this is an inequality constraint (either strict or non-strict).
bool satisfied_by_all_generators(const Constraint &c) const
Returns true if all the generators satisfy c.
void add_recycled_generators(Generator_System &gs)
Adds the generators in gs to the system of generators of *this (without minimizing the result)...
Topology topology() const
Returns the topological kind of the polyhedron.
bool generators_are_up_to_date() const
Returns true if the system of generators is up-to-date.
Constraint_System con_sys
The system of constraints.
dimension_type num_equalities() const
Returns the number of equality constraints.
dimension_type space_dimension() const
Returns the dimension of the vector space enclosing *this.
bool constraints_are_up_to_date() const
Returns true if the system of constraints is up-to-date.
bool OK() const
Checks if all the invariants are satisfied.
void throw_topology_incompatible(const char *method, const char *ph_name, const Polyhedron &ph) const
Bit_Matrix sat_g
The saturation matrix having generators on its columns.
void intersection_assign(const Polyhedron &y)
Assigns to *this the intersection of *this and y.
A not necessarily closed, iso-oriented hyperrectangle.
bool BHRZ03_combining_constraints(const Polyhedron &y, const BHRZ03_Certificate &y_cert, const Polyhedron &H79, const Constraint_System &x_minus_H79_cs)
bool all_homogeneous_terms_are_zero() const
Returns true if and only if all the homogeneous terms of *this are .
bool is_point() const
Returns true if and only if *this is a point.
int compare(const Linear_Expression &x, const Linear_Expression &y)
void process_pending_generators() const
Processes the pending generators and obtains a minimized polyhedron.
void remove_trailing_rows(dimension_type n)
Removes the last n rows.
The universe element, i.e., the whole vector space.
bool BHRZ03_evolving_rays(const Polyhedron &y, const BHRZ03_Certificate &y_cert, const Polyhedron &H79)
bool BHRZ03_evolving_points(const Polyhedron &y, const BHRZ03_Certificate &y_cert, const Polyhedron &H79)
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.
Coefficient_traits::const_reference Coefficient_zero()
Returns a const reference to a Coefficient with value 0.
bool is_ray() const
Returns true if and only if *this is a ray.
The convergence certificate for the BHRZ03 widening operator.
The entire library is confined to this namespace.
dimension_type space_dim
The number of dimensions of the enclosing vector space.
bool is_stabilizing(const Polyhedron &ph) const
Returns true if and only if the certificate for polyhedron ph is strictly smaller than *this...
bool contains(const Polyhedron &y) const
Returns true if and only if *this contains y.
bool is_necessarily_closed() const
Returns true if and only if the polyhedron is necessarily closed.
Constraint_System constraints() const
Returns a system of constraints defining *this.
void swap(Affine_Space &x, Affine_Space &y)
Swaps x with y.
void select_H79_constraints(const Polyhedron &y, Constraint_System &cs_selected, Constraint_System &cs_not_selected) const
Splits the constraints of `x' into two subsets, depending on whether or not they are selected to comp...
bool OK(bool check_not_empty=false) const
Checks if all the invariants are satisfied.
bool process_pending_constraints() const
Processes the pending constraints and obtains a minimized polyhedron.
const_iterator end() const
void sort_rows()
Sorts the rows and removes duplicates.
int sgn(Boundary_Type type, const T &x, const Info &info)
void sub_mul_assign(GMP_Integer &x, const GMP_Integer &y, const GMP_Integer &z)
bool sorted_contains(const Bit_Row &row) const
Looks for row in *this, which is assumed to be sorted.
static int sign(const Linear_Expression &x, const Linear_Expression &y)
Returns the sign of the scalar product between x and y.
bool has_pending_generators() const
Returns true if there are pending generators.
void bounded_BHRZ03_extrapolation_assign(const Polyhedron &y, const Constraint_System &cs, unsigned *tp=0)
Assigns to *this the result of computing the bounded extrapolation between *this and y using the BHRZ...
dimension_type num_rows() const
void insert(const Generator &g)
Inserts in *this a copy of the generator g, increasing the number of space dimensions if needed...
void bounded_H79_extrapolation_assign(const Polyhedron &y, const Constraint_System &cs, unsigned *tp=0)
Assigns to *this the result of computing the bounded extrapolation between *this and y using the H79-...
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.
dimension_type num_rows() const
static Poly_Con_Relation strictly_intersects()
The polyhedron intersects the set of points satisfying the constraint, but it is not included in it...
static Poly_Gen_Relation nothing()
The assertion that says nothing.
void m_swap(Polyhedron &y)
Swaps *this with polyhedron y. (*this and y can be dimension-incompatible.)
Topology
Kinds of polyhedra domains.
Poly_Con_Relation relation_with(const Constraint &c) const
Returns the relations holding between the polyhedron *this and the constraint c.
The relation between a polyhedron and a constraint.
bool has_something_pending() const
Returns true if there are either pending constraints or pending generators.
bool is_closure_point() const
Returns true if and only if *this is a closure point.
bool has_strict_inequalities() const
Returns true if and only if *this contains one or more strict inequality constraints.