|
(Note that these are not member functions.)
|
std::ostream & | operator<< (std::ostream &s, const Generator &g) |
| Output operator. More...
|
|
void | swap (Generator &x, Generator &y) |
| Swaps x with y . More...
|
|
Generator | line (const Linear_Expression &e, Representation r=Generator::default_representation) |
| Shorthand for Generator::line(const Linear_Expression& e, Representation r). More...
|
|
Generator | ray (const Linear_Expression &e, Representation r=Generator::default_representation) |
| Shorthand for Generator::ray(const Linear_Expression& e, Representation r). More...
|
|
Generator | point (const Linear_Expression &e=Linear_Expression::zero(), Coefficient_traits::const_reference d=Coefficient_one(), Representation r=Generator::default_representation) |
| Shorthand for Generator::point(const Linear_Expression& e, Coefficient_traits::const_reference d, Representation r).
|
|
Generator | point (Representation r) |
| Shorthand for Generator::point(Representation r). More...
|
|
Generator | point (const Linear_Expression &e, Representation r) |
| Shorthand for Generator::point(const Linear_Expression& e, Representation r).
|
|
Generator | closure_point (const Linear_Expression &e=Linear_Expression::zero(), Coefficient_traits::const_reference d=Coefficient_one(), Representation r=Generator::default_representation) |
| Shorthand for Generator::closure_point(const Linear_Expression& e, Coefficient_traits::const_reference d, Representation r).
|
|
Generator | closure_point (Representation r) |
| Shorthand for Generator::closure_point(Representation r). More...
|
|
Generator | closure_point (const Linear_Expression &e, Representation r) |
| Shorthand for Generator::closure_point(const Linear_Expression& e, Representation r).
|
|
bool | operator== (const Generator &x, const Generator &y) |
| Returns true if and only if x is equivalent to y . More...
|
|
bool | operator!= (const Generator &x, const Generator &y) |
| Returns true if and only if x is not equivalent to y . More...
|
|
template<typename To > |
bool | rectilinear_distance_assign (Checked_Number< To, Extended_Number_Policy > &r, const Generator &x, const Generator &y, Rounding_Dir dir) |
| Computes the rectilinear (or Manhattan) distance between x and y . More...
|
|
template<typename Temp , typename To > |
bool | rectilinear_distance_assign (Checked_Number< To, Extended_Number_Policy > &r, const Generator &x, const Generator &y, Rounding_Dir dir) |
| Computes the rectilinear (or Manhattan) distance between x and y . More...
|
|
template<typename Temp , typename To > |
bool | rectilinear_distance_assign (Checked_Number< To, Extended_Number_Policy > &r, const Generator &x, const Generator &y, Rounding_Dir dir, Temp &tmp0, Temp &tmp1, Temp &tmp2) |
| Computes the rectilinear (or Manhattan) distance between x and y . More...
|
|
template<typename To > |
bool | euclidean_distance_assign (Checked_Number< To, Extended_Number_Policy > &r, const Generator &x, const Generator &y, Rounding_Dir dir) |
| Computes the euclidean distance between x and y . More...
|
|
template<typename Temp , typename To > |
bool | rectilinear_distance_assign (Checked_Number< To, Extended_Number_Policy > &r, const Generator &x, const Generator &y, Rounding_Dir dir) |
| Computes the euclidean distance between x and y . More...
|
|
template<typename Temp , typename To > |
bool | euclidean_distance_assign (Checked_Number< To, Extended_Number_Policy > &r, const Generator &x, const Generator &y, Rounding_Dir dir, Temp &tmp0, Temp &tmp1, Temp &tmp2) |
| Computes the euclidean distance between x and y . More...
|
|
template<typename To > |
bool | l_infinity_distance_assign (Checked_Number< To, Extended_Number_Policy > &r, const Generator &x, const Generator &y, Rounding_Dir dir) |
| Computes the distance between x and y . More...
|
|
template<typename Temp , typename To > |
bool | l_infinity_distance_assign (Checked_Number< To, Extended_Number_Policy > &r, const Generator &x, const Generator &y, Rounding_Dir dir) |
| Computes the distance between x and y . More...
|
|
template<typename Temp , typename To > |
bool | l_infinity_distance_assign (Checked_Number< To, Extended_Number_Policy > &r, const Generator &x, const Generator &y, Rounding_Dir dir, Temp &tmp0, Temp &tmp1, Temp &tmp2) |
| Computes the distance between x and y . More...
|
|
std::ostream & | operator<< (std::ostream &s, const Generator::Type &t) |
| Output operator. More...
|
|
Generator | line (const Linear_Expression &e, Representation r) |
|
Generator | ray (const Linear_Expression &e, Representation r) |
|
Generator | point (const Linear_Expression &e, Coefficient_traits::const_reference d, Representation r) |
|
Generator | point (Representation r) |
|
Generator | point (const Linear_Expression &e, Representation r) |
|
Generator | closure_point (const Linear_Expression &e, Coefficient_traits::const_reference d, Representation r) |
|
Generator | closure_point (Representation r) |
|
Generator | closure_point (const Linear_Expression &e, Representation r) |
|
bool | operator== (const Generator &x, const Generator &y) |
|
bool | operator!= (const Generator &x, const Generator &y) |
|
template<typename Temp , typename To > |
bool | rectilinear_distance_assign (Checked_Number< To, Extended_Number_Policy > &r, const Generator &x, const Generator &y, const Rounding_Dir dir, Temp &tmp0, Temp &tmp1, Temp &tmp2) |
|
template<typename Temp , typename To > |
bool | rectilinear_distance_assign (Checked_Number< To, Extended_Number_Policy > &r, const Generator &x, const Generator &y, const Rounding_Dir dir) |
|
template<typename To > |
bool | rectilinear_distance_assign (Checked_Number< To, Extended_Number_Policy > &r, const Generator &x, const Generator &y, const Rounding_Dir dir) |
|
template<typename Temp , typename To > |
bool | euclidean_distance_assign (Checked_Number< To, Extended_Number_Policy > &r, const Generator &x, const Generator &y, const Rounding_Dir dir, Temp &tmp0, Temp &tmp1, Temp &tmp2) |
|
template<typename Temp , typename To > |
bool | euclidean_distance_assign (Checked_Number< To, Extended_Number_Policy > &r, const Generator &x, const Generator &y, const Rounding_Dir dir) |
|
template<typename To > |
bool | euclidean_distance_assign (Checked_Number< To, Extended_Number_Policy > &r, const Generator &x, const Generator &y, const Rounding_Dir dir) |
|
template<typename Temp , typename To > |
bool | l_infinity_distance_assign (Checked_Number< To, Extended_Number_Policy > &r, const Generator &x, const Generator &y, const Rounding_Dir dir, Temp &tmp0, Temp &tmp1, Temp &tmp2) |
|
template<typename Temp , typename To > |
bool | l_infinity_distance_assign (Checked_Number< To, Extended_Number_Policy > &r, const Generator &x, const Generator &y, const Rounding_Dir dir) |
|
template<typename To > |
bool | l_infinity_distance_assign (Checked_Number< To, Extended_Number_Policy > &r, const Generator &x, const Generator &y, const Rounding_Dir dir) |
|
void | swap (Generator &x, Generator &y) |
|
A line, ray, point or closure point.
An object of the class Generator is one of the following:
- a line
;
- a ray
;
- a point
;
- a closure point
;
where
is the dimension of the space and, for points and closure points,
is the divisor.
- A note on terminology.
- As observed in Section Representations of Convex Polyhedra, there are cases when, in order to represent a polyhedron
using the generator system
, we need to include in the finite set
even points of
that are not vertices of
. This situation is even more frequent when working with NNC polyhedra and it is the reason why we prefer to use the word `point' where other libraries use the word `vertex'.
- How to build a generator.
- Each type of generator is built by applying the corresponding function (
line
, ray
, point
or closure_point
) to a linear expression, representing a direction in the space; the space dimension of the generator is defined as the space dimension of the corresponding linear expression. Linear expressions used to define a generator should be homogeneous (any constant term will be simply ignored). When defining points and closure points, an optional Coefficient argument can be used as a common divisor for all the coefficients occurring in the provided linear expression; the default value for this argument is 1.
- In all the following examples it is assumed that variables
x
, y
and z
are defined as follows: Variable x(0);
Variable y(1);
Variable z(2);
- Example 1
- The following code builds a line with direction
and having space dimension
: As mentioned above, the constant term of the linear expression is not relevant. Thus, the following code has the same effect: By definition, the origin of the space is not a line, so that the following code throws an exception:
- Example 2
- The following code builds a ray with the same direction as the line in Example 1: As is the case for lines, when specifying a ray the constant term of the linear expression is not relevant; also, an exception is thrown when trying to build a ray from the origin of the space.
- Example 3
- The following code builds the point
: The same effect can be obtained by using the following code: Similarly, the origin
can be defined using either one of the following lines of code: Note however that the following code would have defined a different point, namely
: The following two lines of code both define the only point having space dimension zero, namely
. In the second case we exploit the fact that the first argument of the function point
is optional.
- Example 4
- The point
specified in Example 3 above can also be obtained with the following code, where we provide a non-default value for the second argument of the function point
(the divisor): Obviously, the divisor can be usefully exploited to specify points having some non-integer (but rational) coordinates. For instance, the point
can be specified by the following code: If a zero divisor is provided, an exception is thrown.
- Example 5
- Closure points are specified in the same way we defined points, but invoking their specific constructor function. For instance, the closure point
is defined by For the particular case of the (only) closure point having space dimension zero, we can use any of the following:
- How to inspect a generator
- Several methods are provided to examine a generator and extract all the encoded information: its space dimension, its type and the value of its integer coefficients.
- Example 6
- The following code shows how it is possible to access each single coefficient of a generator. If
g1
is a point having coordinates
, we construct the closure point g2
having coordinates
. if (g1.is_point()) {
cout << "Point g1: " << g1 << endl;
Linear_Expression e;
e += (i + 1) * g1.coefficient(Variable(i)) * Variable(i);
cout << "Closure point g2: " << g2 << endl;
}
else
cout << "Generator g1 is not a point." << endl;
Therefore, for the point we would obtain the following output: Point g1: p((2*A - B + 3*C)/2)
Closure
point g2: cp((2*A - 2*B + 9*C)/2)
When working with (closure) points, be careful not to confuse the notion of coefficient with the notion of coordinate: these are equivalent only when the divisor of the (closure) point is 1.