A linear equality or inequality. More...
#include <Constraint.defs.hh>


Public Types | |
| enum | Type { EQUALITY, NONSTRICT_INEQUALITY, STRICT_INEQUALITY } |
The constraint type. More... | |
Public Member Functions | |
| Constraint (const Constraint &c) | |
| Ordinary copy constructor. | |
| Constraint (const Congruence &cg) | |
Copy-constructs from equality congruence cg. | |
| ~Constraint () | |
| Destructor. | |
| Constraint & | operator= (const Constraint &c) |
| Assignment operator. | |
| dimension_type | space_dimension () const |
Returns the dimension of the vector space enclosing *this. | |
| Type | type () const |
Returns the constraint type of *this. | |
| bool | is_equality () const |
Returns true if and only if *this is an equality constraint. | |
| bool | is_inequality () const |
Returns true if and only if *this is an inequality constraint (either strict or non-strict). | |
| bool | is_nonstrict_inequality () const |
Returns true if and only if *this is a non-strict inequality constraint. | |
| bool | is_strict_inequality () const |
Returns true if and only if *this is a strict inequality constraint. | |
| Coefficient_traits::const_reference | coefficient (Variable v) const |
Returns the coefficient of v in *this. | |
| Coefficient_traits::const_reference | inhomogeneous_term () const |
Returns the inhomogeneous term of *this. | |
| memory_size_type | total_memory_in_bytes () const |
Returns a lower bound to the total size in bytes of the memory occupied by *this. | |
| memory_size_type | external_memory_in_bytes () const |
Returns the size in bytes of the memory managed by *this. | |
| bool | is_tautological () const |
Returns true if and only if *this is a tautology (i.e., an always true constraint). | |
| bool | is_inconsistent () const |
Returns true if and only if *this is inconsistent (i.e., an always false constraint). | |
| bool | is_equivalent_to (const Constraint &y) const |
Returns true if and only if *this and y are equivalent constraints. | |
| void | ascii_dump () const |
Writes to std::cerr an ASCII representation of *this. | |
| void | ascii_dump (std::ostream &s) const |
Writes to s an ASCII representation of *this. | |
| void | print () const |
Prints *this to std::cerr using operator<<. | |
| bool | ascii_load (std::istream &s) |
Loads from s an ASCII representation (as produced by ascii_dump(std::ostream&) const) and sets *this accordingly. Returns true if successful, false otherwise. | |
| bool | OK () const |
| Checks if all the invariants are satisfied. | |
| void | swap (Constraint &y) |
Swaps *this with y. | |
Static Public Member Functions | |
| static dimension_type | max_space_dimension () |
| Returns the maximum space dimension a Constraint can handle. | |
| static void | initialize () |
| Initializes the class. | |
| static void | finalize () |
| Finalizes the class. | |
| static const Constraint & | zero_dim_false () |
The unsatisfiable (zero-dimension space) constraint . | |
| static const Constraint & | zero_dim_positivity () |
The true (zero-dimension space) constraint , also known as positivity constraint. | |
Private Member Functions | |
| friend | Parma_Polyhedra_Library::Linear_Expression::Linear_Expression (const Constraint &c) |
| Constraint () | |
| Default constructor: private and not implemented. | |
| Constraint (Linear_Expression &e, Type type, Topology topology) | |
Builds a constraint of type type and topology topology, stealing the coefficients from e. | |
| Constraint (const Congruence &cg, dimension_type sz, dimension_type capacity) | |
| Constructs from a congruence, with specified size and capacity. | |
| void | throw_invalid_argument (const char *method, const char *message) const |
Throws a std::invalid_argument exception containing error message message. | |
| void | throw_dimension_incompatible (const char *method, const char *name_var, Variable v) const |
Throws a std::invalid_argument exception containing the appropriate error message. | |
| Constraint (const Constraint &c, dimension_type sz) | |
| Copy constructor with given size. | |
| void | set_is_equality () |
Sets the constraint type to EQUALITY. | |
| void | set_is_inequality () |
| Sets the constraint to be an inequality. | |
Static Private Member Functions | |
| static Constraint | construct_epsilon_geq_zero () |
Builds a new copy of the zero-dimension space constraint (used to implement NNC polyhedra). | |
| static const Constraint & | epsilon_geq_zero () |
Returns the zero-dimension space constraint . | |
| static const Constraint & | epsilon_leq_one () |
The zero-dimension space constraint (used to implement NNC polyhedra). | |
Static Private Attributes | |
| static const Constraint * | zero_dim_false_p = 0 |
Holds (between class initialization and finalization) a pointer to the unsatisfiable (zero-dimension space) constraint . | |
| static const Constraint * | zero_dim_positivity_p = 0 |
Holds (between class initialization and finalization) a pointer to the true (zero-dimension space) constraint , also known as positivity constraint. | |
| static const Constraint * | epsilon_geq_zero_p = 0 |
Holds (between class initialization and finalization) a pointer to the zero-dimension space constraint . | |
| static const Constraint * | epsilon_leq_one_p = 0 |
Holds (between class initialization and finalization) a pointer to the zero-dimension space constraint (used to implement NNC polyhedra). | |
Friends | |
| class | Parma_Polyhedra_Library::Congruence |
| class | Parma_Polyhedra_Library::Scalar_Products |
| class | Parma_Polyhedra_Library::Topology_Adjusted_Scalar_Product_Sign |
| class | Parma_Polyhedra_Library::Constraint_System |
| class | Parma_Polyhedra_Library::Constraint_System::const_iterator |
| class | Parma_Polyhedra_Library::Polyhedron |
| Constraint | operator== (const Linear_Expression &e1, const Linear_Expression &e2) |
Returns the constraint e1 = e2. | |
| Constraint | operator== (Variable v1, Variable v2) |
Returns the constraint v1 = v2. | |
| Constraint | operator== (const Linear_Expression &e, Coefficient_traits::const_reference n) |
Returns the constraint e = n. | |
| Constraint | operator== (Coefficient_traits::const_reference n, const Linear_Expression &e) |
Returns the constraint n = e. | |
| Constraint | operator>= (const Linear_Expression &e1, const Linear_Expression &e2) |
Returns the constraint e1 >= e2. | |
| Constraint | operator>= (Variable v1, Variable v2) |
Returns the constraint v1 >= v2. | |
| Constraint | operator>= (const Linear_Expression &e, Coefficient_traits::const_reference n) |
Returns the constraint e >= n. | |
| Constraint | operator>= (Coefficient_traits::const_reference n, const Linear_Expression &e) |
Returns the constraint n >= e. | |
| Constraint | operator<= (const Linear_Expression &e1, const Linear_Expression &e2) |
Returns the constraint e1 <= e2. | |
| Constraint | operator<= (const Linear_Expression &e, Coefficient_traits::const_reference n) |
Returns the constraint e <= n. | |
| Constraint | operator<= (Coefficient_traits::const_reference n, const Linear_Expression &e) |
Returns the constraint n <= e. | |
| Constraint | operator> (const Linear_Expression &e1, const Linear_Expression &e2) |
Returns the constraint e1 > e2. | |
| Constraint | operator> (Variable v1, Variable v2) |
Returns the constraint v1 > v2. | |
| Constraint | operator> (const Linear_Expression &e, Coefficient_traits::const_reference n) |
Returns the constraint e > n. | |
| Constraint | operator> (Coefficient_traits::const_reference n, const Linear_Expression &e) |
Returns the constraint n > e. | |
| Constraint | operator< (const Linear_Expression &e1, const Linear_Expression &e2) |
Returns the constraint e1 < e2. | |
| Constraint | operator< (const Linear_Expression &e, Coefficient_traits::const_reference n) |
Returns the constraint e < n. | |
| Constraint | operator< (Coefficient_traits::const_reference n, const Linear_Expression &e) |
Returns the constraint n < e. | |
Related Functions | |
(Note that these are not member functions.) | |
| bool | operator== (const Constraint &x, const Constraint &y) |
Returns true if and only if x is equivalent to y. | |
| bool | operator!= (const Constraint &x, const Constraint &y) |
Returns true if and only if x is not equivalent to y. | |
| Constraint | operator<= (Variable v1, Variable v2) |
Returns the constraint v1 <= v2. | |
| Constraint | operator< (Variable v1, Variable v2) |
Returns the constraint v1 < v2. | |
| void | swap (Parma_Polyhedra_Library::Constraint &x, Parma_Polyhedra_Library::Constraint &y) |
Specializes std::swap. | |
| std::ostream & | operator<< (std::ostream &s, const Constraint &c) |
| Output operator. | |
| std::ostream & | operator<< (std::ostream &s, const Constraint::Type &t) |
| Output operator. | |
A linear equality or inequality.
An object of the class Constraint is either:
;
; or
;where
is the dimension of the space,
is the integer coefficient of variable
and
is the integer inhomogeneous term.
==), non-strict inequalities (>= and <=) and strict inequalities (< and >). The space dimension of a constraint is defined as the maximum space dimension of the arguments of its constructor.x, y and z are defined as follows: Variable x(0); Variable y(1); Variable z(2);
, having space dimension
: Constraint eq_c(3*x + 5*y - z == 0);
, having space dimension
: Constraint ineq_c(4*x >= 2*y - 13);
is obtained as follows: Constraint strict_ineq_c(4*x > 2*y - 13);
can be specified as follows: Constraint false_c = Constraint::zero_dim_false();
Constraint false_c1(Linear_Expression::zero() == 1); Constraint false_c2(Linear_Expression::zero() >= 1); Constraint false_c3(Linear_Expression::zero() > 0);
: Constraint false_c(0*z == 1);
), we construct a new constraint corresponding to its complement (thus, in this case we want to obtain the strict inequality constraint
). Constraint c1(x - 5*y + 3*z <= 4); cout << "Constraint c1: " << c1 << endl; if (c1.is_equality()) cout << "Constraint c1 is not an inequality." << endl; else { Linear_Expression e; for (dimension_type i = c1.space_dimension(); i-- > 0; ) e += c1.coefficient(Variable(i)) * Variable(i); e += c1.inhomogeneous_term(); Constraint c2 = c1.is_strict_inequality() ? (e <= 0) : (e < 0); cout << "Complement c2: " << c2 << endl; }
Constraint c1: -A + 5*B - 3*C >= -4 Complement c2: A - 5*B + 3*C > 4
Definition at line 261 of file Constraint.defs.hh.
The constraint type.
| EQUALITY |
The constraint is an equality. |
| NONSTRICT_INEQUALITY |
The constraint is a non-strict inequality. |
| STRICT_INEQUALITY |
The constraint is a strict inequality. |
Definition at line 286 of file Constraint.defs.hh.
00286 { 00288 EQUALITY, 00290 NONSTRICT_INEQUALITY, 00292 STRICT_INEQUALITY 00293 };
| Parma_Polyhedra_Library::Constraint::Constraint | ( | const Constraint & | c | ) | [inline] |
Ordinary copy constructor.
Definition at line 41 of file Constraint.inlines.hh.
00042 : Linear_Row(c) { 00043 }
| Parma_Polyhedra_Library::Constraint::Constraint | ( | const Congruence & | cg | ) | [explicit] |
Copy-constructs from equality congruence cg.
| std::invalid_argument | Thrown if cg is a proper congruence. |
Definition at line 62 of file Constraint.cc.
References Parma_Polyhedra_Library::Congruence::space_dimension(), and Parma_Polyhedra_Library::Linear_Row::strong_normalize().
00063 : Linear_Row(cg.is_equality() 00064 // Size includes extra column for the inhomogeneous term. 00065 ? cg.space_dimension() + 1 00066 : (throw_invalid_argument("Constraint(cg)", 00067 "congruence cg must be an equality."), 00068 0), 00069 // Capacity also includes a column for the epsilon coefficient. 00070 compute_capacity(cg.space_dimension() + 2, Row::max_size()), 00071 Flags(NECESSARILY_CLOSED, LINE_OR_EQUALITY)) { 00072 Constraint& c = *this; 00073 // Copy coefficients and inhomogeneous term. 00074 for (dimension_type i = cg.space_dimension() + 1; i-- > 0; ) 00075 c[i] = cg[i]; 00076 // Enforce normalization. 00077 strong_normalize(); 00078 }
| Parma_Polyhedra_Library::Constraint::~Constraint | ( | ) | [inline] |
| Parma_Polyhedra_Library::Constraint::Constraint | ( | ) | [private] |
Default constructor: private and not implemented.
Referenced by initialize().
| Parma_Polyhedra_Library::Constraint::Constraint | ( | Linear_Expression & | e, | |
| Type | type, | |||
| Topology | topology | |||
| ) | [inline, private] |
Builds a constraint of type type and topology topology, stealing the coefficients from e.
Definition at line 32 of file Constraint.inlines.hh.
References EQUALITY, Parma_Polyhedra_Library::Linear_Row::flags(), Parma_Polyhedra_Library::Linear_Row::LINE_OR_EQUALITY, Parma_Polyhedra_Library::NOT_NECESSARILY_CLOSED, Parma_Polyhedra_Library::Linear_Row::RAY_OR_POINT_OR_INEQUALITY, STRICT_INEQUALITY, and swap().
00032 { 00033 PPL_ASSERT(type != STRICT_INEQUALITY || topology == NOT_NECESSARILY_CLOSED); 00034 Linear_Row::swap(e); 00035 flags() = Flags(topology, (type == EQUALITY 00036 ? LINE_OR_EQUALITY 00037 : RAY_OR_POINT_OR_INEQUALITY)); 00038 }
| Parma_Polyhedra_Library::Constraint::Constraint | ( | const Congruence & | cg, | |
| dimension_type | sz, | |||
| dimension_type | capacity | |||
| ) | [private] |
Constructs from a congruence, with specified size and capacity.
Definition at line 80 of file Constraint.cc.
00083 : Linear_Row(cg.is_equality() 00084 ? sz 00085 : (throw_invalid_argument("Constraint(cg, sz, c)", 00086 "congruence cg must be an equality."), 00087 0), 00088 capacity, 00089 Flags(NECESSARILY_CLOSED, LINE_OR_EQUALITY)) { 00090 Constraint& c = *this; 00091 // Copy coefficients. 00092 PPL_ASSERT(sz > 0); 00093 while (sz-- > 0) 00094 c[sz] = cg[sz]; 00095 }
| Parma_Polyhedra_Library::Constraint::Constraint | ( | const Constraint & | c, | |
| dimension_type | sz | |||
| ) | [inline, private] |
Copy constructor with given size.
Definition at line 46 of file Constraint.inlines.hh.
00047 : Linear_Row(c, sz, sz) { 00048 }
| void Parma_Polyhedra_Library::Constraint::ascii_dump | ( | std::ostream & | s | ) | const [inline] |
Writes to s an ASCII representation of *this.
Reimplemented from Parma_Polyhedra_Library::Linear_Row.
Definition at line 353 of file Constraint.inlines.hh.
References ascii_dump().
00353 { 00354 Linear_Row::ascii_dump(s); 00355 }
| void Parma_Polyhedra_Library::Constraint::ascii_dump | ( | ) | const |
Writes to std::cerr an ASCII representation of *this.
Reimplemented from Parma_Polyhedra_Library::Linear_Row.
Referenced by ascii_dump().
| bool Parma_Polyhedra_Library::Constraint::ascii_load | ( | std::istream & | s | ) | [inline] |
Loads from s an ASCII representation (as produced by ascii_dump(std::ostream&) const) and sets *this accordingly. Returns true if successful, false otherwise.
Reimplemented from Parma_Polyhedra_Library::Linear_Row.
Definition at line 358 of file Constraint.inlines.hh.
Referenced by Parma_Polyhedra_Library::PIP_Problem::ascii_load(), and Parma_Polyhedra_Library::MIP_Problem::ascii_load().
00358 { 00359 return Linear_Row::ascii_load(s); 00360 }
| Coefficient_traits::const_reference Parma_Polyhedra_Library::Constraint::coefficient | ( | Variable | v | ) | const [inline] |
Returns the coefficient of v in *this.
| std::invalid_argument | thrown if the index of v is greater than or equal to the space dimension of *this. |
Definition at line 113 of file Constraint.inlines.hh.
References Parma_Polyhedra_Library::Variable::id(), space_dimension(), Parma_Polyhedra_Library::Variable::space_dimension(), and throw_dimension_incompatible().
Referenced by Parma_Polyhedra_Library::Box< ITV >::add_constraint_no_check(), Parma_Polyhedra_Library::Polyhedron::contains_integer_point(), Parma_Polyhedra_Library::Polyhedron::expand_space_dimension(), Parma_Polyhedra_Library::BD_Shape< T >::extract_bounded_difference(), Parma_Polyhedra_Library::Box< ITV >::extract_interval_constraint(), Parma_Polyhedra_Library::Octagonal_Shape< T >::extract_octagonal_difference(), Parma_Polyhedra_Library::Box< ITV >::get_limiting_box(), operator<<(), Parma_Polyhedra_Library::MIP_Problem::parse_constraints(), Parma_Polyhedra_Library::MIP_Problem::process_pending_constraints(), Parma_Polyhedra_Library::Box< ITV >::propagate_constraint_no_check(), Parma_Polyhedra_Library::Box< ITV >::refine_no_check(), Parma_Polyhedra_Library::Octagonal_Shape< T >::relation_with(), Parma_Polyhedra_Library::Grid::relation_with(), Parma_Polyhedra_Library::Box< ITV >::relation_with(), Parma_Polyhedra_Library::BD_Shape< T >::relation_with(), Parma_Polyhedra_Library::PIP_Problem::solve(), Parma_Polyhedra_Library::PIP_Solution_Node::update_tableau(), and Parma_Polyhedra_Library::Box< ITV >::wrap_assign().
00113 { 00114 if (v.space_dimension() > space_dimension()) 00115 throw_dimension_incompatible("coefficient(v)", "v", v); 00116 return Linear_Row::coefficient(v.id()); 00117 }
| PPL::Constraint Parma_Polyhedra_Library::Constraint::construct_epsilon_geq_zero | ( | ) | [static, private] |
Builds a new copy of the zero-dimension space constraint
(used to implement NNC polyhedra).
Definition at line 56 of file Constraint.cc.
References NONSTRICT_INEQUALITY, and Parma_Polyhedra_Library::NOT_NECESSARILY_CLOSED.
Referenced by initialize().
00056 { 00057 Linear_Expression e = Variable(0); 00058 Constraint c(e, NONSTRICT_INEQUALITY, NOT_NECESSARILY_CLOSED); 00059 return c; 00060 }
| const Constraint & Parma_Polyhedra_Library::Constraint::epsilon_geq_zero | ( | ) | [inline, static, private] |
Returns the zero-dimension space constraint
.
Definition at line 341 of file Constraint.inlines.hh.
References epsilon_geq_zero_p.
Referenced by Parma_Polyhedra_Library::Constraint_System::add_low_level_constraints().
00341 { 00342 PPL_ASSERT(epsilon_geq_zero_p != 0); 00343 return *epsilon_geq_zero_p; 00344 }
| const Constraint & Parma_Polyhedra_Library::Constraint::epsilon_leq_one | ( | ) | [inline, static, private] |
The zero-dimension space constraint
(used to implement NNC polyhedra).
Definition at line 347 of file Constraint.inlines.hh.
References epsilon_leq_one_p.
Referenced by Parma_Polyhedra_Library::Constraint_System::add_low_level_constraints(), Parma_Polyhedra_Library::Polyhedron::drop_some_non_integer_points(), Parma_Polyhedra_Library::Polyhedron::strongly_minimize_constraints(), and Parma_Polyhedra_Library::Polyhedron::topological_closure_assign().
00347 { 00348 PPL_ASSERT(epsilon_leq_one_p != 0); 00349 return *epsilon_leq_one_p; 00350 }
| memory_size_type Parma_Polyhedra_Library::Constraint::external_memory_in_bytes | ( | ) | const [inline] |
Returns the size in bytes of the memory managed by *this.
Reimplemented from Parma_Polyhedra_Library::Row.
Definition at line 125 of file Constraint.inlines.hh.
00125 { 00126 return Linear_Row::external_memory_in_bytes(); 00127 }
| void Parma_Polyhedra_Library::Constraint::finalize | ( | ) | [static] |
Finalizes the class.
Definition at line 245 of file Constraint.cc.
References epsilon_geq_zero_p, epsilon_leq_one_p, zero_dim_false_p, and zero_dim_positivity_p.
00245 { 00246 PPL_ASSERT(zero_dim_false_p != 0); 00247 delete zero_dim_false_p; 00248 zero_dim_false_p = 0; 00249 00250 PPL_ASSERT(zero_dim_positivity_p != 0); 00251 delete zero_dim_positivity_p; 00252 zero_dim_positivity_p = 0; 00253 00254 PPL_ASSERT(epsilon_geq_zero_p != 0); 00255 delete epsilon_geq_zero_p; 00256 epsilon_geq_zero_p = 0; 00257 00258 PPL_ASSERT(epsilon_leq_one_p != 0); 00259 delete epsilon_leq_one_p; 00260 epsilon_leq_one_p = 0; 00261 }
| Coefficient_traits::const_reference Parma_Polyhedra_Library::Constraint::inhomogeneous_term | ( | ) | const [inline] |
Returns the inhomogeneous term of *this.
Reimplemented from Parma_Polyhedra_Library::Linear_Row.
Definition at line 120 of file Constraint.inlines.hh.
Referenced by Parma_Polyhedra_Library::Octagonal_Shape< T >::add_constraint(), Parma_Polyhedra_Library::BD_Shape< T >::add_constraint(), Parma_Polyhedra_Library::Box< ITV >::add_constraint_no_check(), Parma_Polyhedra_Library::Polyhedron::contains_integer_point(), Parma_Polyhedra_Library::Polyhedron::expand_space_dimension(), Parma_Polyhedra_Library::Octagonal_Shape< T >::extract_octagonal_difference(), Parma_Polyhedra_Library::Box< ITV >::get_limiting_box(), Parma_Polyhedra_Library::BD_Shape< T >::get_limiting_shape(), operator<<(), Parma_Polyhedra_Library::MIP_Problem::parse_constraints(), Parma_Polyhedra_Library::MIP_Problem::process_pending_constraints(), Parma_Polyhedra_Library::Box< ITV >::propagate_constraint_no_check(), Parma_Polyhedra_Library::Octagonal_Shape< T >::refine_no_check(), Parma_Polyhedra_Library::Box< ITV >::refine_no_check(), Parma_Polyhedra_Library::BD_Shape< T >::refine_no_check(), Parma_Polyhedra_Library::Polyhedron::relation_with(), Parma_Polyhedra_Library::Octagonal_Shape< T >::relation_with(), Parma_Polyhedra_Library::Grid::relation_with(), Parma_Polyhedra_Library::Box< ITV >::relation_with(), Parma_Polyhedra_Library::BD_Shape< T >::relation_with(), Parma_Polyhedra_Library::PIP_Problem::solve(), Parma_Polyhedra_Library::PIP_Solution_Node::update_tableau(), and Parma_Polyhedra_Library::Box< ITV >::wrap_assign().
00120 { 00121 return Linear_Row::inhomogeneous_term(); 00122 }
| void Parma_Polyhedra_Library::Constraint::initialize | ( | ) | [static] |
Initializes the class.
Definition at line 226 of file Constraint.cc.
References Parma_Polyhedra_Library::Coefficient_one(), Constraint(), construct_epsilon_geq_zero(), epsilon_geq_zero_p, epsilon_leq_one_p, Parma_Polyhedra_Library::Linear_Expression::zero(), zero_dim_false_p, and zero_dim_positivity_p.
00226 { 00227 PPL_ASSERT(zero_dim_false_p == 0); 00228 zero_dim_false_p 00229 = new Constraint(Linear_Expression::zero() == Coefficient_one()); 00230 00231 PPL_ASSERT(zero_dim_positivity_p == 0); 00232 zero_dim_positivity_p 00233 = new Constraint(Linear_Expression::zero() <= Coefficient_one()); 00234 00235 PPL_ASSERT(epsilon_geq_zero_p == 0); 00236 epsilon_geq_zero_p 00237 = new Constraint(construct_epsilon_geq_zero()); 00238 00239 PPL_ASSERT(epsilon_leq_one_p == 0); 00240 epsilon_leq_one_p 00241 = new Constraint(Linear_Expression::zero() < Coefficient_one()); 00242 }
| bool Parma_Polyhedra_Library::Constraint::is_equality | ( | ) | const [inline] |
Returns true if and only if *this is an equality constraint.
Definition at line 71 of file Constraint.inlines.hh.
References Parma_Polyhedra_Library::Linear_Row::is_line_or_equality().
Referenced by Parma_Polyhedra_Library::Octagonal_Shape< T >::add_constraint(), Parma_Polyhedra_Library::BD_Shape< T >::add_constraint(), Parma_Polyhedra_Library::Grid::add_constraint_no_check(), Parma_Polyhedra_Library::Box< ITV >::add_constraint_no_check(), Parma_Polyhedra_Library::Polyhedron::add_recycled_constraints(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::affine_dimension(), Parma_Polyhedra_Library::Implementation::Termination::assign_all_inequalities_approximation(), Parma_Polyhedra_Library::Polyhedron::BFT00_poly_hull_assign_if_exact(), Parma_Polyhedra_Library::Polyhedron::BHZ09_NNC_poly_hull_assign_if_exact(), Parma_Polyhedra_Library::Polyhedron::concatenate_assign(), Parma_Polyhedra_Library::Octagonal_Shape< T >::difference_assign(), Parma_Polyhedra_Library::BD_Shape< T >::difference_assign(), Parma_Polyhedra_Library::Polyhedron::drop_some_non_integer_points(), Parma_Polyhedra_Library::Polyhedron::expand_space_dimension(), is_inconsistent(), is_tautological(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::linear_partition(), Parma_Polyhedra_Library::MIP_Problem::parse_constraints(), Parma_Polyhedra_Library::Shape_Preserving_Reduction< D1, D2 >::product_reduce(), Parma_Polyhedra_Library::Polyhedron::refine_no_check(), Parma_Polyhedra_Library::Octagonal_Shape< T >::refine_no_check(), Parma_Polyhedra_Library::Grid::refine_no_check(), Parma_Polyhedra_Library::Box< ITV >::refine_no_check(), Parma_Polyhedra_Library::BD_Shape< T >::refine_no_check(), Parma_Polyhedra_Library::Polyhedron::refine_with_constraints(), Parma_Polyhedra_Library::Polyhedron::relation_with(), Parma_Polyhedra_Library::Octagonal_Shape< T >::relation_with(), Parma_Polyhedra_Library::Grid::relation_with(), Parma_Polyhedra_Library::Box< ITV >::relation_with(), Parma_Polyhedra_Library::BD_Shape< T >::relation_with(), Parma_Polyhedra_Library::PIP_Problem::solve(), type(), and Parma_Polyhedra_Library::PIP_Solution_Node::update_tableau().
00071 { 00072 return is_line_or_equality(); 00073 }
| bool Parma_Polyhedra_Library::Constraint::is_equivalent_to | ( | const Constraint & | y | ) | const |
Returns true if and only if *this and y are equivalent constraints.
Constraints having different space dimensions are not equivalent. Note that constraints having different types may nonetheless be equivalent, if they both are tautologies or inconsistent.
Definition at line 179 of file Constraint.cc.
References is_inconsistent(), is_tautological(), Parma_Polyhedra_Library::Row::normalize(), space_dimension(), STRICT_INEQUALITY, and type().
Referenced by operator!=(), and operator==().
00179 { 00180 const Constraint& x = *this; 00181 const dimension_type x_space_dim = x.space_dimension(); 00182 if (x_space_dim != y.space_dimension()) 00183 return false; 00184 00185 const Type x_type = x.type(); 00186 if (x_type != y.type()) { 00187 // Check for special cases. 00188 if (x.is_tautological()) 00189 return y.is_tautological(); 00190 else 00191 return x.is_inconsistent() && y.is_inconsistent(); 00192 } 00193 00194 if (x_type == STRICT_INEQUALITY) { 00195 // Due to the presence of epsilon-coefficients, syntactically 00196 // different strict inequalities may actually encode the same 00197 // topologically open half-space. 00198 // First, drop the epsilon-coefficient ... 00199 Linear_Expression x_expr(x); 00200 Linear_Expression y_expr(y); 00201 // ... then, re-normalize ... 00202 x_expr.normalize(); 00203 y_expr.normalize(); 00204 // ... and finally check for syntactic equality. 00205 for (dimension_type i = x_space_dim + 1; i-- > 0; ) 00206 if (x_expr[i] != y_expr[i]) 00207 return false; 00208 return true; 00209 } 00210 00211 // `x' and 'y' are of the same type and they are not strict inequalities; 00212 // thus, the epsilon-coefficient, if present, is zero. 00213 // It is sufficient to check for syntactic equality. 00214 for (dimension_type i = x_space_dim + 1; i-- > 0; ) 00215 if (x[i] != y[i]) 00216 return false; 00217 return true; 00218 }
| bool Parma_Polyhedra_Library::Constraint::is_inconsistent | ( | ) | const |
Returns true if and only if *this is inconsistent (i.e., an always false constraint).
An inconsistent constraint can have either one of the following forms:
, where
; or
, where
; or
, where
. Definition at line 139 of file Constraint.cc.
References Parma_Polyhedra_Library::Linear_Row::all_homogeneous_terms_are_zero(), is_equality(), Parma_Polyhedra_Library::Linear_Row::is_necessarily_closed(), and Parma_Polyhedra_Library::Row::size().
Referenced by Parma_Polyhedra_Library::Polyhedron::add_constraint(), Parma_Polyhedra_Library::Octagonal_Shape< T >::add_constraint(), Parma_Polyhedra_Library::BD_Shape< T >::add_constraint(), Parma_Polyhedra_Library::Grid::add_constraint_no_check(), Parma_Polyhedra_Library::Polyhedron::contains_integer_point(), is_equivalent_to(), Parma_Polyhedra_Library::Polyhedron::poly_difference_assign(), Parma_Polyhedra_Library::Polyhedron::refine_no_check(), Parma_Polyhedra_Library::Grid::refine_no_check(), Parma_Polyhedra_Library::Polyhedron::relation_with(), Parma_Polyhedra_Library::Grid::relation_with(), and Parma_Polyhedra_Library::Box< ITV >::wrap_assign().
00139 { 00140 PPL_ASSERT(size() > 0); 00141 const Constraint& x = *this; 00142 if (x.all_homogeneous_terms_are_zero()) 00143 // The inhomogeneous term is the only non-zero coefficient. 00144 if (is_equality()) 00145 return x[0] != 0; 00146 else 00147 // Non-strict inequality constraint. 00148 return x[0] < 0; 00149 else 00150 // There is a non-zero homogeneous coefficient. 00151 if (is_necessarily_closed()) 00152 return false; 00153 else { 00154 // The constraint is NOT necessarily closed. 00155 const dimension_type eps_index = size() - 1; 00156 if (x[eps_index] >= 0) 00157 // If positive, we have found the constraint epsilon >= 0. 00158 // If zero, one of the `true' dimensions has a non-zero coefficient. 00159 // In both cases, it is not trivially false. 00160 return false; 00161 else { 00162 // Here the epsilon coefficient is negative: strict inequality. 00163 if (x[0] > 0) 00164 // A strict inequality such as `lhs + k > 0', 00165 // where k is a positive integer, cannot be trivially false. 00166 return false; 00167 // Checking for another non-zero coefficient. 00168 for (dimension_type i = eps_index; --i > 0; ) 00169 if (x[i] != 0) 00170 return false; 00171 // We have the inequality `k > 0', 00172 // where k is zero or a negative integer. 00173 return true; 00174 } 00175 } 00176 }
| bool Parma_Polyhedra_Library::Constraint::is_inequality | ( | ) | const [inline] |
Returns true if and only if *this is an inequality constraint (either strict or non-strict).
Definition at line 76 of file Constraint.inlines.hh.
References Parma_Polyhedra_Library::Linear_Row::is_ray_or_point_or_inequality().
Referenced by Parma_Polyhedra_Library::Grid::add_constraint_no_check(), Parma_Polyhedra_Library::Polyhedron::BHRZ03_combining_constraints(), Parma_Polyhedra_Library::Octagonal_Shape< T >::get_limiting_octagon(), Parma_Polyhedra_Library::BD_Shape< T >::get_limiting_shape(), Parma_Polyhedra_Library::Polyhedron::is_included_in(), Parma_Polyhedra_Library::MIP_Problem::is_satisfied(), Parma_Polyhedra_Library::MIP_Problem::parse_constraints(), Parma_Polyhedra_Library::MIP_Problem::process_pending_constraints(), Parma_Polyhedra_Library::Octagonal_Shape< T >::relation_with(), Parma_Polyhedra_Library::Box< ITV >::relation_with(), Parma_Polyhedra_Library::BD_Shape< T >::relation_with(), Parma_Polyhedra_Library::Constraint_System::satisfies_all_constraints(), and Parma_Polyhedra_Library::Polyhedron::simplify_using_context_assign().
00076 { 00077 return is_ray_or_point_or_inequality(); 00078 }
| bool Parma_Polyhedra_Library::Constraint::is_nonstrict_inequality | ( | ) | const [inline] |
Returns true if and only if *this is a non-strict inequality constraint.
Definition at line 93 of file Constraint.inlines.hh.
References NONSTRICT_INEQUALITY, and type().
Referenced by Parma_Polyhedra_Library::Polyhedron::expand_space_dimension(), Parma_Polyhedra_Library::Octagonal_Shape< T >::relation_with(), and Parma_Polyhedra_Library::BD_Shape< T >::relation_with().
00093 { 00094 return type() == NONSTRICT_INEQUALITY; 00095 }
| bool Parma_Polyhedra_Library::Constraint::is_strict_inequality | ( | ) | const [inline] |
Returns true if and only if *this is a strict inequality constraint.
Definition at line 98 of file Constraint.inlines.hh.
References STRICT_INEQUALITY, and type().
Referenced by Parma_Polyhedra_Library::Polyhedron::add_constraint(), Parma_Polyhedra_Library::Octagonal_Shape< T >::add_constraint(), Parma_Polyhedra_Library::MIP_Problem::add_constraint(), Parma_Polyhedra_Library::BD_Shape< T >::add_constraint(), Parma_Polyhedra_Library::Box< ITV >::add_constraint_no_check(), Parma_Polyhedra_Library::Implementation::Termination::assign_all_inequalities_approximation(), Parma_Polyhedra_Library::BD_Shape< T >::BD_Shape(), Parma_Polyhedra_Library::Polyhedron::BHZ09_NNC_poly_hull_assign_if_exact(), Parma_Polyhedra_Library::Box< ITV >::Box(), Parma_Polyhedra_Library::C_Polyhedron::C_Polyhedron(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::linear_partition_aux(), Parma_Polyhedra_Library::Octagonal_Shape< T >::Octagonal_Shape(), Parma_Polyhedra_Library::Octagonal_Shape< T >::refine_no_check(), Parma_Polyhedra_Library::Box< ITV >::refine_no_check(), Parma_Polyhedra_Library::BD_Shape< T >::refine_no_check(), Parma_Polyhedra_Library::Polyhedron::relation_with(), Parma_Polyhedra_Library::Octagonal_Shape< T >::relation_with(), Parma_Polyhedra_Library::Grid::relation_with(), Parma_Polyhedra_Library::Box< ITV >::relation_with(), Parma_Polyhedra_Library::BD_Shape< T >::relation_with(), Parma_Polyhedra_Library::Polyhedron::select_H79_constraints(), Parma_Polyhedra_Library::PIP_Problem::solve(), and Parma_Polyhedra_Library::PIP_Solution_Node::update_tableau().
00098 { 00099 return type() == STRICT_INEQUALITY; 00100 }
| bool Parma_Polyhedra_Library::Constraint::is_tautological | ( | ) | const |
Returns true if and only if *this is a tautology (i.e., an always true constraint).
A tautology can have either one of the following forms:
; or
, where
; or
, where
. Definition at line 98 of file Constraint.cc.
References Parma_Polyhedra_Library::Linear_Row::all_homogeneous_terms_are_zero(), is_equality(), Parma_Polyhedra_Library::Linear_Row::is_necessarily_closed(), and Parma_Polyhedra_Library::Row::size().
Referenced by Parma_Polyhedra_Library::Polyhedron::add_constraint(), Parma_Polyhedra_Library::Octagonal_Shape< T >::add_constraint(), Parma_Polyhedra_Library::BD_Shape< T >::add_constraint(), Parma_Polyhedra_Library::Grid::add_constraint_no_check(), Parma_Polyhedra_Library::Polyhedron::drop_some_non_integer_points(), Parma_Polyhedra_Library::Constraint_System::has_strict_inequalities(), is_equivalent_to(), Parma_Polyhedra_Library::Polyhedron::poly_difference_assign(), Parma_Polyhedra_Library::Polyhedron::simplify_using_context_assign(), and Parma_Polyhedra_Library::Polyhedron::topological_closure_assign().
00098 { 00099 PPL_ASSERT(size() > 0); 00100 const Constraint& x = *this; 00101 if (x.all_homogeneous_terms_are_zero()) 00102 if (is_equality()) 00103 return x[0] == 0; 00104 else 00105 // Non-strict inequality constraint. 00106 return x[0] >= 0; 00107 else 00108 // There is a non-zero homogeneous coefficient. 00109 if (is_necessarily_closed()) 00110 return false; 00111 else { 00112 // The constraint is NOT necessarily closed. 00113 const dimension_type eps_index = size() - 1; 00114 const int eps_sign = sgn(x[eps_index]); 00115 if (eps_sign > 0) 00116 // We have found the constraint epsilon >= 0. 00117 return true; 00118 if (eps_sign == 0) 00119 // One of the `true' dimensions has a non-zero coefficient. 00120 return false; 00121 else { 00122 // Here the epsilon coefficient is negative: strict inequality. 00123 if (x[0] <= 0) 00124 // A strict inequality such as `lhs - k > 0', 00125 // where k is a non negative integer, cannot be trivially true. 00126 return false; 00127 // Checking for another non-zero coefficient. 00128 for (dimension_type i = eps_index; --i > 0; ) 00129 if (x[i] != 0) 00130 return false; 00131 // We have the inequality `k > 0', 00132 // where k is a positive integer. 00133 return true; 00134 } 00135 } 00136 }
| dimension_type Parma_Polyhedra_Library::Constraint::max_space_dimension | ( | ) | [inline, static] |
Returns the maximum space dimension a Constraint can handle.
Reimplemented from Parma_Polyhedra_Library::Linear_Row.
Definition at line 61 of file Constraint.inlines.hh.
00061 { 00062 return Linear_Row::max_space_dimension(); 00063 }
| bool Parma_Polyhedra_Library::Constraint::OK | ( | ) | const |
Checks if all the invariants are satisfied.
Reimplemented from Parma_Polyhedra_Library::Linear_Row.
Definition at line 329 of file Constraint.cc.
References Parma_Polyhedra_Library::Linear_Row::OK(), and Parma_Polyhedra_Library::Linear_Row::strong_normalize().
00329 { 00330 // Check the underlying Linear_Row object. 00331 if (!Linear_Row::OK()) 00332 return false; 00333 00334 // Topology consistency checks. 00335 const dimension_type min_size = is_necessarily_closed() ? 1 : 2; 00336 if (size() < min_size) { 00337 #ifndef NDEBUG 00338 std::cerr << "Constraint has fewer coefficients than the minimum " 00339 << "allowed by its topology:" 00340 << std::endl 00341 << "size is " << size() 00342 << ", minimum is " << min_size << "." 00343 << std::endl; 00344 #endif 00345 return false; 00346 } 00347 00348 if (is_equality() && !is_necessarily_closed() && (*this)[size() - 1] != 0) { 00349 #ifndef NDEBUG 00350 std::cerr << "Illegal constraint: an equality cannot be strict." 00351 << std::endl; 00352 #endif 00353 return false; 00354 } 00355 00356 // Normalization check. 00357 Constraint tmp = *this; 00358 tmp.strong_normalize(); 00359 if (tmp != *this) { 00360 #ifndef NDEBUG 00361 std::cerr << "Constraint is not strongly normalized as it should be." 00362 << std::endl; 00363 #endif 00364 return false; 00365 } 00366 00367 // All tests passed. 00368 return true; 00369 }
| Constraint & Parma_Polyhedra_Library::Constraint::operator= | ( | const Constraint & | c | ) | [inline] |
Assignment operator.
Definition at line 55 of file Constraint.inlines.hh.
00055 { 00056 Linear_Row::operator=(c); 00057 return *this; 00058 }
| Parma_Polyhedra_Library::Constraint::Parma_Polyhedra_Library::Linear_Expression::Linear_Expression | ( | const Constraint & | c | ) | [private] |
| void Parma_Polyhedra_Library::Constraint::print | ( | ) | const |
Prints *this to std::cerr using operator<<.
Reimplemented from Parma_Polyhedra_Library::Linear_Row.
| void Parma_Polyhedra_Library::Constraint::set_is_equality | ( | ) | [inline, private] |
Sets the constraint type to EQUALITY.
Definition at line 103 of file Constraint.inlines.hh.
References Parma_Polyhedra_Library::Linear_Row::set_is_line_or_equality().
Referenced by Parma_Polyhedra_Library::Polyhedron::add_recycled_constraints(), and Parma_Polyhedra_Library::Polyhedron::concatenate_assign().
00103 { 00104 set_is_line_or_equality(); 00105 }
| void Parma_Polyhedra_Library::Constraint::set_is_inequality | ( | ) | [inline, private] |
Sets the constraint to be an inequality.
Whether the constraint type will become NONSTRICT_INEQUALITY or STRICT_INEQUALITY depends on the topology and the value of the low-level coefficients of the constraint.
Definition at line 108 of file Constraint.inlines.hh.
References Parma_Polyhedra_Library::Linear_Row::set_is_ray_or_point_or_inequality().
00108 { 00109 set_is_ray_or_point_or_inequality(); 00110 }
| dimension_type Parma_Polyhedra_Library::Constraint::space_dimension | ( | ) | const [inline] |
Returns the dimension of the vector space enclosing *this.
Reimplemented from Parma_Polyhedra_Library::Linear_Row.
Definition at line 66 of file Constraint.inlines.hh.
Referenced by Parma_Polyhedra_Library::Polyhedron::add_constraint(), Parma_Polyhedra_Library::PIP_Problem::add_constraint(), Parma_Polyhedra_Library::Octagonal_Shape< T >::add_constraint(), Parma_Polyhedra_Library::MIP_Problem::add_constraint(), Parma_Polyhedra_Library::Grid::add_constraint(), Parma_Polyhedra_Library::Box< ITV >::add_constraint(), Parma_Polyhedra_Library::BD_Shape< T >::add_constraint(), Parma_Polyhedra_Library::Grid::add_constraint_no_check(), Parma_Polyhedra_Library::Box< ITV >::add_constraint_no_check(), Parma_Polyhedra_Library::Octagonal_Shape< T >::bounds(), Parma_Polyhedra_Library::BD_Shape< T >::bounds(), coefficient(), Parma_Polyhedra_Library::BD_Shape< T >::extract_bounded_difference(), Parma_Polyhedra_Library::Box< ITV >::extract_interval_constraint(), Parma_Polyhedra_Library::Octagonal_Shape< T >::extract_octagonal_difference(), Parma_Polyhedra_Library::Constraint_System::insert(), Parma_Polyhedra_Library::Congruence_System::insert(), Parma_Polyhedra_Library::Constraint_System::insert_pending(), is_equivalent_to(), Parma_Polyhedra_Library::MIP_Problem::is_satisfied(), Parma_Polyhedra_Library::MIP_Problem::is_saturated(), Parma_Polyhedra_Library::Octagonal_Shape< T >::max_min(), Parma_Polyhedra_Library::BD_Shape< T >::max_min(), Parma_Polyhedra_Library::Topology_Adjusted_Scalar_Product_Sign::operator()(), operator<<(), Parma_Polyhedra_Library::MIP_Problem::parse_constraints(), Parma_Polyhedra_Library::MIP_Problem::process_pending_constraints(), Parma_Polyhedra_Library::Box< ITV >::propagate_constraint(), Parma_Polyhedra_Library::Box< ITV >::propagate_constraint_no_check(), Parma_Polyhedra_Library::Polyhedron::refine_no_check(), Parma_Polyhedra_Library::Octagonal_Shape< T >::refine_no_check(), Parma_Polyhedra_Library::Grid::refine_no_check(), Parma_Polyhedra_Library::Box< ITV >::refine_no_check(), Parma_Polyhedra_Library::BD_Shape< T >::refine_no_check(), Parma_Polyhedra_Library::Polyhedron::refine_with_constraint(), Parma_Polyhedra_Library::Octagonal_Shape< T >::refine_with_constraint(), Parma_Polyhedra_Library::Grid::refine_with_constraint(), Parma_Polyhedra_Library::Box< ITV >::refine_with_constraint(), Parma_Polyhedra_Library::BD_Shape< T >::refine_with_constraint(), Parma_Polyhedra_Library::Polyhedron::relation_with(), Parma_Polyhedra_Library::Octagonal_Shape< T >::relation_with(), Parma_Polyhedra_Library::Grid::relation_with(), Parma_Polyhedra_Library::Generator_System::relation_with(), Parma_Polyhedra_Library::Box< ITV >::relation_with(), Parma_Polyhedra_Library::BD_Shape< T >::relation_with(), Parma_Polyhedra_Library::Generator_System::satisfied_by_all_generators(), Parma_Polyhedra_Library::PIP_Problem::solve(), Parma_Polyhedra_Library::Polyhedron::throw_dimension_incompatible(), Parma_Polyhedra_Library::Octagonal_Shape< T >::throw_dimension_incompatible(), Parma_Polyhedra_Library::Grid::throw_dimension_incompatible(), throw_dimension_incompatible(), Parma_Polyhedra_Library::Box< ITV >::throw_dimension_incompatible(), Parma_Polyhedra_Library::BD_Shape< T >::throw_dimension_incompatible(), and Parma_Polyhedra_Library::PIP_Solution_Node::update_tableau().
00066 { 00067 return Linear_Row::space_dimension(); 00068 }
| void Parma_Polyhedra_Library::Constraint::swap | ( | Constraint & | y | ) | [inline] |
Swaps *this with y.
Definition at line 363 of file Constraint.inlines.hh.
Referenced by Constraint(), and swap().
00363 { 00364 Linear_Row::swap(y); 00365 }
| void Parma_Polyhedra_Library::Constraint::throw_dimension_incompatible | ( | const char * | method, | |
| const char * | name_var, | |||
| Variable | v | |||
| ) | const [private] |
Throws a std::invalid_argument exception containing the appropriate error message.
Definition at line 45 of file Constraint.cc.
References Parma_Polyhedra_Library::Variable::space_dimension(), and space_dimension().
Referenced by coefficient().
00047 { 00048 std::ostringstream s; 00049 s << "PPL::Constraint::" << method << ":" << std::endl 00050 << "this->space_dimension() == " << space_dimension() << ", " 00051 << name_var << ".space_dimension() == " << v.space_dimension() << "."; 00052 throw std::invalid_argument(s.str()); 00053 }
| void Parma_Polyhedra_Library::Constraint::throw_invalid_argument | ( | const char * | method, | |
| const char * | message | |||
| ) | const [private] |
Throws a std::invalid_argument exception containing error message message.
Definition at line 36 of file Constraint.cc.
| memory_size_type Parma_Polyhedra_Library::Constraint::total_memory_in_bytes | ( | ) | const [inline] |
Returns a lower bound to the total size in bytes of the memory occupied by *this.
Reimplemented from Parma_Polyhedra_Library::Row.
Definition at line 130 of file Constraint.inlines.hh.
00130 { 00131 return Linear_Row::total_memory_in_bytes(); 00132 }
| Constraint::Type Parma_Polyhedra_Library::Constraint::type | ( | ) | const [inline] |
Returns the constraint type of *this.
Definition at line 81 of file Constraint.inlines.hh.
References EQUALITY, is_equality(), Parma_Polyhedra_Library::Linear_Row::is_necessarily_closed(), NONSTRICT_INEQUALITY, Parma_Polyhedra_Library::Row::size(), and STRICT_INEQUALITY.
Referenced by Parma_Polyhedra_Library::Box< ITV >::add_constraint_no_check(), Parma_Polyhedra_Library::Constraint_System::ascii_dump(), Parma_Polyhedra_Library::Polyhedron::contains_integer_point(), Parma_Polyhedra_Library::Box< ITV >::get_limiting_box(), is_equivalent_to(), Parma_Polyhedra_Library::Polyhedron::is_included_in(), is_nonstrict_inequality(), is_strict_inequality(), operator<<(), Parma_Polyhedra_Library::Polyhedron::poly_difference_assign(), Parma_Polyhedra_Library::Box< ITV >::propagate_constraint_no_check(), Parma_Polyhedra_Library::Box< ITV >::refine_no_check(), Parma_Polyhedra_Library::Grid::relation_with(), Parma_Polyhedra_Library::Generator_System::relation_with(), Parma_Polyhedra_Library::Box< ITV >::relation_with(), Parma_Polyhedra_Library::Generator_System::satisfied_by_all_generators(), Parma_Polyhedra_Library::Constraint_System::satisfies_all_constraints(), Parma_Polyhedra_Library::Polyhedron::simplify_using_context_assign(), and Parma_Polyhedra_Library::Box< ITV >::wrap_assign().
00081 { 00082 if (is_equality()) 00083 return EQUALITY; 00084 if (is_necessarily_closed()) 00085 return NONSTRICT_INEQUALITY; 00086 else 00087 return ((*this)[size() - 1] < 0) 00088 ? STRICT_INEQUALITY 00089 : NONSTRICT_INEQUALITY; 00090 }
| const Constraint & Parma_Polyhedra_Library::Constraint::zero_dim_false | ( | ) | [inline, static] |
The unsatisfiable (zero-dimension space) constraint
.
Definition at line 329 of file Constraint.inlines.hh.
References zero_dim_false_p.
Referenced by Parma_Polyhedra_Library::Constraint_System::initialize().
00329 { 00330 PPL_ASSERT(zero_dim_false_p != 0); 00331 return *zero_dim_false_p; 00332 }
| const Constraint & Parma_Polyhedra_Library::Constraint::zero_dim_positivity | ( | ) | [inline, static] |
The true (zero-dimension space) constraint
, also known as positivity constraint.
Definition at line 335 of file Constraint.inlines.hh.
References zero_dim_positivity_p.
Referenced by Parma_Polyhedra_Library::Constraint_System::add_low_level_constraints(), Parma_Polyhedra_Library::PIP_Problem::ascii_load(), and Parma_Polyhedra_Library::MIP_Problem::ascii_load().
00335 { 00336 PPL_ASSERT(zero_dim_positivity_p != 0); 00337 return *zero_dim_positivity_p; 00338 }
| bool operator!= | ( | const Constraint & | x, | |
| const Constraint & | y | |||
| ) | [related] |
Returns true if and only if x is not equivalent to y.
Definition at line 142 of file Constraint.inlines.hh.
References is_equivalent_to().
| Constraint operator< | ( | Variable | v1, | |
| Variable | v2 | |||
| ) | [related] |
Returns the constraint v1 < v2.
Definition at line 312 of file Constraint.inlines.hh.
| Constraint operator< | ( | Coefficient_traits::const_reference | n, | |
| const Linear_Expression & | e | |||
| ) | [friend] |
Returns the constraint n < e.
Definition at line 318 of file Constraint.inlines.hh.
| Constraint operator< | ( | const Linear_Expression & | e, | |
| Coefficient_traits::const_reference | n | |||
| ) | [friend] |
Returns the constraint e < n.
Definition at line 324 of file Constraint.inlines.hh.
| Constraint operator< | ( | const Linear_Expression & | e1, | |
| const Linear_Expression & | e2 | |||
| ) | [friend] |
Returns the constraint e1 < e2.
Definition at line 306 of file Constraint.inlines.hh.
| std::ostream & operator<< | ( | std::ostream & | s, | |
| const Constraint::Type & | t | |||
| ) | [related] |
Output operator.
Definition at line 309 of file Constraint.cc.
References EQUALITY, NONSTRICT_INEQUALITY, and STRICT_INEQUALITY.
00309 { 00310 const char* n = 0; 00311 switch (t) { 00312 case Constraint::EQUALITY: 00313 n = "EQUALITY"; 00314 break; 00315 case Constraint::NONSTRICT_INEQUALITY: 00316 n = "NONSTRICT_INEQUALITY"; 00317 break; 00318 case Constraint::STRICT_INEQUALITY: 00319 n = "STRICT_INEQUALITY"; 00320 break; 00321 } 00322 s << n; 00323 return s; 00324 }
| std::ostream & operator<< | ( | std::ostream & | s, | |
| const Constraint & | c | |||
| ) | [related] |
Output operator.
Definition at line 265 of file Constraint.cc.
References coefficient(), Parma_Polyhedra_Library::Coefficient_zero(), EQUALITY, inhomogeneous_term(), Parma_Polyhedra_Library::neg_assign(), NONSTRICT_INEQUALITY, PPL_DIRTY_TEMP_COEFFICIENT, space_dimension(), STRICT_INEQUALITY, and type().
00265 { 00266 const dimension_type num_variables = c.space_dimension(); 00267 PPL_DIRTY_TEMP_COEFFICIENT(cv); 00268 bool first = true; 00269 for (dimension_type v = 0; v < num_variables; ++v) { 00270 cv = c.coefficient(Variable(v)); 00271 if (cv != 0) { 00272 if (!first) { 00273 if (cv > 0) 00274 s << " + "; 00275 else { 00276 s << " - "; 00277 neg_assign(cv); 00278 } 00279 } 00280 else 00281 first = false; 00282 if (cv == -1) 00283 s << "-"; 00284 else if (cv != 1) 00285 s << cv << "*"; 00286 s << PPL::Variable(v); 00287 } 00288 } 00289 if (first) 00290 s << Coefficient_zero(); 00291 const char* relation_symbol = 0; 00292 switch (c.type()) { 00293 case Constraint::EQUALITY: 00294 relation_symbol = " = "; 00295 break; 00296 case Constraint::NONSTRICT_INEQUALITY: 00297 relation_symbol = " >= "; 00298 break; 00299 case Constraint::STRICT_INEQUALITY: 00300 relation_symbol = " > "; 00301 break; 00302 } 00303 s << relation_symbol << -c.inhomogeneous_term(); 00304 return s; 00305 }
| Constraint operator<= | ( | Variable | v1, | |
| Variable | v2 | |||
| ) | [related] |
Returns the constraint v1 <= v2.
Definition at line 288 of file Constraint.inlines.hh.
| Constraint operator<= | ( | Coefficient_traits::const_reference | n, | |
| const Linear_Expression & | e | |||
| ) | [friend] |
Returns the constraint n <= e.
Definition at line 294 of file Constraint.inlines.hh.
| Constraint operator<= | ( | const Linear_Expression & | e, | |
| Coefficient_traits::const_reference | n | |||
| ) | [friend] |
Returns the constraint e <= n.
Definition at line 300 of file Constraint.inlines.hh.
| Constraint operator<= | ( | const Linear_Expression & | e1, | |
| const Linear_Expression & | e2 | |||
| ) | [friend] |
Returns the constraint e1 <= e2.
Definition at line 282 of file Constraint.inlines.hh.
| bool operator== | ( | const Constraint & | x, | |
| const Constraint & | y | |||
| ) | [related] |
Returns true if and only if x is equivalent to y.
Definition at line 136 of file Constraint.inlines.hh.
References is_equivalent_to().
| Constraint operator== | ( | Coefficient_traits::const_reference | n, | |
| const Linear_Expression & | e | |||
| ) | [friend] |
Returns the constraint n = e.
Definition at line 212 of file Constraint.inlines.hh.
00212 { 00213 Linear_Expression diff = n - e; 00214 Constraint c(diff, Constraint::EQUALITY, NECESSARILY_CLOSED); 00215 // Enforce normalization. 00216 c.strong_normalize(); 00217 return c; 00218 }
| Constraint operator== | ( | const Linear_Expression & | e, | |
| Coefficient_traits::const_reference | n | |||
| ) | [friend] |
Returns the constraint e = n.
Definition at line 246 of file Constraint.inlines.hh.
00246 { 00247 Linear_Expression diff = e - n; 00248 Constraint c(diff, Constraint::EQUALITY, NECESSARILY_CLOSED); 00249 // Enforce normalization. 00250 c.strong_normalize(); 00251 return c; 00252 }
| Constraint operator== | ( | Variable | v1, | |
| Variable | v2 | |||
| ) | [friend] |
Returns the constraint v1 = v2.
Definition at line 158 of file Constraint.inlines.hh.
00158 { 00159 Linear_Expression diff 00160 = (v1.space_dimension() < v2.space_dimension()) ? v1-v2 : v2-v1; 00161 return Constraint(diff, Constraint::EQUALITY, NECESSARILY_CLOSED); 00162 }
| Constraint operator== | ( | const Linear_Expression & | e1, | |
| const Linear_Expression & | e2 | |||
| ) | [friend] |
Returns the constraint e1 = e2.
Definition at line 148 of file Constraint.inlines.hh.
00148 { 00149 Linear_Expression diff = e1 - e2; 00150 Constraint c(diff, Constraint::EQUALITY, NECESSARILY_CLOSED); 00151 // Enforce normalization. 00152 c.strong_normalize(); 00153 return c; 00154 }
| Constraint operator> | ( | Coefficient_traits::const_reference | n, | |
| const Linear_Expression & | e | |||
| ) | [friend] |
Returns the constraint n > e.
Definition at line 232 of file Constraint.inlines.hh.
00232 { 00233 Linear_Expression diff; 00234 // Setting the epsilon coefficient to -1. 00235 // NOTE: this also enforces normalization. 00236 diff -= Variable(e.space_dimension()); 00237 diff += n; 00238 diff -= e; 00239 00240 Constraint c(diff, Constraint::STRICT_INEQUALITY, NOT_NECESSARILY_CLOSED); 00241 return c; 00242 }
| Constraint operator> | ( | const Linear_Expression & | e, | |
| Coefficient_traits::const_reference | n | |||
| ) | [friend] |
Returns the constraint e > n.
Definition at line 266 of file Constraint.inlines.hh.
00266 { 00267 Linear_Expression diff; 00268 // Setting the epsilon coefficient to -1. 00269 // NOTE: this also enforces normalization. 00270 diff -= Variable(e.space_dimension()); 00271 diff += e; 00272 diff -= n; 00273 00274 Constraint c(diff, Constraint::STRICT_INEQUALITY, NOT_NECESSARILY_CLOSED); 00275 c.set_not_necessarily_closed(); 00276 c.set_is_inequality(); 00277 return c; 00278 }
| Constraint operator> | ( | Variable | v1, | |
| Variable | v2 | |||
| ) | [friend] |
Returns the constraint v1 > v2.
Definition at line 202 of file Constraint.inlines.hh.
00202 { 00203 Linear_Expression diff = v1-v2; 00204 diff -= Variable(std::max(v1.space_dimension(), v2.space_dimension())); 00205 return Constraint(diff, 00206 Constraint::STRICT_INEQUALITY, 00207 NOT_NECESSARILY_CLOSED); 00208 }
| Constraint operator> | ( | const Linear_Expression & | e1, | |
| const Linear_Expression & | e2 | |||
| ) | [friend] |
Returns the constraint e1 > e2.
Definition at line 183 of file Constraint.inlines.hh.
00183 { 00184 Linear_Expression diff; 00185 // Setting the epsilon coefficient to -1. 00186 // NOTE: this also enforces normalization. 00187 const dimension_type e1_dim = e1.space_dimension(); 00188 const dimension_type e2_dim = e2.space_dimension(); 00189 if (e1_dim > e2_dim) 00190 diff -= Variable(e1_dim); 00191 else 00192 diff -= Variable(e2_dim); 00193 diff += e1; 00194 diff -= e2; 00195 00196 Constraint c(diff, Constraint::STRICT_INEQUALITY, NOT_NECESSARILY_CLOSED); 00197 return c; 00198 }
| Constraint operator>= | ( | Coefficient_traits::const_reference | n, | |
| const Linear_Expression & | e | |||
| ) | [friend] |
Returns the constraint n >= e.
Definition at line 222 of file Constraint.inlines.hh.
00222 { 00223 Linear_Expression diff = n - e; 00224 Constraint c(diff, Constraint::NONSTRICT_INEQUALITY, NECESSARILY_CLOSED); 00225 // Enforce normalization. 00226 c.normalize(); 00227 return c; 00228 }
| Constraint operator>= | ( | const Linear_Expression & | e, | |
| Coefficient_traits::const_reference | n | |||
| ) | [friend] |
Returns the constraint e >= n.
Definition at line 256 of file Constraint.inlines.hh.
00256 { 00257 Linear_Expression diff = e - n; 00258 Constraint c(diff, Constraint::NONSTRICT_INEQUALITY, NECESSARILY_CLOSED); 00259 // Enforce normalization. 00260 c.normalize(); 00261 return c; 00262 }
| Constraint operator>= | ( | Variable | v1, | |
| Variable | v2 | |||
| ) | [friend] |
Returns the constraint v1 >= v2.
Definition at line 176 of file Constraint.inlines.hh.
00176 { 00177 Linear_Expression diff = v1-v2; 00178 return Constraint(diff, Constraint::NONSTRICT_INEQUALITY, NECESSARILY_CLOSED); 00179 }
| Constraint operator>= | ( | const Linear_Expression & | e1, | |
| const Linear_Expression & | e2 | |||
| ) | [friend] |
Returns the constraint e1 >= e2.
Definition at line 166 of file Constraint.inlines.hh.
00166 { 00167 Linear_Expression diff = e1 - e2; 00168 Constraint c(diff, Constraint::NONSTRICT_INEQUALITY, NECESSARILY_CLOSED); 00169 // Enforce normalization. 00170 c.normalize(); 00171 return c; 00172 }
friend class Parma_Polyhedra_Library::Congruence [friend] |
Definition at line 435 of file Constraint.defs.hh.
friend class Parma_Polyhedra_Library::Constraint_System [friend] |
Definition at line 438 of file Constraint.defs.hh.
friend class Parma_Polyhedra_Library::Constraint_System::const_iterator [friend] |
Definition at line 439 of file Constraint.defs.hh.
friend class Parma_Polyhedra_Library::Polyhedron [friend] |
Definition at line 441 of file Constraint.defs.hh.
friend class Parma_Polyhedra_Library::Scalar_Products [friend] |
Definition at line 436 of file Constraint.defs.hh.
friend class Parma_Polyhedra_Library::Topology_Adjusted_Scalar_Product_Sign [friend] |
Definition at line 437 of file Constraint.defs.hh.
| void swap | ( | Parma_Polyhedra_Library::Constraint & | x, | |
| Parma_Polyhedra_Library::Constraint & | y | |||
| ) | [related] |
Specializes std::swap.
Definition at line 373 of file Constraint.inlines.hh.
References swap().
00374 { 00375 x.swap(y); 00376 }
const PPL::Constraint * Parma_Polyhedra_Library::Constraint::epsilon_geq_zero_p = 0 [static, private] |
Holds (between class initialization and finalization) a pointer to the zero-dimension space constraint
.
Definition at line 426 of file Constraint.defs.hh.
Referenced by epsilon_geq_zero(), finalize(), and initialize().
const PPL::Constraint * Parma_Polyhedra_Library::Constraint::epsilon_leq_one_p = 0 [static, private] |
Holds (between class initialization and finalization) a pointer to the zero-dimension space constraint
(used to implement NNC polyhedra).
Definition at line 433 of file Constraint.defs.hh.
Referenced by epsilon_leq_one(), finalize(), and initialize().
const PPL::Constraint * Parma_Polyhedra_Library::Constraint::zero_dim_false_p = 0 [static, private] |
Holds (between class initialization and finalization) a pointer to the unsatisfiable (zero-dimension space) constraint
.
Definition at line 413 of file Constraint.defs.hh.
Referenced by finalize(), initialize(), and zero_dim_false().
const PPL::Constraint * Parma_Polyhedra_Library::Constraint::zero_dim_positivity_p = 0 [static, private] |
Holds (between class initialization and finalization) a pointer to the true (zero-dimension space) constraint
, also known as positivity constraint.
Definition at line 420 of file Constraint.defs.hh.
Referenced by finalize(), initialize(), and zero_dim_positivity().
1.6.3