Public Types | |
| enum | Type { EQUALITY, NONSTRICT_INEQUALITY, STRICT_INEQUALITY } |
| The constraint type. More... | |
Public Member Functions | |
| Constraint (const Constraint &c) | |
| Ordinary copy-constructor. | |
| ~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. | |
| const Integer & | coefficient (Variable v) const |
Returns the coefficient of v in *this. | |
| const Integer & | inhomogeneous_term () const |
Returns the inhomogeneous term of *this. | |
| bool | OK () const |
| Checks if all the invariants are satisfied. | |
Static Public Member Functions | |
| const Constraint & | zero_dim_false () |
The unsatisfiable (zero-dimension space) constraint . | |
| const Constraint & | zero_dim_positivity () |
The true (zero-dimension space) constraint , also known as positivity constraint. | |
Related Functions | |
| (Note that these are not member functions.) | |
| std::ostream & | operator<< (std::ostream &s, const Constraint &c) |
| Output operator. | |
| Constraint | operator== (const LinExpression &e1, const LinExpression &e2) |
Returns the constraint e1 = e2. | |
| Constraint | operator== (const LinExpression &e, const Integer &n) |
Returns the constraint e = n. | |
| Constraint | operator== (const Integer &n, const LinExpression &e) |
Returns the constraint n = e. | |
| Constraint | operator<= (const LinExpression &e1, const LinExpression &e2) |
Returns the constraint e1 <= e2. | |
| Constraint | operator<= (const LinExpression &e, const Integer &n) |
Returns the constraint e <= n. | |
| Constraint | operator<= (const Integer &n, const LinExpression &e) |
Returns the constraint n <= e. | |
| Constraint | operator>= (const LinExpression &e1, const LinExpression &e2) |
Returns the constraint e1 >= e2. | |
| Constraint | operator>= (const LinExpression &e, const Integer &n) |
Returns the constraint e >= n. | |
| Constraint | operator>= (const Integer &n, const LinExpression &e) |
Returns the constraint n >= e. | |
| Constraint | operator< (const LinExpression &e1, const LinExpression &e2) |
Returns the constraint e1 < e2. | |
| Constraint | operator< (const LinExpression &e, const Integer &n) |
Returns the constraint e < n. | |
| Constraint | operator< (const Integer &n, const LinExpression &e) |
Returns the constraint n < e. | |
| Constraint | operator> (const LinExpression &e1, const LinExpression &e2) |
Returns the constraint e1 > e2. | |
| Constraint | operator> (const LinExpression &e, const Integer &n) |
Returns the constraint e > n. | |
| Constraint | operator> (const Integer &n, const LinExpression &e) |
Returns the constraint n > e. | |
| void | swap (Parma_Polyhedra_Library::Constraint &x, Parma_Polyhedra_Library::Constraint &y) |
Specializes std::swap. | |
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(LinExpression::zero() == 1); Constraint false_c2(LinExpression::zero() >= 1); Constraint false_c3(LinExpression::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 { LinExpression e; for (int i = c1.space_dimension() - 1; i >= 0; i--) 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
|
|
The constraint type.
|
|
|
Returns the coefficient of
|
1.3.8-20040812