24 #include "ppl-config.h"
30 namespace Implementation {
32 namespace Termination {
41 i_end = cs_in.
end(); i != i_end; ++i) {
74 i_end = ph_cs.
end(); i != i_end; ++i) {
146 output_function_MS_n = n;
147 output_function_MS_m = m;
149 std::cout <<
"*** cs ***" << std::endl;
150 output_function_MS_which = 0;
151 using namespace IO_Operators;
152 std::cout << cs << std::endl;
156 const dimension_type z_begin = y_begin + ((&cs_out1 == &cs_out2) ? m : 0);
163 std::vector<Linear_Expression> y_les(2*n, y_le);
164 std::vector<Linear_Expression> z_les(2*n + 1, z_le);
169 cs_end = cs.
end(); i != cs_end; ++i) {
174 cs_out1.insert(v_y >= 0);
186 Coefficient_traits::const_reference a_i_j = *j;
199 cs_out1.insert(y_le >= 1);
200 cs_out2.
insert(z_le >= 0);
203 cs_out1.insert(y_les[j] ==
Variable(j-n));
208 cs_out1.insert(y_les[j] == -
Variable(j));
209 cs_out2.
insert(z_les[j] == 0);
214 if (&cs_out1 == &cs_out2) {
215 std::cout <<
"*** cs_mip ***" << std::endl;
216 output_function_MS_which = 3;
217 using namespace IO_Operators;
218 std::cout << cs_mip << std::endl;
221 std::cout <<
"*** cs_out1 ***" << std::endl;
222 output_function_MS_which = 1;
223 using namespace IO_Operators;
224 std::cout << cs_out1 << std::endl;
226 std::cout <<
"*** cs_out2 ***" << std::endl;
227 output_function_MS_which = 2;
228 using namespace IO_Operators;
229 std::cout << cs_out2 << std::endl;
363 std::vector<Linear_Expression> les_eq(2*n, le_out);
367 cs_before_end = cs_before.
end();
374 j = e_i.
begin(), j_end = e_i.
end(); j != j_end; ++j) {
375 Coefficient_traits::const_reference A_ij_B = *j;
392 cs_after_end = cs_after.
end();
399 j_end = e_i.
end(); j != j_end; ++j) {
400 Coefficient_traits::const_reference A_ij_C = *j;
409 Coefficient_traits::const_reference Ap_ij_C = *j;
426 cs_out.
insert(les_eq[j] == 0);
442 std::vector<Linear_Expression> les_eq(3*n, le_out);
448 const Variable lambda1_i(row_index);
449 const Variable lambda2_i(m + row_index);
452 Coefficient_traits::const_reference Ap_ij = *j;
461 j_end = e_i.
end(); j != j_end; ++j) {
462 Coefficient_traits::const_reference A_ij = *j;
483 cs_out.
insert(les_eq[j] == 0);
532 output_function_MS_n = n;
535 std::cout <<
"*** ph1 projected ***" << std::endl;
536 output_function_MS_which = 4;
537 using namespace IO_Operators;
540 std::cout <<
"*** ph2 projected ***" << std::endl;
547 std::cout <<
"*** intersection ***" << std::endl;
548 using namespace IO_Operators;
577 output_function_MS_n = n;
580 std::cout <<
"*** ph1 projected ***" << std::endl;
581 output_function_MS_which = 4;
582 using namespace IO_Operators;
585 std::cout <<
"*** ph2 projected ***" << std::endl;
591 decreasing_mu_space.
m_swap(ph1);
592 bounded_mu_space.
m_swap(ph2);
604 cs_mip.insert(le_ineq <= -1);
606 const MIP_Problem mip(cs_mip.space_dimension(), cs_mip);
625 std::cout <<
"*** cs_mip ***" << std::endl;
626 using namespace IO_Operators;
627 std::cout << cs_mip << std::endl;
628 std::cout <<
"*** le_ineq ***" << std::endl;
629 std::cout << le_ineq << std::endl;
635 cs_mip.
insert(le_ineq <= -1);
691 std::cout <<
"*** cs_mip ***" << std::endl;
692 using namespace IO_Operators;
693 std::cout << cs_mip << std::endl;
694 std::cout <<
"*** le_ineq ***" << std::endl;
695 std::cout << le_ineq << std::endl;
701 cs_mip.
insert(le_ineq <= -1);
704 if (!mip.is_satisfiable()) {
708 const Generator& fp = mip.feasible_point();
719 cs_after_end = cs_after.
end();
722 Coefficient_traits::const_reference
747 std::cout <<
"*** cs_mip ***" << std::endl;
748 using namespace IO_Operators;
749 std::cout << cs_mip << std::endl;
750 std::cout <<
"*** le_ineq ***" << std::endl;
751 std::cout << le_ineq << std::endl;
755 cs_mip.
insert(le_ineq <= -1);
765 le.set_space_dimension(1 + n);
772 Coefficient_traits::const_reference fp_i = fp.
coefficient(lambda_2);
774 le.linear_combine(i->expr, 1, -fp_i, 1, n + 1);
800 std::cout <<
"*** cs_eqs ***" << std::endl;
801 using namespace IO_Operators;
802 std::cout << cs_eqs << std::endl;
803 std::cout <<
"*** le_ineq ***" << std::endl;
804 std::cout << le_ineq << std::endl;
814 std::cout <<
"*** ph ***" << std::endl;
815 std::cout << ph << std::endl;
826 if (gs_in_it == gs_in_end) {
831 for ( ; gs_in_it != gs_in_end; ++gs_in_it) {
838 cs_after_end = cs_after.
end();
841 Coefficient_traits::const_reference
902 std::cout <<
"*** ph ***" << std::endl;
903 std::cout << ph << std::endl;
911 if (gs_in_it == gs_in_end) {
917 for ( ; gs_in_it != gs_in_end; ++gs_in_it) {
925 const Variable lambda2_i(row_index);
926 Coefficient_traits::const_reference g_i = g.
coefficient(lambda2_i);
void add_space_dimensions_and_embed(dimension_type m)
Adds m new space dimensions and embeds the old polyhedron in the new vector space.
bool is_satisfiable() const
Checks satisfiability of *this.
bool one_affine_ranking_function_PR_original(const Constraint_System &cs, Generator &mu)
An iterator over a system of constraints.
The empty element, i.e., the empty set.
A linear equality or inequality.
bool is_equality() const
Returns true if and only if *this is an equality constraint.
bool termination_test_MS(const Constraint_System &cs)
void set_space_dimension(dimension_type n)
Sets the dimension of the vector space enclosing *this to n .
An iterator over a system of generators.
size_t dimension_type
An unsigned integral type for representing space dimensions.
An std::set of variables' indexes.
A line, ray, point or closure point.
void assign_all_inequalities_approximation(const Constraint_System &cs_in, Constraint_System &cs_out)
static void all_affine_ranking_functions_PR(const Constraint_System &cs_before, const Constraint_System &cs_after, NNC_Polyhedron &mu_space)
void add_constraint(const Constraint &c)
Adds a copy of constraint c to the system of constraints of *this (without minimizing the result)...
static output_function_type * get_output_function()
Returns the pointer to the current output function.
void add_mul_assign(GMP_Integer &x, const GMP_Integer &y, const GMP_Integer &z)
static bool one_affine_ranking_function_PR(const Constraint_System &cs_before, const Constraint_System &cs_after, Generator &mu)
void insert(const Constraint &c)
Inserts in *this a copy of the constraint c, increasing the number of space dimensions if needed...
dimension_type num_constraints(const Constraint_System &cs)
Helper returning number of constraints in system.
expr_type expression() const
Partial read access to the (adapted) internal expression.
void remove_space_dimensions(const Variables_Set &vars)
Removes all the specified dimensions from the vector space.
const_iterator begin() const
Returns the const_iterator pointing to the first constraint, if *this is not empty; otherwise...
static void all_affine_ranking_functions_PR_original(const Constraint_System &cs, NNC_Polyhedron &mu_space)
void output_function_type(std::ostream &s, const Variable v)
Type of output functions.
const_iterator lower_bound(Variable v) const
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.
bool one_affine_ranking_function_MS(const Constraint_System &cs, Generator &mu)
void all_affine_quasi_ranking_functions_MS(const Constraint_System &cs, C_Polyhedron &decreasing_mu_space, C_Polyhedron &bounded_mu_space)
bool one_affine_ranking_function_PR(const Constraint_System &cs_before, const Constraint_System &cs_after, Generator &mu)
void all_affine_ranking_functions_PR_original(const Constraint_System &cs, NNC_Polyhedron &mu_space)
void remove_higher_space_dimensions(dimension_type new_dimension)
Removes the higher dimensions of the vector space so that the resulting space will have dimension new...
bool termination_test_PR(const Constraint_System &cs_before, const Constraint_System &cs_after)
void fill_constraint_system_PR_original(const Constraint_System &cs, Constraint_System &cs_out, Linear_Expression &le_out)
void all_affine_ranking_functions_MS(const Constraint_System &cs, C_Polyhedron &mu_space)
dimension_type space_dimension() const
Returns the dimension of the vector space enclosing *this.
Type type() const
Returns the generator type of *this.
void fill_constraint_systems_MS(const Constraint_System &cs, Constraint_System &cs_out1, Constraint_System &cs_out2)
Fill the constraint system(s) for the application of the Mesnard and Serebrenik improved termination ...
void fill_constraint_system_PR(const Constraint_System &cs_before, const Constraint_System &cs_after, Constraint_System &cs_out, Linear_Expression &le_out)
Fill the constraint system(s) for the application of the Podelski and Rybalchenko improved terminatio...
const_iterator end() const
Returns the past-the-end const_iterator.
A Mixed Integer (linear) Programming problem.
const_iterator end() const
Iterator pointing after the last nonzero variable coefficient.
const Generator_System & generators() const
Returns the system of generators.
A not necessarily closed convex polyhedron.
void intersection_assign(const Polyhedron &y)
Assigns to *this the intersection of *this and y.
A closed convex polyhedron.
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.
bool has_equalities() const
Returns true if and only if *this contains one or more equality constraints.
void all_affine_ranking_functions_PR(const Constraint_System &cs_before, const Constraint_System &cs_after, NNC_Polyhedron &mu_space)
The entire library is confined to this namespace.
const Generator & feasible_point() const
Returns a feasible point for *this, if it exists.
const_iterator end() const
Returns the past-the-end const_iterator.
const_iterator begin() const
Returns the const_iterator pointing to the first generator, if *this is not empty; otherwise...
base_type::const_iterator const_iterator
The type of const iterators on coefficients.
Coefficient_traits::const_reference coefficient(Variable v) const
Returns the coefficient of v in *this.
void sub_mul_assign(GMP_Integer &x, const GMP_Integer &y, const GMP_Integer &z)
Coefficient_traits::const_reference divisor() const
If *this is either a point or a closure point, returns its divisor.
void linear_combine(const Linear_Expression &y, Variable v)
Coefficient_traits::const_reference inhomogeneous_term() const
Returns the inhomogeneous term of *this.
static void set_output_function(output_function_type *p)
Sets the output function to be used for printing Variable objects.
expr_type expression() const
Partial read access to the (adapted) internal expression.
const_iterator begin() const
Iterator pointing to the first nonzero variable coefficient.
void insert(const Generator &g)
Inserts in *this a copy of the generator g, increasing the number of space dimensions if needed...
const Constraint_System & minimized_constraints() const
Returns the system of constraints, with no redundant constraint.
An adapter for Linear_Expression that maybe hides the last coefficient.
void m_swap(Polyhedron &y)
Swaps *this with polyhedron y. (*this and y can be dimension-incompatible.)
bool le(Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
bool termination_test_PR_original(const Constraint_System &cs)
Coefficient_traits::const_reference inhomogeneous_term() const
Returns the inhomogeneous term of *this.
static bool one_affine_ranking_function_PR_original(const Constraint_System &cs, Generator &mu)
bool has_strict_inequalities() const
Returns true if and only if *this contains one or more strict inequality constraints.