similar to those in leda::real But while Original_leda_expression_dags only involves changes necessary to make floating-point filter, bigfloat arithmetic and
3.3. A Case Study on Common Subexpressions
3.4.1. Experimental Setup For our experiments we use algorithms from cgal, solving four of the geometric problems introduced in Section 1.1 In cgal, the three
layers of geometric algorithm, geometric primitives and arithmetic are nicely sepa- rated. This allows us to run the same algorithm with different geometric primitives and with different number types, too.
Delaunay triangulation: We compute the Delaunay triangulation of points in the plane, using
Delaunay_triangulation_2
and theSimple_cartesian
ker- nel. All predicates involve polynomial expressions only.Segment intersection: We compute all intersection points among a set of line seg- ments in the plane using
compute_intersection_points()
and both theSimple_homogeneous
andSimple_cartesian
kernel. In the homogeneouskernel, geometric primitives involve polynomial expressions only. The degree of these expressions is generally larger than of those needed for computing the 2D Delaunay triangulation. With the Cartesian kernel, geometric primitives involve rational expressions.
Arrangement of circles: We compute the arrangement of circles and line segments using
Arrangement_2
and theSimple_cartesian
kernel. This problem involves algebraic numbers and geometric primitives which are not provided by the standard kernels in cgal. Additional geometric primitives are provided to the arrangement implementation by a so-called traits class. We perform experiments for two different traits classes. The first isArr_circle_segment_traits_-
2
, it handles algebraic numbers by means of static algebraic predicates. Each predicate is reduced to the evaluation of several rational expressions. The second traits class we use isArr_circular_line_arc_traits_2
. For number types with field operations only, it provides static algebraic predicates, but if the number type supports square roots, straightforward expressions are used for predicate evaluation.0 25 50 75 100
Figure 3.6. Input data for Delaunay triangulation.
Segment Voronoi Diagram: We compute the Voronoi diagram of line segments using
Segment_Delaunay_graph_hierarchy_2
. Again, the necessary geo- metric primitives are provided by a traits class. We useSegment_Delaunay_-
graph_filtered_traits_without_intersections_2
when segments donot intersect in their interior, and
Segment_Delaunay_graph_filtered_-
traits_2
otherwise. Both provide static algebraic predicates for number typeswithout square root and straightforward predicate implementations for number types with square root. If segments do not intersect in their interior, static al- gebraic predicates employ ring operations only, the straightforward predicates however always need a division operation. Both traits classes have a built-in dynamic floating-point filter. The geometric primitives for the Voronoi diagram of segments are numerically harder than those for the arrangement of circles, since they involve algebraic numbers of higher degree.
If we count using different kernels or traits classes, this gives us seven different geometric algorithms solving four geometric problems. Each of these algorithms has different requirements on the arithmetic. Two use ring operations, and two use field operations only. Three algorithms use field operations plus square root, but may be used in combination with more restricted number types, by means of static algebraic predicates.
Input Data. Most input data sets are randomly generated. In some of those, input objects are uniformly distributed. This usually results in predicate calls which are numerically easy, i.e., may be decided by a floating-point filter. In other data sets, some structure is imposed to enforce a larger amount of degenerate or nearly degenerate predicate evaluations. Some data sets are completely structured without a random component.
We generate floating-point input data with 53 bits of precision, and, since small precision integer coordinates are common in real world applications, we also gen- erate integer input data with 25 bits of precision. To this end, we first generate a data set with floating-point coordinates, then scale the data such that its bounding box coincides with[−224, 224]2. Finally we round all numerical data to integers. Small precision integer data is more easy to handle numerically. For example, the straightforward floating-point implementation of the 2D orientation predicate, given
short long grid axis
Figure 3.7. Input data for segment intersection.
in Equation (1.7), always computes the correct result for 25 bit integer input. We generate the following data sets.
Delaunay triangulation: For p∈ {0,25,50,75,100}, we generate input data sets with 10 000 points each, of which p% are located almost on the boundary of a union of disks. The remaining points are placed uniformly at random outside the union of disk, no points are placed in the interior. With increasing p, this forces the Delaunay triangulation algorithm to perform more nearly degenerate incircle tests. Input data sets are shown in Figure 3.6.
Segment intersection: We generate four types of inputs sets, shown in Figure 3.7.
short: Sets of 2500 segments with endpoints uniformly distributed in a square. The length of segments is restricted to approximately one third of the side of the square.
long: Sets of 700 segments with endpoints uniformly distributed in a square.
grid: Sets of 500 segments with endpoints randomly placed on an 11× 11 grid. Some intersection points will have the same x-coordinate, which is a degeneracy for the plane sweep algorithm that we use.
axis: Sets of 700 axis parallel segments. In this type of set, there are many degeneracies too, however all intersection points have a representation in input precision.
Arrangement of circles: We generate four types of data sets, shown in Figure 3.8.
rand: Sets of 500 line segments and 500 circles, randomly generated inside a square. Segment length and circle diameter are restricted to approximately one fourth of the side of the square.
gridrn: A set of 529 circles with centers on a 23× 23 grid and radius of approxi- mately twice the diagonal of the grid. There are many occurrences of four circles almost intersecting in a single point. The data set is slightly rotated, such that the intersection points are not all near the same x-coordinates. Due to numerical imprecision, rotating the data set also perturbs the input data and thus further relaxes the near degeneracies.
pack: An approximate circle packing of 2000 circles. We generate data sets incrementally using the Voronoi diagram of disks. After a small initial set of disks,
rand gridrn pack gridnn
Figure 3.8. Input data for arrangements of circles and line segments.
we create alternately disks with random centers, touching at least one other disk and disks with their center on random Voronoi vertices, touching at least three other disks. Since we round data to floating-point numbers, circles in the final data set are unlikely to touch but will either miss or intersect slightly.
gridnn: A set of 225 circles with centers on a 15× 15 grid and radius of approxi- mately twice the diagonal of the grid. This data set is not rotated and therefore closer to being degenerate than thegridrnset. Furthermore, intersection points all occur near the same x-coordinate, which is another degeneracy for the plane sweep algorithm we use.
Segment Voronoi diagram: We generate four types of data sets, which are shown in Figure 3.9. In the first two, segments only intersect at endpoints, in the other two, true intersections occur.
mst: Sets of 5000 segments, which form the minimum spanning tree of a point set with 75% of points on the boundary of a union of disks. Most segments in this data set are very short.
sqrs: Sets of 785 axis parallel segments, which are edges of small squares, regularly placed on a 15× 15 grid.
short: Sets of 500 segments with endpoints uniformly distributed in a square. The length of segments is restricted to approximately one third of the side of the square.
shoax: Sets of 200 short, axis parallel segments inside a square. The length of segments is restricted to approximately one third of the side of the square. Platforms. Comparing algorithms by measured running time is a tricky business. Apart from input data and in our case the geometric algorithm, also the compiler, third party libraries, and hardware have an influence on the running time. In general, small performance differences between algorithms may vanish or revert when the computing environment changes. To give our results more significance, we run experiments on three different platforms.
descartes
: A desktop PC with an Intel Core i5-660 processor running at 3.33 GHz.mst sqrs short shoax
Figure 3.9. Input data for segment Voronoi diagram.
minkowski
: A notebook with an Intel Core 2 Duo T5500 processor running at 1.66GHz. All software is compiled using
g++
4.5.1.thales
: A Sun workstation with a SPARC-T3 processor running at 1.66 GHz. Thisplatform comes with a hardware fused-multiply-add instruction, which we exploit in algorithms based on error-free transformations. All software is compiled using
g++
4.7.1. Due to compiler incompatibilities, we are unable to use a precompiled leda package onthales
. The implementation of interval arithmetic in leda is however almost entirely based on header files, thereforeLeda_interval_fil-
ter_policy
is still available.On all platforms we use the following library versions: gmp 5.0.5, mpfr 3.1.1, boost 1.50, core 2.1.1, cgal 4.0.2, core 1.8 as shipped with cgal, and leda 6.4. With the exception of leda, which comes in a precompiled package, we build all libraries and all experiments in release mode and optimization level
-O3
.3.4.2. Results. To avoid combinatorial blowup, we do not perform experiments