berlin
Technische Universität Berlin
FACHBEREICH 3 MATHEMATIK DISKRETE MATHEMATIK
Mesh Refinement via Bidirected Flows: Modeling, Complexity, and Computational Results by Rolf H. Mo hring Matthias Muller{Hannemann Karsten Weihe No. 520/1996
Sekr. MA 6-1, Straße des 17. Juni 136, D-10623 Berlin - Germany
Mesh Re nement via Bidirected Flows: Modeling, Complexity, and Computational Resultsx Rolf H. Mohring Matthias Muller{Hannemann Technische Universitat Berlin July 1996
Karsten Weihe Universitat Konstanz
Abstract
We investigate a problem arising in the computer-aided design of cars, planes, ships, trains, and the like: Re ne a mesh of curved polygons, which approximates the surface of a workpiece, into quadrilaterals so that the resulting mesh is suitable for a numerical analysis. This mesh re nement problem turns out to be strongly NP -hard. In commercial CAD systems, this problem is usually solved in a greedy{like fashion. However, these algorithms leave the user a lot of patchwork to do afterwards. We introduce here a new global approach, which is based on network ow techniques. In a graph theoretical modeling of the problem we obtain an undirected graph with upper and lower capacities on the edges and some additional node constraints. This model permits local density control without any additional overhead. We reduce this problem to a sequence of bidirected ow problems (or, equivalently, to b-matching problems). For the rst time, network ow techniques are applied to a mesh re nement problem. This approach avoids the local traps of greedy-like approaches and yields solutions that require signi cantly less additional patchwork. Categories and Subject Descriptors: F.2.2 [Analysis of Algorithms and Problem Complexity]: Nonnumerical Algorithms and Problems | computations on discrete structures; G.2.2 [Discrete Mathematics]: Graph Theory | graph algorithms; network problems; J.6 [Computer-Aided Engineering]: Computer-Aided Design General Terms: Algorithms, Design, Experimentation Additional Key Words and Phrases: Mesh generation, templates, NP -completeness, b-matching problem, bidirected ows, augmenting paths
1 Introduction and Background In this paper, we consider a mesh re nement problem arising in the computer-aided design of pieces of trac vehicles, for example, bodyworks or chassis or components of them: A coarse x Preliminary results have appeared in the Proceedings of the Sixth Annual ACM-SIAM Symposium on Discrete Algorithms (1995), pp. 350{359, under the title, \Using network ows for surface modeling." Technische Universit at Berlin, Fachbereich Mathematik, Sekr. MA 6-1, Strae des 17. Juni 136, 10623 Berlin, Germany, e-mail: fmoehring,
[email protected]. The second author was partially supported by the special program \Ecient Algorithms for Discrete Problems and Their Applications" of the Deutsche Forschungsgemeinschaft (DFG) under grant Mo 446/2-2. Universit at Konstanz, Fakultat fur Mathematik und Informatik, 78434 Konstanz, Germany, e-mail:
[email protected]; communicate with the second author.
1
Figure 2: A feasible re nement: reasonably ne, quadrilaterals only, and each side of each polygon consists of a single edge (conforming mesh).
Figure 1: An arti cial instance.
mesh of curved polygons, which approximates the surface of a workpiece, has to be re ned into quadrilaterals such that the resulting mesh can be used for a numerical analysis. See Figs. 3, 8, 10, and 17 for examples taken from practice and Fig. 1 for an arti cial instance, which may be more instructive. This work arose from a cooperation with a Berlin software house, Dr. Krause Software GmbH, which sells a CAD preprocessor, ISAGEN, exactly for this problem [Kr91]. Unfortunately, no formal model is known that really describes the numerical quality of a mesh. Only a few heuristical formulae (and many rules of thumb) are known which roughly approximate this objective. Therefore, a signi cant part of our work was the development of a precise model, which re ects all practical needs satisfactorily. We obtain this model by reducing the problem to a discrete core. This core can be modeled as a graph{theoretic problem and is solved by us using
ow techniques.
Overview.
In the rest of the introduction, we shed some light on the practical background, review the relevant literature, and discuss our approach in the light of this review. The discrete core model is introduced step by step in Sect. 2. Then, in Sect. 3, we reduce the problem to a bidirected ow problem, and we present our algorithm in Sect. 4. In Sect. 5, computational experiences are described, and nally, in Sect. 6, we discuss variants of the problem. Proofs of our NP -completeness theorems can be found in the appendix.
Practical Background.
In principle, computer-aided design proceeds in several stages. In the beginning, the user, who is usually an expert in the application domain, interactively designs a model of the workpiece he has in mind. Once the mesh has been speci ed by the user, the next step is to apply a numerical analysis in order to learn about the physical and technical properties of the workpiece. This includes, for example, vibration and acoustic characteristics, heat transfer, stability, and elasticity. The 2
numerical analysis usually amounts to solving a system of partial dierential equations by means of nite element methods. This provides information about how to modify the input workpiece (i.e., the mesh) in order to improve its physical properties. After the user has modi ed the mesh accordingly, he may run another numerical analysis, which provides new insights, and so on. The whole process is repeated until the physical characteristics of the workpiece satisfy all requirements. A large amount of research has been done in the area of mesh re nement into triangles [Ho88, BE92]. But in many applications, such as torsion problems and crash simulations, meshes which consist solely of quadrilaterals are preferred for numerical reasons. This is the background of our work, and hence, in this paper, re ning a mesh means decomposing each polygon into (strictly convex) quadrilaterals. However, interactively generated meshes are usually not suitable for nite element methods. There are several reasons for this (see [Ho88, SNTM92] for further discussions). 1. The meshes are not ne enough for the numerical analysis to achieve the required accuracy. 2. To ensure certain continuity properties of the stiness matrix in the nite element method, the mesh must be conforming. That is, any two polygons share either a whole side or a single node or are completely disjoint. 3. Interior angles of polygons should neither be too small nor too large (small angles have a negative eect on the condition number of the stiness matrix; the error of the nite element approximation is related to the large angles [BA76, SF73]). As a general rule of thumb, interior angles should not be smaller than 30 and not larger than 150 . The input usually does not ful ll these requirements. For these reasons, the CAD system must rst re ne the mesh according to these requirements, before the numerical analysis itself may take place. This must be done automatically since re ning a mesh by hand is by far too time consuming and prone to error. Roughly speaking, requirement 1 means the following: The ner the nite{element mesh is, the more exact the results of the numerical analysis will be, but the more time the computation will take. However, some regions of the input mesh will require a ner approximation than others for reasonably exact results. For example, this concerns regions where the radius of the curvature is small. In those regions, the target lengths of the edges have to be fairly small. On the other hand, in regions where no diculties occur, the target lengths will be rather large in order not to waste running time. The target lengths for the subdivision only serve as a goal. The actual subdivision may usually deviate from it within certain tolerances. Requirement 2 implies that the individual polygons must not be re ned independently of each other, which could be done if only requirements 1 and 3 had to be satis ed. In fact, the re nement of one single polygon may restrict the possibilities for many other polygons, possibly for all. Hence, the re nements for the individual polygons have to be consistent with each other. More precisely, requirement 2 means that for each edge of the input mesh, all re nements of the incident polygons induce the same collection of additional mesh nodes that lie on, and subdivide, the respective edge. This suggests a two{stage approach: First determine the additional mesh nodes located on the individual edges of the input mesh. Then re ne each polygon separately such that, for each incident edge, the induced additional mesh nodes are exactly the nodes determined in the rst stage. Most (commercial) systems pursue exactly this strategy [Ho88], and so does ISAGEN. However, when doing so, one is faced with yet another problem: It does not suce that the rst stage provides a result induced by a feasible re nement with reasonable numerical properties; it is also necessary that the second stage be able to nd such a re nement. For this purpose, such systems provide 3
Figure 3: The left front wing of a car (instance Figure 4: The re nement produced by our algo(3) in Tab. 1). rithm for the mesh in Fig. 3. a set of so-called templates for re ning a single polygon, which we shall describe later in Sect. 2 in detail (cf. Fig. 6). Based on these templates the second stage, that is, re ning the individual polygons separately according to the templates, is then a relatively easy task, and satisfactory algorithms have already been designed for this stage. It is the rst stage that makes the problem hard, and exactly this is the problem we will consider in this paper.
Previous work.
Little is known about this problem, in general. Both scienti c and commercial systems are based on heuristics. See [Ho88, SNTM92] for a survey of the whole domain. All these heuristics proceed as follows (to the best of our knowledge). Polygons are re ned one at a time, where rst the additional mesh nodes on the boundary are determined, and then additional lines are drawn through the interior of the polygon. In this process, the subdivision points introduced for previously re ned polygons impose an increasing number of new restrictions on the remaining polygons. Quite often, a heuristic like this runs into a dead-end, although the input instance itself may be solvable. Some of the heuristics get stuck in this case, and other heuristics modify some of the previous re nements in order to resolve the con ict. Furthermore, some heuristics apply yet another strategy, namely, early enough before a con ict may occur, they apply some additional \emergency" templates to polygons, which have inferior numerical properties, but do not impose further restrictions on the re nements of the remaining polygons. However, when applying such an algorithm to an instance taken from practice, typically several polygons remain unre ned (or unacceptably badly re ned). As a consequence, still a considerable amount of interactive work remains to be done by the user. This kind of patchwork by hand usually takes a lot of time, because the (correct) re nements of other polygons must be changed, too, in order to make re nements of the unre ned polygons possible. (By patchwork we mean all interactive attempts by the user to improve the mesh quality. Its success highly depends on the experience and cleverness of the user.) Another approach, by Tam and Armstrong [TA93], goes beyond the usual greedy{like strategies. They have formulated a similar problem as an integer linear program and applied an ILP solver to small examples. However, they did not report experiences with real-world instances. There are several drawbacks to their approach. Firstly, practical instances often consist of 4
hundreds or thousands of polygons, and the resulting integer linear programs are quite large. To solve such a program might take an unacceptable amount of time. Secondly, it is not clear at all how to select a good template for each polygon. The authors do not consider this problem in detail, they simply x, in advance, the template for each polygon. However, incorporating the choice of the templates in the linear model might enlarge and complicate the program considerably (if there is an appropriate linear formulation at all). Finally, in a linear programming approach, the objective function must be linear or at least allow a linear reformulation.
A new approach.
In retrospect, all these problems with previous work are not surprising at all, since we will show that the problem is strongly intractable. All one can hope for is a method which solves most practical instances satisfactorily, and otherwise, leaves only little additional patchwork to do. Fortunately, this is not beyond all hope, because the instances used to prove intractability are fairly pathological. In fact, instances from practice seem to be much easier and much better accessible, in general. Our practical experiences suggest that our algorithm might always provide|after a reasonable amount of time|a solution that requires no or only little patchwork (no patchwork at all in all benchmarks tested in Sect. 5). In contrast to the approach of Tam and Armstrong, the exible choice of the templates is an integral part of the algorithm, and the shape of the objective function does not matter. From our algorithmic approach one can easily derive an exact algorithm as well, for example using branch{and{bound or dynamic programming techniques. In contrast to the greedy{like heuristics outlined above, we have developed a kind of global approach. The intuitive idea behind our algorithm is that we repeatedly add new lines to the current re nement (or modify previously inserted ones) which may pass through many polygons. Recall that subdividing the edges of the mesh is our only concern. Adding or modifying whole lines immediately translates to placing, moving, or removing subdivision points. This means that we do not completely re ne one polygon at a time. Instead, each step of our algorithm aects a chain of polygons, where any two subsequent polygons touch (repetitions allowed). As we may also remove subdivision points set at previous stages, such a step does not necessarily make the re nement of a polygon ner; the eect may be a correction of the current re nement of that polygon. Therefore, no decision is xed once and for all, although we do not apply expensive backtrack or \emergency" operations. This basic idea leads to a sequence of subproblems which can be stated as a certain generalization of the feasible circulation problem on undirected graphs. This generalization is known as the feasible ow problem in bidirected graphs (bidirected ow problem) and is equivalent to the b{matching problem. See [AMO93] for a survey of network ows and, in particular, for a discussion of the feasible circulation problem, and see [Ed67, De88] especially for bidirected ows and b{matchings. The notion of ow augmenting paths can be generalized to our problem: The idea to add or modify single lines over several polygons translates into a kind of augmenting path algorithm.
2 An Exact Model
The input: a coarse mesh.
In our application, a workpiece is modeled as a two{dimensional mesh of curved, convex, openly disjoint triangles and quadrilaterals in the three{dimensional space, the so-called macro elements. For convenience, we will always identify a mesh like this with the undirected graph G = (V; E ) formed by the boundaries of the polygons. That is, V is the set of all nodes of polygons, and 5
the edge set E is formed by common intervals of two or more polygons on their boundary. More precisely, an edge is an inclusion{maximal interval such that all internal points of that interval are shared by the same polygons. The polygons themselves are henceforth called the faces of G. Note that the graph G of a mesh need not be planar; for example, a mesh approximating the surface of a torus has genus one. Even more, a mesh may contain folding edges, that is, edges incident to more than two polygons (Fig. 5).
Figure 5: A small mesh with 7 faces, 16 nodes, and 22 edges ( ve of them are folding edges).
Templates.
A template (sometimes also called meshing primitive [TA93]) is a pattern which describes how a single polygon can be decomposed into triangles or quadrilaterals. As explained above, we consider in this paper only templates which are designed such that each polygon is re ned exclusively into quadrilaterals. Fig. 6 shows the standard templates for decomposing triangles and quadrilaterals into quadrilaterals. This is the set of templates we consider in this paper. (Variations of the set of templates will be brie y discussed in Section 6.) Let Ni denote the nal number of mesh nodes (i.e., nodes of G and additional subdivision points) on the i-th side of the polygon in counterclockwise order, see Fig. 6. We say, a quadrilateral can be re ned according to
Template (1) if N1 = N3 and N2 = N4, Template (2) if N1 = N3 and N2 N4 (mod 2), but N2 6= N4 , Template (3) if jN1 ? N3j = jN2 ? N4j, and N1 6= N3 . Finally, a triangle can be re ned to the standard Template (T) in Fig. 6 if and only if
N1 = a + b + 1; N2 = a + c + 1, and N3 = b + c + 1 for some nonnegative integers a; b; c.
The construction principle of template (1) is obvious. Each of the other templates is characterized by a speci c planar, embedded graph, the \skeleton," which is formed by the edges highlighted in Fig. 6 (incl. the sides of the polygon). All inner faces of such a skeleton are quadrilaterals and internally re ned according to template (1). The skeleton of template (2) has four inner faces, and the skeletons of templates (3) and (T) have three inner faces. It is easy to verify that, if the values Ni ful ll the corresponding template condition, then the inner faces may be re ned according to template (1) such that the quadrilateral is conformally re ned as a whole. Remember that the core problem in the rst stage is to nd subdivision numbers for all edges of the input mesh such that at least one template applies to each face. At this point, we can give a preliminary formulation of our mesh re nement problem. This is the problem we were given, and for which we had to nd a satisfactory formal model. The formulation uses some informal terminology, for which no fully formal speci cation is known.
Problem 2.1 (Mesh re nement - preliminary formulation) Given an input mesh consisting of triangles and quadrilaterals, and the set of templates shown in Fig. 6, nd a subdivision of
6
(1)
(2)
N2
N2
N3
N1
N1
N3
N4
N4
(3) N
(T)
2
N1 N3
N2
N3
N4 N1
Figure 7: The auxiliary network G~ = (V~ ; E~ ) for a one{face instance, induced by the corresponding template, respectively. The short solid line going through a transshipment node indicates the partition of its adjacency list into two parts (cf. Sect. 3).
Figure 6: The standard templates for quadrilaterals and triangles. The decomposition of templates (2), (3) and (T) into quadrilateral faces (the \skeleton"), which are internally re ned according to template (1), is highlighted.
all edges such that each polygon can be re ned by one of the templates, the resulting re nement is conforming, and it satis es certain constraints on its density. In addition, numerical aspects, e.g. avoidance of pathological angles, induce an objective function which should be optimized by the solution. As a rough rule of thumb, the more \regular" the structure of the mesh, the better its numerical properties are.
Figs. 13 and 14 illustrate this rule of thumb. Based on many long discussions with the engineers, we have developed an exact model, which satis es the three substantial requirements: It re ects all numerical needs, which are given only as rules of thumb; it is suitable for a purely discrete approach; and it can be easily adapted to changes of the numerical needs. (Sect. 3 demonstrates that the second requirement is achieved; see Sect. 6 for the importance of the last requirement.) This model is the basis for everything to follow. In this model, an instance of the problem is given as an undirected, biconnected graph G = (V; E ), and a set H = T [ Q of triangles and quadrilaterals, the faces of G. For each edge, we are given the set of all incident faces. Conversely, for each face we are given the set of all incident edges. The latter set is subdivided into three or four subsets, namely, one for each side of the face. Each of these subsets is sorted according to the order of the edges along the face. Moreover, for each edge e 2 E we know its length Le, and we have three additional numerical parameters, namely its target length Ltarg e , a lower tolerance factor e , and an upper tolerance factor e , with e 1 e . This set of parameters models what \reasonably ne" means for a 7
Figure 8: Part of the chassis of a car modeled by a mesh of curved polygons (instance (7) in Tab. 1).
Figure 9: The re nement produced by our algorithm for the mesh in Fig. 8. single edge and is the result of a compromise between exactness and running time of the numerical analysis. More precisely, the additional points on an edge e 2 E must subdivide e such that the targ is length of each resulting segment is at least Ltarg e e and at most Le e . This requirement Le e ? 1 translated into lower and upper bounds on the subdivision numbers, we set ` (e) := d Ltarg e e Le c ? 1, for each edge e. and u (e) := b Ltarg e e A subdivision close to Ltarg e is preferred. Suitable parameter values for the tolerances are e = 1=2 and e = 2. Denote by x(e) the subdivision number of edge e. We are now ready to state the feasibility version of the mesh re nement problem with standard templates. This formulation is already purely discrete.
Problem 2.2 (Mesh re nement) Given an input mesh consisting of triangles and quadrilaterals, in form of an undirected graph G = (V; E ) and a set H = T [ Q, the parameters Ltarg e ; e ; and e for all edges, nd subdivision numbers x(e) for all edges such that each macro element ful lls one of the template conditions and the subdivision numbers are in the interval [`(e); u(e)], for all edges e. This problem is already highly intractable:
Theorem 2.3 The problem of nding a feasible solution to Problem 2.2 is strongly NP {hard. This is true even if we impose two restrictions simultaneously: rstly, we do not allow folding edges, and secondly, each of Ltarg e ; e ; and e is a global value independent of e 2 E . Proof: Reduction from a variant of SATISFIABILITY, see Appendix. 8
2
Figure 10: Model of a pump (instance (9) in Tab. 1).
Figure 11: Re nement of the pump by our code.
Objective functions.
Now we turn our attention to the objective function. The quality of a feasible solution depends essentially on the templates chosen for the individual polygons (i.e., for the quadrilaterals, because there is only one template for triangles). Whether a template is regarded as being good or bad for a single quadrilateral in turn depends essentially on the quadrilateral's shape. As a rule of thumb, the more a quadrilateral looks like a parallelogram, the better template (1) will be. The more a quadrilateral looks like a trapezoid, the better template (2) will be. Finally, if neither is true, template (3) will be the best. In a rst approach, we model this rule of thumb by penalizing bad choices of templates for quadrilaterals, and the objective function is the sum of the penalties of all quadrilaterals. From a theoretical point of view, this models the quality of the mesh only roughly. In fact, the \real" objective function does not only depend on choices of templates, and it is certainly not separable as a sum of objective functions for the individual polygons. However, the \real" objective function is not known, and our experiences show that our de nition of the objective function|in conjunction with our rigid conditions for the density of the mesh|produces solutions with a good regular structure and with good angles. The exact formulation of the objective function is subject to still on{going computational experiments. But this does not present a problem, because Sect. 4 will show that modi cations of the objective function do not aect the formulation of the rest of the algorithm (this is in contrast to a linear programming approach, for example). To model the above rule of thumb for the choice of templates, we consider two parameters, q1 and q2 , for each quadrilateral q 2 Q. These parameters describe the shape of q: q1 is the ratio of the lengths of two opposite sides of q, and q2 , that of the other two sides. Without loss of generality, we assume q1 q2 1. Now if both q1 and q2 are close to 1, template (1) is favorable; if only q2 is close to 1, template (2) should be chosen, otherwise template (3). For i = 1; 2; 3; we punish the choice of template i for q with fi (q1 ; q2 ), where f1 is monotonously increasing in q1 , f2 in q2 =q1 , and f3 in 1=q2 . Consider a feasible solution where template iq 2 f1; 2; 3g is chosen for each quadrilateral q 2 Q. Then the value of the objective function for 9
P
this solution is q2Q fiq (q1 ; q2 ). This model re ects the above rule of thumb for good choices of templates and leaves enough degrees of freedom for ne tuning. The latter is important in view of Sect. 6. For our current computational results, we used linear functions fi (which seems to be sucient, but may not be the best choice). In view of Theorem 2.3 there is not much hope of nding an ecient algorithm for the optimization problem. Even worse, Theorem 2.4 shows that optimization is strongly NP {hard even if at least one feasible solution is easy to obtain. Furthermore, this remains valid for the special case where no folding edges occur.
Theorem 2.4 Given an instance of Problem 2.2, a solution for this instance, and a value k, it is still strongly NP -complete to determine whether or not there is a solution having a value of at most k. This remains true for instances without folding edges and where Ltarg e ; e ; and e are global values independent of e 2 E . Proof: Reduction from 3-EXACT-COVER, see Appendix. 2
3 Reformulation as a Bidirected Flow Problem. The basic idea underlying our discrete model is a reduction to a sequence of instances of a certain graph problem, which is equivalent to the bidirected ow problem [Ed67, De88]. An instance in this sequence is induced by xed templates for all quadrilaterals and by a xed number of subdivision points for each folding edge. Such an instance is solvable if and only if there is a re nement of the mesh subject to these choices of templates and of subdivision points of folding edges. We will give the details of this procedure in Sect. 4. Here we present the variant on the bidirected ow problem and its correspondence to mesh re nement. Variant on bidirected ows. Let G~ = (V~ ; E~ ) be an undirected graph (loops allowed), and for e~ 2 E~ let ue~ `e~ 0 be the upper and lower capacity of edge e~. The nodes with degree one are henceforth called the terminals, and the other nodes are called transshipment nodes. For each transshipment node v~ 2 V~ , the set of all incident edges is partitioned into two parts, P1 (~v) and P2 (~v). We de ne (Pi (~v)) as the set of edges having exactly one end in Pi (~v), and
(Pi (~v)) as the set of edges having both ends in Pi (~v) (in particular, (Pi (~v)) consists solely of loops). A weighting (x (~e))e2E~ of all edges is a solution to our problem if and only if 1. `e~ xe~ ue~ for each edge e~ 2 E~ (edge capacity constraints ). X x (~e) + 2 X x (~e) = X x (~e) + 2 X x (~e) 2. e~2(P1 (~v))
e~2 (P1 (~v))
e~2(P2 (~v ))
e~2 (P2 (~v ))
for each transshipment node v~ 2 V~ ( ow conservation conditions ). This completes the description of the bidirected ow problem. Assume now that the templates for all quadrilaterals and the number of subdivision points of all folding edges are xed. We next show how the instance induced by these xed choices is de ned. An example is shown in Fig. 12, and the underlying construction principle for the graph G~ = (V~ ; E~ ) is demonstrated in Fig. 7 for all possible instances induced by a mesh that consists of a single macro element. First we give an informal, intuitive explanation. Then we de ne the correspondence rigorously. 10
Instance induced by xed choices: intuition. Roughly speaking, the bidirected ow network
G~ is some kind of \multiple{source dual graph" of G. Usually, a multiple{source dual graph Gd = (V d ; E d ) is de ned only if G is planar. In this case, Gd is de ned according to a subset F of all faces of G [RWW95]. The multiple{source dual graph with respect to F = ; is the normal dual graph. For F 6= ; and f 2 F , the node of Gd in the normal dual graph is replaced by one node for each incident edge e 2 E , and the dual edge crossing e is incident to this node.
To apply this notion, the reader should imagine that the mesh is \cut" along all folding edges. In other words, each folding edge is replaced by one edge for each incident macro element, and all these edges are pairwise disjoint. (For example, the mesh in Fig. 5 decomposes into three meshes.) After this imaginary operation, the graph is not necessarily planar. But since each edge of the mesh is now incident to one or two macro elements, the de nition of dual graphs can be straightforwardly extended. The holes and boundaries of the workpiece form the set F . However, the single dual node inside a macro element is replaced by a subgraph of G~ . (In the formal description below, the union of these subgraphs is (V~ 1 [ V~ 2 [ V~ 5 ; E~ t [ E c ).) For each side of the macro element such a subgraph has an associated transshipment node (nodes in V~ 1 ). If two macro elements are neighbored, the transshipment nodes associated with the common edge of the mesh are connected by a dual edge (edges in E~ 2 ). If a macro element is neighbored to a boundary or hole of the workpiece, the transshipment node associated with this edge is connected with the corresponding \source" (node in V~ 3 , edge in E~ 1 ). The template chosen for a macro element determines whether or not two transshipment nodes inside a macro element are connected by an edge: Roughly speaking, they are connected if and only if the template allows that lines go through the polygon and connect the sides associated with these nodes. If so, the weight x() of the connecting edge is to be interpreted as the number of these lines. Note that in template (2) there is one single side such that lines may go from this side back to the same side (incl. the internal lines of the skeleton that hit this side). This is modeled by the loop at the associated node. Finally, if a node of G subdivides a side of a macro element, we introduce this node and an edge connecting this node to the subgraph of the macro element (nodes in V~ 5 and edges in E~ c ). Instance induced by xed choices: formal de nition. Remember that the templates for all quadrilaterals and the number of subdivision points of all folding edges are assumed to be xed. For the mesh G = (V; E ) and i = 1; 2; 3; : : :, let E i denote the set of all edges that are incident to exactly i macro elements. Nodes of G~ : In general, the set V~ consists of ve dierent kinds of nodes, V~ = V~ 1 [V~ 2 [V~ 3 [V~ 4 [V~ 5 . The set V~ 1 consists solely of transshipment nodes, namely: For a macro element M with 1 ;:::;v 1 i is associated with the ith i sides, we have the nodes v~M; ~M;i 2 V~ 1. We say that v~M;i 1 side of M . The set V~ 2 consists solely of terminals, namely three terminals, v~T;2 1, v~T;2 2, and v~T;2 3, for each triangle T . The set V~ 3 consists solely of terminals, too, namely one terminal v~e3 for each edge e 2 E1. The set V~ 4 consists solely of terminals: For each edge e 2 Ek with k > 2, there are k terminals 4 2V ~ 4 , each associated with exactly one of the macro elements that are incident v~e;4 1 ; : : : ; v~e;k 4 . 4 associated with macro element M is also denoted by v ~e;M to e. The node v~e;k Finally, the set V~ 5 consists solely of terminals, namely one terminal v~M;i;j for the j th node of the mesh G that is an interior node of the ith side of macro element M . (These nodes are 11
highlighted in Fig. 1.) Edges of G~ : Next we are going to de ne the set E~ = E~ 1 [ E~ 2 [ E~ 3 [ : : : [ E~ c [ E~ t . For i > 0, the edges in E~ i correspond to the edges in E i , and for i = 1; 2, this is even a one{to{one correspondence. Roughly speaking, the edges in E~ c are introduced to enforce conformality, and the edges in E~ t , to enforce the template restrictions. For an edge e 2 E 1 incident to the ith side of macro element M , there is an edge in E~ 1 1 connecting v~M;i with v~e3 .
For an edge e 2 E 2 incident to the i1th side of macro element M1 and to the i2 th side of
1 1 macro element M2 , there is an edge in E~ 2 connecting v~M with v~M . 1 ;i1 2 ;i2 For k > 2, an edge e 2 E k , and a macro element M such that e belongs to the ith side of M , 1 4 . there is an edge in E~ k connecting v~M;i with v~e;M 1 5 For all M , i, and j , there is an edge in E~ c connecting v~M;i with v~M;i;j .
For each macro element, there are a few edges in E~ t , which are de ned by the choice of the
template for this macro element. These de nitions are depicted in Fig. 7: For a triangle T , 1 ;v 1 g for all i; j = 1; 2; 3, i 6= j , and we have the edges fv 1 ;v 2 g we have the edges fv~T;i ~T;j ~T;i ~T;i 1 ;v 1 for i = 1; 2; 3. For a quadrilateral Q with template (1), we have the edges fv~Q; 1 ~Q;3 g and 1 ;v 1 fv~Q; 2 ~Q;4 g. If template (2) is chosen for Q with N1 > N3 , say, we have an additional loop 1 . Finally, if template (3) is chosen and if N > N and N > N , say, we at the node v~Q; 1 3 2 4 1 1 1 . have an edge connecting v~Q; with v ~ 1 Q;2
1 Partitions : For each node v~M;i 2 V~ 1 , the incident edges are partitioned into edges in E~ t and edges in E~ n E~ t = E~ 1 [ E~ 2 [ E~ 3 [ : : : [ E~ c .
Capacities :
For an edge e~ 2 E~ 1 [ E~ 2 let e 2 E 2 be the corresponding edge of the mesh. Then we set L e ? 1 and u (~e) := b targ L ` (~e) := d Ltarg L c ? 1. e
e
e
e
e
e
For k > 2, an edge e~ 2 E~ k is associated with a folding edge in E k . The upper and lower
capacity of e~ are set equal to the value xed for this folding edge. An edge e~ 2 E~ c gets u(~e) = `(~e) = 1. Now let e~ 2 E~ t . If e~ is incident to a node in V~ 2, we set u(~e) = `(~e) = 1, otherwise we set u(~e) = +1 and `(~e) = 0.
The following proposition shows that, for a xed choice of templates and subdivision numbers on folding edges, the mesh re nement problem reduces to a bidirected ow problem.
Proposition 3.1 For a xed choice of templates and subdivision numbers on folding edges, the mesh re nement problem is solvable if and only if the corresponding bidirected ow instance as de ned above has a feasible solution. For an edge e 2 E and the corresponding edge e~ 2 E~ , the weight x(~e) equals the number of subdivision points placed on e in the corresponding solution to the mesh re nement problem.
12
Figure 12: The auxiliary graph G~ = (V~ ; E~ ) for the instance in Fig. 1 and for the choice of templates in Fig. 2.
Proof: The capacities on the edges in E~ 1 [ E~ 2 are a plain reformulation of the length restrictions
on the mesh itself. The capacities of the edges in E~ i for i > 1 re ect the xed choices of subdivision numbers for folding edges. 1 ;:::;v 1 Obviously, the ow conservation conditions for the nodes v~Q; ~Q; 1 4 for a quadrilateral Q ~ with template (1) are ful lled if and only if the edges of G leaving Q ful ll the conditions for template (1). The additional loop for template (2) relaxes these conditions, namely that N1 > N3 is allowed, too, but N1 ? N3 is an even number. This is exactly the condition of template (2). For template (3), the x{value of the additional, template{speci c edge in E~ t equals jN1 ? N3 j and also equals jN2 ? N4 j, and hence the condition for template (3) is ful lled. Finally, consider a triangle T . The condition for template (T) requires that there are a; b; and c such that N1 = a + b + 1, N2 = a + c + 1, and N3 = b + c + 1. We set a = x(fv~T;1 1 ; v~T;1 2 g), b = x(fv~T;1 1 ; v~T;1 3 g), and c = x(fv~T;1 2 ; v~T;1 3 g). The three edges incident to the three interior terminals x the condition for template (T). We conclude the proof by noting that the capacities of the edges in E~ c ensure that the induced re nement of the mesh is conformal. 2
4 The Algorithm We will now formulate the algorithm on an abstract level. The following description of the algorithm does not completely correspond to our actual implementation, but might better reveal the underlying ideas and principles. In the beginning, we \guess" a good choice of templates and of subdivisions of all folding edges. This choice de nes a bidirected ow instance as described above. We try to solve this problem, and if we succeed, we start a second phase, where we try to improve the current solution. Otherwise, we try to nd the \bottlenecks" that cause the trouble. We try to get rid of these bottlenecks by slightly modifying our initial choices. This de nes a modi ed bidirected ow instance, which should be \closer" to feasibility. We 13
try to solve the new instance, and so forth. This is repeated until a good solution is found or a xed time limit is exceeded. In the latter case, the algorithm returns the best solution seen over all iterations. In this case, the user will still have to do some patchwork. But the better the output is, the less work is left to do. Here is a more formal description.
High{level description of the mesh re nement algorithm: 1. Construct heuristically a good initial choice of all templates of quadrilaterals and of the subdivisions of all folding edges ; 2. repeat (a) construct the auxiliary ow network corresponding to the current choices of templates and subdivisions of folding edges ; (b) solve the bidirected ow instance ; (c) if current solution not feasible then modify the current choices slightly to abandon bottlenecks in the auxiliary ow network ; until solution is feasible or the time limit is exceeded ; 3. try to improve the solution by an analogous repeat{sequence ; 4. if solution feasible then return solution else return least infeasible \solution" seen . This completes the high{level description. We will now ll in the details.
Solving the bidirected ow problem.
The bidirected ow problem can be reduced to a (capacitated) perfect b-matching problem. Several polynomial algorithms have been developed for the latter problem [Pu73, An87, MP95]. They all are based on augmenting paths, but unlike for ordinary ows in networks, so{called blossoms must be treated specially. For several reasons, we have instead implemented a suitable, heuristic adaptation of the augmenting path search, which works on the bidirected ow problem itself: Firstly, all blossom shrinking solvers for the b{matching problem work on complicated data structures and algorithmic techniques, which make maintenance hard for our partners. Secondly, a polynomial asymptotic complexity does not guarantee a good practical performance. Thirdly, the direct solution allows a better incorporation of heuristic insights into the original problem, which is crucial for a good practical performance. Therefore, we decided to avoid the treatment of blossoms and to develop an algorithm which is easy to implement, to maintain and to adapt to related problems, but, nonetheless, yields very good practical results. Since the b{matching problem is so closely related, the following algorithm translates to the b{matching problem immediately. Our algorithm for the auxiliary bidirected ow problem generalizes a common approach to the feasible circulation problem. We start with a weighting x () of E~ which satis es the capacity constraints but not necessarily the ow conservation conditions at the transshipment nodes. The imbalance of a transshipment node v~ 2 V~ with respect to a given weighting x () is the (absolute) amount by which the ow conservation conditions are violated. Clearly, for each edge e~ 2 E~ with ` (~e) = u (~e), we set x (~e) to this value. Any edge e~ 2 E~ 1 [ E~ 2 is given the weight that best approximates the target length of the corresponding edge e 2 E 1 [ E 2 : 14
x (~e) := round (Le =Ltarg e ) ? 1. The initial values of the other edges are de ned to get as \close" to
the template conditions as possible. After that, we repeatedly modify x such that, after each iteration, the edge capacity constraints are still satis ed, the imbalance of no transshipment node is increased, and the imbalance of at least one transshipment node is strictly reduced. As mentioned in the introduction, the notion of augmenting path generalizes to this network ow problem. In each iteration, we modify the ow along such an augmenting path. This ensures that the balance of no internal node on this path is changed by this augmentation. Moreover, in each case, we select the path such that the imbalance of neither end-node increases and the imbalance of at least one end-node decreases. However, unlike in usual ow problems, the augmenting paths are not simple paths, because they may contain nodes and even edges more than once. Therefore, we de ne augmenting \paths" only as sequences of nodes and edges. Each edge in such a sequence is labeled with a sign, that is 0 +0 or 0 ?0 . Augmenting the ow along such a path by a value > 0 means the following: If the sign of an edge is 0 +0 , we increase the weight on this edge by , otherwise we decrease it by . If an edge is contained more than once in the path, these eects are summed up. In other words, the value of the edge is changed by a multiple of , namely the number of occurrences with a 0 +0 minus the number of occurrences with a 0 ?0 . De nition 4.1 An augmenting path P in G~ is a sequence (~v0 ? e~1 ? v~1 ? ? v~k?1 ? e~k ? v~k ), with associated signs 1 ; : : : ; k 2 f0 +0 ; 0 ?0 g, which ful lls the following properties: 1. Each edge e~i is incident to the nodes v~i?1 and v~i , i = 1; : : : ; k. 2. For an edge e~, let e~ denote the number of indices i with e~ = e~i and i = 0+0 minus the number of indices i with e~ = e~i and i = 0?0 . If e > 0, we have x (~e)+e~ u (~e), otherwise we have x (~e) + e~ ` (~e). 3. a) Node v~0 is an imbalanced transshipment node, and augmenting the ow along the path by a suciently small value > 0 reduces the imbalance of v~0 . b) If the end-node v~k is a transshipment node, too, then v~k is imbalanced, and the augmentation along the path reduces the imbalance of v~k as well. 4. Each of the nodes v~1 ; : : : ; v~k?1 is a balanced transshipment node. For i = 1; : : : ; k ? 1, e~i and e~i+1 belong to the same partition set in the adjacency list of v~i if and only if i 6= i+1 . It is easy to see that it suces to consider only those augmenting paths where no edge appears more than once in each direction (otherwise the path could be short{cut). Therefore, the augmenting paths can be determined by a straightforward variation of depth{ rst search, which inspects each edge at most four times: at most once in each direction, and in each direction at most once for increasing or decreasing the ow value. Obviously, this variation of depth{ rst search has linear run time. This ecient search may miss augmenting paths, because it does not treat blossoms in a special way. However, it seems that in practice this eect does not occur. A computational study on the translation of this ecient heuristic to cardinality matching can be found in [MM95]. Our bidirected ow algorithm may now be formalized as follows.
Bidirected ow algorithm: 1. for e~ 2 E~ do if e~ crosses some e 2 E then x (~e) := round (Le=Ltarg e )?1 else x (~e) := \close to template conditions" ; 2. failed := FALSE ;
15
3. L := the list of all imbalanced nodes ; 4. while L 6= ; do (a) let v be an imbalanced node ; (b) try to nd an augmenting path starting with v ; (c) if failure then i. remove v from L ; ii. failed := TRUE ;
else
i. augment ow along p ; ii. if an end-node of p is now balanced then remove it from L ;
5. return failed ; The list L is roughly sorted according to increasing values of the imbalances. That is, rst we try to balance the almost balanced transshipment nodes, and the heavily imbalanced nodes only afterwards. This means that we rst consider the imbalanced nodes that can, probably, be balanced. And the nodes that are likely to be the true bottlenecks remain imbalanced throughout the network ow algorithm and can, hence, be easily identi ed later on.
Filling in all remaining details.
It remains to show how to realize steps 1, 2c, and 3 in the high{level description of the algorithm. In step 1, for each quadrilateral we simply choose the template that ts its shape best. We slightly overemphasized the preference of template (1), as template (1) always allows a realization of interior angles which are not worse than the ones already contained in the original macro element. In addition, template (1) tends to produce fairly regular meshes. Last but not least, template (1) as the initial choice is preferable from a technical point of view: The bidirected ow algorithm usually produces a solution such that each quadrilateral misses the condition for the chosen template by only a little. Since the conditions for templates (2) and (3) are relaxations of the condition for template (1), switching from template (1) to (2) or (3) guarantees that this failure does not increase. In step 2c, we look for quadrilaterals that currently have an imbalanced transshipment node inside. As we start for all quadrilaterals with the template which is best with respect to the objective function, we want to change as few templates as possible. Thus we select only a subset of quadrilaterals with imbalanced nodes, and change the templates prescribed for them. This is justi ed by our rule to balance the nodes rst that are likely to be no real bottlenecks. The nodes that could not be balanced are probably bottlenecks and, thus, changing the templates of these quadrilaterals will probably remove bottlenecks and result in a \less unsolvable" bidirected ow instance. For each folding edge e, we initially choose the weight x (~e) that approximates its target length targ Le best. For changing values of folding edges, only an experimental heuristic has been implemented so far. If we cannot nd a solution by switching between templates, we increase the weighting of some folding edge by one. If this results in an improved solution to the corresponding bidirected ow problem, we accept such a change, otherwise we go back to the former weighting and try the same with some other folding edge. Finally, consider step 3 of the algorithm. In step 3, we use the objective function to modify the bidirected ow instance analogously to the loop in step 2c. We repeatedly select some macro element and switch the currently chosen template to one which implies an improved objective 16
Figure 13: Re nement of the wheel casing instance by the built{in procedure of ISAGEN (instance (4) in Tab. 1). Four macro elements could not be re ned - they appear as \white holes."
Figure 14: Re nement of the wheel casing instance by our code. Engineers prefer this re nement over that of Fig. 13 also because of its regular structure.
value. If the induced bidirected ow problem is still feasible, we accept such a change, otherwise we go back to the former choice of templates and try the same with some other macro element. It has turned out that (at least for the instances tested by us) this simple strategy suces to achieve solutions with good angles and a regular structure. This is not surprising, since we start with optimal templates and are very conservative in adopting worse templates. This completes the description of the algorithm. We note that all parts of the algorithm except for the general structure given by the formal description of the main algorithm are still subject to on-going research.
5 Computational Experiences We have implemented our algorithm on a Sun Sparc station under SunOS 5.1. The programming language is C++, and we used the GNU compiler by the Free Software Foundation, Inc. Some basic data structures of LEDA [MN95] have been used for implementing the algorithm. Our front end is ISAGEN. In some points, our implementation diers from the description in Sect. 4 in order to speed up the algorithm. For example, we do not have terminals in our auxiliary network, but work with modi ed ow conservation conditions. We now present the results of applying this implementation to a variety of problem instances. The rst thirteen mesh instances listed in Tab. 1 all stem from practice and are used by German car manufacturers for testing CAD systems oered by software houses. We also tested our algorithm on a large-scale arti cial instance. This arti cial instance, namely instance (14) in Tab. 1, is designed to contain special features that are regarded as being dicult, such as a complicated folding structure, closed surfaces, or extreme dierences of edge lengths. To be more precise, instance (14) is built up by highly non-conforming planar meshes, which are glued together to 17
macro elements instance 1) axle 34 2) bowl 24 3) wing 131 241 4) wheel casing 5) hutze 251 68 6) rack 7) chassis 164 8) coolsyst 531 161 9) pump 10) bend 608 11) vw4 356 180 12) rod 13) benz 103 14) cubes 2880 ]
]
folding edges 1 0 0 2 0 0 38 115 7 0 116 0 0 48
desired edge length 20 20 10 10 10 30 20 10 20 10 30 10 30 2
T 6 2 16 26 42 0 9 32 7 6 0 25 13 0
realized templates in our code in ISAGEN 1 2 3 E 1 2 3 E H 22 4 2 0 24 2 2 0 0 22 0 0 0 21 0 0 1 0 90 19 6 0 80 20 9 6 0 185 9 21 0 139 35 26 11 4 155 18 36 0 119 34 31 25 0 65 0 3 0 56 4 8 0 0 130 10 14 1 127 9 14 5 0 405 47 43 4 414 17 32 34 2 143 6 5 0 117 16 7 7 7 602 0 0 0 556 11 6 29 0 301 5 41 9 328 6 14 8 0 148 2 5 0 141 8 6 0 0 82 3 5 0 72 5 2 11 0 2818 62 0 0 2142 23 188 527 0
Table 1: Results for real-world instances (except the last). The fth column gives the number of triangles (T) among the macro elements, (E) gives the number of quadrilaterals for which the emergency template has been used, (H) refers to the number of those macro elements which could not be re ned at all by ISAGEN. form closed surfaces and foldings. This instance is used to study the behavior of our algorithm under such circumstances. The sizes of the instances range from 24 up to 2880 macro elements. The third column in Tab. 1 contains the number of folding edges of an instance. For each of the real-world instances the engineers gave us some globally de ned, desired mesh density. For all instances, the values for the tolerances we used are e = 1=2 and e = 2. The computational results of Tab. 1 are based on these mesh densities and tolerances. In addition to the templates in Fig. 15, ISAGEN supports an \emergency" template (E), which can be applied in certain cases when none of the standard templates conditions is ful lled. This feature is hard{wired, so for a realistic comparison, we allowed our algorithm to use this emergency template, too. Template (E) should be avoided for numerical reasons, but it does not necessarily cause additional patchwork. This is in contrast to those cases where no template applies at all, denoted by (H), as this corresponds to a \hole" in the re nement. The results we obtained so far are very encouraging. See Figs. 14 and 13 for an example of the re nements produced by our code and by ISAGEN. Using the desired mesh density, all examples could be re ned completely with the standard templates plus the emergency template (E). (For that reason we could omit column (H) for the results of our own code.) In all cases, the great majority of quadrilaterals could be re ned according to template (1). Since the structures of our solutions are very regular, engineers seem to agree that only little or no additional patchwork is necessary for \beautifying." Compared with ISAGEN, our code gave better solutions with respect to the avoidance of the emergency template (E) or unre ned \holes" (H) in all but one case (namely instance (11)). ISAGEN had to use much more often its emergency template (E). In several cases, ISAGEN even left macro elements completely unre ned (the corresponding number is given in the last column of Table 1), which never happened with our algorithm. Once more we should emphasize that our code allows a strict control of the realized mesh 18
] macro ] folding desired realized templates edges fe-length 1 2 3 E instance elements 3) wing 131 0 10 90 19 6 0 131 0 5 98 11 6 0 131 0 20 107 4 4 0 7) chassis 164 38 20 130 10 14 1 164 38 10 107 22 23 3 164 38 40 136 4 15 0 8) coolsyst 531 115 10 405 47 43 4 531 115 5 368 73 53 5 531 115 20 449 16 23 11 Table 2: Variation of required mesh density for the examples in Figs. 8, 3, and 17 . density. ISAGEN, however, does not permit such a control and tends to produce meshes which are by far ner than desired. In instance (4) (see again Fig. 13), for example, the re nement produced by ISAGEN has more than 3000 edges which are shorter than 2.5 times the desired target length. Recall that our choice of tolerances guarantees the edge lengths to be within a factor of 2 of the desired target length. Those instances which possess a complicated folding structure and closed surfaces, such as (6), (8), and (11), are usually much harder to solve. It is usually this combination of features which makes an instance dicult for our code (and even more for ISAGEN). In fact, our algorithm had to use the emergency template (E) only in those cases. They also need signi cantly more templates of type 2 and 3. This observation led to the design of the arti cial instance (14). However, this instance could be handled quite well by our code, whereas ISAGEN had extreme diculties and used the emergency template very often. An important part of our experiments is the variation of the required mesh density, within a range that might be interesting for practice. In Tab. 2 we show to which extent the solution is aected by the variation of the mesh density, for a subset of our real-world instances. The exact distribution of the realized templates changes quite unpredictably when we deviate from the desired mesh density by a factor of 2 in either direction. But our code is robust in the sense that it still nds good solutions. In general, when the desired edge length becomes relatively large in comparison with the edge lengths of the macro elements, one cannot expect a feasible solution to exist at all which respects the given tolerances. In such cases, a pragmatic solution could be to relax the given tolerances, i.e. the capacity constraints, a bit further. For all instances, the total CPU time was less than one minute each, except for the largest, arti cial instance, number (14), which took about four minutes. This includes reading all data from a le in a certain standard format (200{3000K size) and writing the result into another le. The current implementation is so fast that the exact running time is negligible for the industrial application; the nite element method takes orders of magnitude more time.
6 Variants of the Problem It has been important for us to consider variants of the problem at each stage of our research, because the problem de nition with which we are faced is subject to change, too. First of all, this includes the objective function and the set of templates. However, if the objective function changes, we do not have to change anything else but just the objective function 19
Figure 15: Illustration of the general Figure 16: The auxiliary network G~ = (V~ ; E~ ) for the template (4) for quadrilaterals, and general template (4). its decomposition into standard templates. (again, this in contrast to a linear programming approach). Subsequently, Muller-Hannemann and Schwartz have started a new thread of research, based on a more general template [MS96], which we brie y summarize to illustrate the need for a robust problem de nition (and its success). In our cooperation, we had to use the standard templates in Fig. 6. These templates usually provide better interior angles than other possible templates, and they are the state of the art (and so allowed a comparison with a commercial code). Hence, the natural way to start our theoretical investigations was the analysis of Problem 2.2. But knowing the NP {hardness result of Theorem 2.3 one might hope that an alternative template allows more exibility. It is well known that a quadrilateral Q can be decomposed into strictly convex quadrilaterals if and only if the number of subdivision points of Q is even. More generally, any simple, not necessarily convex polygon P can be decomposed into strictly convex quadrilaterals if and only if the number of nodes of P is even [Jo95, MW96]. For that reason, Muller-Hannemann and Schwartz P developed a general template (4), which only requires that the necessary evenness condition 4i=1 Ni = 0 mod 2 is satis ed. Note that, in principle, there are many ways how to realize a decomposition if the evenness condition is ful lled. However, it is possible to build up this template (4) by the three standard templates. An illustration of template (4) and the corresponding modi cation of the auxiliary network used in Sect. 3 can be found in Figs. 15 and 16. Template (4) usually has worse interior angles than the standard templates. The example of the invention of template (4) shows that, if the set of templates changes, we only have to extend steps 1, 2a, and 2c. However, this aects only minor details of these three steps, not the general procedure, and our partners can do that themselves (even long after the cooperation is over). At least, all this remains true as long as the modi ed problem can still be formulated as the bidirected ow problem of Sect. 3. But the ow conservation conditions are a more or less natural reformulation, in terms of graph theory, of the requirement that the resulting mesh be conforming. Furthermore, it might be promising to develop new variants of the problem that can even be solved better than the original problem by a discrete approach. The problem formulation we are faced with is not god{given, but the | necessarily imperfect | formalization of informal rules of thumb. This leaves many degrees of freedom, which can be used to nd a problem de nition 20
that re ects all numerical requirements at least as well, but is more suitable for a network ow approach. In future, it might be interesting to see whether or not our approach extends to other models. For example, in computer graphics, meshes that approximate surfaces usually have to consist of triangles rather than quadrilaterals. Another example is the approximation of compact bodies using fully three{dimensional meshes and a decomposition into hexahedra. It is not clear that those variations can still be solved by network ow techniques. But it seems that, in any case, there is at least a discrete core problem, which can be isolated and solved disregarding all numerical and geometrical aspects, and which is crucial for the original, non{discrete, problem itself.
Acknowledgement The authors wish to thank Dr. G. Krause for many fruitful discussions and for providing us with ISAGEN.
References [An87] R.P. Anstee, A polynomial algorithm for b-matching: An alternative approach, Information Processing Letters 24 (1987), 153{157. [AMO93] R.K. Ahuja, T.L. Magnanti and J.B. Orlin: Network ows. Prentice Hall (1993). [BA76] I. Babuska and A. Aziz, On the angle condition in the nite element method, SIAM J. Numerical Analysis 13 (1976), 214{227. [BE92] M. Bern and D. Eppstein: Mesh generation and optimal triangulation. In: Computing in Euclidean Geometry, D.-Z. Du and F.K. Hwang, eds., World Scienti c (1992), 23{90. [Ho88] K. Ho{Le: Finite element mesh generation methods: a review and classi cation. Computer{Aided Design 20 (1988), 27{38. [Kr91] G. Krause: Interactive nite element preprocessing with ISAGEN. In: J. Robinson, ed., Finite Element News 15 (1991). [De88] U. Derigs: Programming in networks and graphs. Lecture Notes in Economics and Mathematical Systems, vol. 300, Springer-Verlag, Berlin (1988). [Ed67] J. Edmonds: An introduction to matching. Lecture Notes. The University of Michigan, Ann Arbor (1967). [Jo95] B. Joe: Quadrilateral mesh generation in polygonal regions. Computer{Aided Design 27 (1995), 209{222. [MN95] K. Mehlhorn and S. Naher: LEDA, a platform for combinatorial and geometric computing. Communications of the ACM 38 (1995), 96{102. [MM95] R.H. Mohring and M. Muller-Hannemann: Cardinality matching: heuristic search for augmenting paths. Technical report No. 439/1995, Technische Universitat Berlin; available via anonymous ftp from ftp.math.tu-berlin.de; cd pub/Preprints/combi; le Report-4391995.ps.Z
21
[MMW95] R.H. Mohring, M. Muller-Hannemann and K. Weihe: Using network ows for surface modeling. Proceedings of the Sixth Annual ACM-SIAM Symposium on Discrete Algorithms, San Francisco, California, (1995), 350-359. [MP95] D.L. Miller and J.F. Pekny: A staged primal-dual algorithm for perfect b-matching with edge capacities, ORSA J. Computing 7 (1995), 298{320. [MS96] M. Muller-Hannemann and A. Schwartz: Mesh re nement into quadrilaterals without template restrictions (in preparation). [MW96] M. Muller-Hannemann and K. Weihe: Minimum strictly convex quadrangulations of convex polygons. Technical report No. 519/1996, Technische Universitat Berlin; available via anonymous ftp from ftp.math.tu-berlin.de; cd pub/Preprints/combi; le Report-5191996.ps.Z
[PS82] C.H. Papadimitriou and K. Steiglitz: Combinatorial optimization | algorithms and complexity. Prentice Hall (1982). [Pu73] W. Pulleyblank: Faces of matching polyhedra. Ph. D. Thesis, Faculty of Mathematics, University of Waterloo (1973). [RWW95] H. Ripphausen{Lipa, D. Wagner, and K. Weihe: Ecient algorithms for disjoint paths in planar graphs. In: W. Cook, L. Lovasz, and P. Seymour, eds., DIMACS Series in Discrete Mathematics and Compuer Science 20 (from the special year on combinatorial optimization), 295{354, Springer (1995). [SF73] G. Strang and G.J. Fix, An analysis of the nite element method, Prentice-Hall, 1973. [SNTM92] V. Srinivasan, L.R. Nackman, J.{M. Tang, and S.N. Meshkat: Automatic mesh generation using the symmetric axis transformation of polygonal domains. Proceedings of the IEEE 80 (1992), 1485{1501. [TA93] T.K.H. Tam and C.G. Armstrong: Finite element mesh control by integer programming. International Journal for Numerical Methods in Engineering 36 (1993), 2581{2605.
22
Figure 17: Part of the cooling system of an engine (instance (8) in Tab. 1).
Figure 18: The re nement produced by our algorithm for the mesh in Fig. 17. 23
(1,1)
(4,5) (0,1) ey
(2,2)
(0,1) e1y
ey (0,1)
(0,1) ey
(0,1) e2y
(1,1)
(1,1)
Case A
Case B
Figure 19: Representation of variable y
Appendix
Theorem 2.3 The problem of nding a feasible solution (as de ned in Sects. 1 and 2) is strongly NP {hard. This is true even if we impose two restrictions simultaneously: rst, we do not allow folding edges, and second, each of Ltarg e ; e ; and e is a global value independent of e 2 E . Proof: The problem is in NP because a feasible solution, if it exists, can be checked for feasibility quite easily. To show NP -completeness we shall give a reduction from the following variant of SATISFIABILITY: We are given a Boolean formula consisting of m clauses C1 ; :::; Cm (in conjunctive normal form) and involving the variables y1 ; :::; yn , each of which appears only once or twice unnegated and exactly once negated. Is the formula C1 C2 : : : Cm satis able ? Even with this restriction SATISFIABILITY remains NP -complete, as was shown in [PS82, p. 394 .]. Let F = C1 C2 : : : Cm be a formula of this type. As in many NP -completeness proofs, the construction of an instance of our problem requires the design of special-purpose components: For each variable y 2 fy1 ; :::; yn g we de ne a corresponding quadrilateral. If the variable y appears negated and unnegated exactly once, we create a quadrilateral with capacity constraints (the pair of lower and upper capacities is indicated in brackets, for each edge) as shown in Fig. 19A. Here and in the following gures, we use small, black dots to separate edges that belong to the same side of the quadrilateral. The negation of a variable is indicated by a bar. For an edge e, denote by x(e) the number of additional nodes placed on e. We observe that the only feasible re nements for this type of quadrilateral meet the condition of template (1), namely with x(ey ) = 1, x(ey) = 0 or x(ey ) = 0, x(ey) = 1. In the rst case, we set y = TRUE and y =FALSE, in the second case, y = FALSE and y =TRUE Hence, this quadrilateral encodes the truth assignment to y or y. If the variable y appears three times, we need a quadrilateral with capacity constraints as shown in Fig. 19B. Here, the intended interpretation of the edges e1y and e2y and their values x(e1y ), x(e2y ) is the truth assignment to y, and edge ey stands for y. There are exactly two possibilities to nd a feasible subdivision of such a quadrilateral, one which meets the condition of template (2) and one with the condition of template (3), respectively, see Fig. 20. In the case that template (2) is met, we have the truth assignment y = TRUE and y = FALSE, and if template (3) is met, we have y = FALSE and y = TRUE. Hence, the only feasible assignments to the quadrilateral correspond to possible truth settings of y. 24
5
4 0
1
1
0
0
1
1
1
Template (2)
Template (3)
Figure 20: Feasible subdivisions in Case B Clearly, we may assume that each clause in our formula has at least two variables, because clauses with only one variable are satis ed if and only if this single variable is set to TRUE if unnegated and to FALSE if negated. The clauses are represented by quadrilaterals with certain capacity constraints. For a clause C 2 fC1 ; :::; Cm g with k 2 variables we de ne a quadrilateral as shown in Fig. 21. (k + 1; 2k ? 1)
eC;1 (0,1) ... eC;j (0,1) ... eC;k (0,1)
(2k ? 1; 2k)
(k; k)
Figure 21: Representation of clause C with k literals, k 2 This encodes the truth value of the corresponding clause, namely, such a quadrilateral has a solution if and only if at least one edge eC;j has value x(e) = 1. To see this, assume rst that all edges eC;j for 1 j k have the assignment xe = 0. Then we have exactly k ? 1 subdivision points on this side of the quadrilateral, but on the opposite side at least 2k ? 1. Hence, this pair of sides has a dierence of subdivision points of at least k, whereas the other pair of sides has a dierence of at most k ? 1 and of at least 1. Thus, none of the three template conditions template (1)|template (3) can be ful lled in this case. For the other direction, assume now that ` edges eC;j (1 ` k) have x(eC;j ) = 1. Then we can always meet condition template (3) by the choice of capacities as indicated in Fig. 22. Finally, we connect variable quadrilaterals with clause quadrilaterals in order to make the truth values of all variables and clauses consistent. To this end, edge eC;k of clause C is connected by a quadrilateral with ey if the k-th literal of C is y, and with ey if it is y, cf. Fig. 23. A feasible 25
2k ? ` + 1
k+`-1
2k ? 1 2k
2k ? 1
k
k
k
1