Abstract 1 Introduction 2 2-SAT formulation 3 SAT formulation with XOR clauses 4 Exact solving 5 Heuristics 6 Combined Strategies References

ETH Flippers Approach to Parallel Reconfiguration of Triangulations: SAT Formulation and Heuristics

Lorenzo Battini ORCID ETH Zürich, Switzerland    Marko Milenković ORCID ETH Zürich, Switzerland
Abstract

We describe the algorithms used by the ETH Flippers team in the CG:SHOP 2026 Challenge. Each instance consists of a set of triangulations on a common point set, and the objective is to find a central triangulation that minimizes the total parallel flip distance to the input set. Our strategy combines an exact solver for small and medium-sized instances with a suite of heuristics for larger instances. For the exact approach, we formulate the problem as a SAT instance with XOR clauses to model edge transitions across multiple rounds, further optimized by lower bounds derived from exact pairwise distances. For larger instances, we use a greedy local search and edge-coloring techniques to identify maximal sets of independent flips. Our approach ranked second overall and first in the junior category, computing provably optimal solutions for 186 out of 250 instances.

Keywords and phrases:
exact solution, heuristic, SAT solver, XOR clauses, computational geometry
Category:
CG Challenge
Copyright and License:
[Uncaptioned image] © Lorenzo Battini and Marko Milenković; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Theory of computation Computational geometry
Related Version:
Extended Version: https://arxiv.org/abs/2603.22456
Acknowledgements:
We would like to thank the Challenge organizers and other competitors for their time, feedback, and for making this whole event possible. This work was conducted as part of the Practical Work course at ETH Zürich under the supervision of Michael Hoffmann, whose guidance was invaluable. We sincerely thank Bernd Gärtner for providing travel support to attend the conference. We also acknowledge the ETH High Performance Computing group for providing the computational resources of the Euler cluster.
Editors:
Hee-Kap Ahn, Michael Hoffmann, and Amir Nayyeri

1 Introduction

Triangulations of point sets, in this context, maximal straight-line crossing-free graphs with endpoints in the point set, have many applications, for instance, in computer graphics and in reconstruction problems in geodesy.

A common problem is transforming a triangulation into another on the same point set using edge flips, replacing an internal edge whose incident triangles form a convex quadrilateral with its other diagonal. Hurtado, Noy, and Urrutia [4] introduced parallel edge flips, which consist of flipping at the same time a set of edges such that none of the pairs of edges in the set shares a triangle.

The “CG:SHOP Challenge” (Computational Geometry: Solving Hard Optimization Problems) is a computational challenge competition about a hard geometric optimization problem. This year’s challenge problem was proposed by Aichholzer, Dorfer, and Kramer. The goal is to find a central triangulation C and, for each of the given m triangulations T1,T2,,Tm on the same pointset P, a sequence of parallel flips transforming Ti into C, such that the sum of the lengths of these sequences is minimized. The solution methods are evaluated on a benchmark of 250 instances. We refer to [1] for further challenge details.

We present an exact solution method based on formulating the problem as a SAT problem with XOR clauses, which is used to solve the small and medium instances, as well as various heuristics that we used for the larger instances.

Our team, ETH flippers, ranked second overall and first in the junior category. We computed a provably optimal solution for 186 instances. Three further instances were solved, but a technical bug during our local validation caused us to stop at sub-optimal values. The largest instances we optimally solved featured twenty 320-point triangulations, while the highest total parallel flip distance among our optimally solved instances is 92. Notably, for this latter instance (random_instance_440_160_20), our solution was uniquely the best among all participating teams (see Figure 1).

Refer to caption
Figure 1: Our best centers to instances random_instance_440_160_20, woc-70-random-9a7d18d3, rirs-500-50-23d00ec5.

2 2-SAT formulation

Given a set of m triangulations, 𝒯={T1,T2,,Tm}, we formulate a 2-SAT instance to search for a triangulation C such that the distance from each Ti𝒯 to C is at most one.

For every convex quadrilateral q formed by a pair of facial triangles that share an edge in any Ti, we fix an arbitrary reference diagonal. Let the variable xq denote whether C uses its reference diagonal and let the constant bq(i) denote its state in Ti. To prevent invalid simultaneous flips, we add the clause ¬(bq(i)xq)¬(bq(i)xq) for all pairs of intersecting quadrilaterals q,q in each Ti. This determines the existence of a central triangulation C in 𝒪(mn) time.

3 SAT formulation with XOR clauses

XOR clauses.

The most natural approach to modelling parallel flips is a round-by-round progression. We need to keep the state of each edge across intermediate parallel flips.

We model the state transition of an edge e over k parallel flips using XOR operations. Let e0,ek{0,1} denote the presence of e in the initial and final triangulations, respectively. Let {q1,,qg} be the set of all potential convex empty quadrilaterals that share e as a diagonal. We let fij{0,1} indicate whether a flip is performed on qi during step j.

Because the final state of edge e after k parallel flips is simply its initial state XORed with all intermediate flips across its potential quadrilaterals q1g, we add the constraint

e0ekj=1ki=1gfij=0

We decided to use the CryptoMiniSat5 [8] solver, since it supports inputs with XOR clauses.

Formulation

We extend the previous formulation to search for a center C whose distance to each Ti𝒯 is upper bounded by a given target d[i].

Geometric Preconditions for Flips.

Let 𝒬 be the set of all convex empty quadrilaterals defined on the pointset, which we identified via spatial hashing [9]. Let the variable euvt denote the presence of edge (u,v) at step t. For a flip fqt{0,1} to be geometrically valid at step t, the four boundary edges q of its corresponding quadrilateral q𝒬 must exist in the prior step. We enforce this constraint with implication fqt(u,v)qeuvt1.

Target Equivalence with Center C.

We introduce global boolean variables cuv representing the edges of the center C. We enforce consistency at the final step k via the equivalence euvkcuv. This link forces the final state of every flip sequence to be identical to the global center, effectively merging the independent SAT sub-problems to a shared solution.

Edge Transition Constraints.

We must ensure that the triangulation changes only through valid flip operations. An edge (u,v) changes its status (present or absent) between parallel flips t1 and t if and only if a flip is performed on a quadrilateral where (u,v) serves as the diagonal.

Let 𝒬uv be the set of all convex empty quadrilaterals for which (u,v) is a diagonal. The relationship between the edge’s state at consecutive parallel flips and the flip variables is enforced via an XOR constraint: euvt1euvtq𝒬uvfqt=0.

For edges on the convex hull, the set 𝒬uv is empty, effectively enforcing that these edges remain constant throughout the transformation.

Constraints on Simultaneous Flips.

We must enforce strict independence between simultaneous operations. Specifically, for any subset of four vertices {v1,v2,v3,v4}, there can be at most one active flip operation at time t involving three of these vertices. This prevents structural conflicts where multiple flips compete for the same triangle.

We iterate through all quadruplets of vertices and identify the set of potential flip variables v1..4t of size r associated with them. We then enforce an At-Most-One (AMO) constraint on this set fv1..4tf1. There are multiple ways to model this constraint using a linear number of clauses [7]. The ladder encoding that we implemented uses 2r1 variables and 3r2 clauses, compared to r variables and (r2) clauses. Due to the 𝒪(n4) possible number of convex empty quadrilaterals, clauses generation becomes a computational bottleneck.

Initial State and Boundary Conditions.

We initialize the SAT model for each input triangulation by fixing euv0 to true if the edge (u,v) exists in it and false otherwise. Furthermore, since parallel flips only affect internal diagonals of convex quadrilaterals, the convex hull edges remain invariant. We hard-code euvt to true for all (u,v) across all steps t{1,,k}, effectively pruning the search space by preventing flips of boundary edges.

Pruning clauses.

To significantly prune the search space, we precompute the minimum flip distance required to introduce each edge into triangulation Ti using an iterative breadth-first reachability search. We then omit all SAT variables and clauses associated with an edge for any time step prior to this theoretical minimum.

4 Exact solving

Lower bound.

To establish a lower bound, we first compute exact pairwise parallel flip distances Di,j using our SAT formulation. Any valid central triangulation at distances dk to inputs Tk must satisfy the triangle inequality di+djDi,j for all pairs i,j. To test if a target total distance S is feasible, we find all integer assignments (d1,,dm) summing to S that satisfy these pairwise constraints via recursive backtracking. For instances with m=20 triangulations, we use some further pruning techniques. We compute the minimum parallel flip distance sdist(i) for the last i triangulations, for iistart, where we used istart=11 for most instances since it was experimentally found to be sufficiently fast to compute. Then we use those suffix distances by pruning a branch whenever Sk=1idk<sdist(i). Moreover, after the first 10 and 15 distances have been assigned recursively, we prune the branch if the prefix is not satisfiable.

Choosing the distribution of distances.

The upper bound search is existential. Consequently, prioritizing candidates that are more likely to be satisfiable can significantly accelerate the search.

Let d=(d1,,dn) represent a potential assignment vector. We define the scoring function 𝒮(d) as the sum of absolute differences between all pairs of elements: 𝒮(d)=i=1n1j=i+1n|didj|. The candidate distributions are processed in ascending order of 𝒮(d).

Empirical analysis reveals that this heuristic is remarkably effective for randomly generated instances. In the majority of cases, the satisfiable distribution corresponds to the candidate with the minimal 𝒮(d) score. Even in cases where the global minimum is not the solution, the valid assignment is consistently found among the top-ranked candidates.

Conjecture 1.

For a randomly generated triangulation instance under the standard uniform distribution model, ordering of candidate distance vectors by increasing 𝒮(x) minimizes the expected number of queries required to find a satisfiable assignment.

5 Heuristics

Transforming a triangulation into another.

To transform a triangulation T into another T, we flip edges such that the number of intersecting edges decreases. We now describe how, at each step, we choose a subset of independent edges to flip among the ones that reduce the number of intersections.

Firstly, we choose edges that, if flipped, introduce an edge that is present in T. To do so, we start by creating a graph containing those edges, where the nodes correspond to faces incident to them. Then we compute an edge coloring of this graph using the Misra and Gries algorithm [5] from the Boost Graph Library [6]. Finally, we flip the edges corresponding to the color class of maximum cardinality, and all the isolated edges. Since the boundary edges cannot be flipped, and the bounded faces are triangles, the maximum degree Δ is at most 3. Since the Misra and Gries algorithm uses at most Δ+14 colors, at least one fourth of the edges in the graph are flipped.

Secondly, we greedily pick the edges that are independent from all the edges that have already been picked, in order of non-increasing reduction of the number of intersections.

This transforms a triangulation into the other in a finite number of steps, since it can be seen as an adaptation to parallel flips of the algorithm described by Hanke, Ottmann, and Schuierer [3]. Given the flip sequence ={F1,F2,,F||1} that we obtain with the described heuristic, let {τ0=T,τ1,,τ||1=T} be the corresponding sequence of triangulations, where τk+1 is the triangulation we obtain after the parallel flip Fk. The reversed flip sequence transforms T into T and it can be obtained by reversing the order of the parallel flips, and replacing each individual flip ee with ee.

We can obtain other heuristic flip sequences k, with k[0,||1], by concatenating the heuristic flip sequence that turns T into τk with the reversed flip sequence that turns T into τk.

Since these sequences are heuristic, their length might differ, and so we try multiple values of k and choose the shortest flip sequence.

We empirically observed that trying all intermediate k values typically reduces each triangulation’s distance by 1. Therefore, to maintain computational efficiency on large instances, we only do this when the total distance is within currentBest+m. Here, currentBest is the smallest objective value among all the centers that were computed before.

Choosing centers.

Apart from input triangulations, we also generate candidate centers by greedily flipping edges in input triangulations to minimize total intersections with the entire point set until a local optimum is reached.

We then record all the intermediate triangulations at the end of each parallel flip, which is used to transform an input triangulation into one of those centers. To avoid trying all centers, we sort them in increasing order of total number of intersections with all the input triangulations and only compute the heuristic parallel flip distance for a fraction of them.

6 Combined Strategies

Fixed center.

A promising combined strategy involves using the heuristic to select a candidate center triangulation, denoted as Theur, and using the exact SAT solver to compute the minimal parallel flip distances from all input triangulations to Theur, one by one.

Although this approach remains heuristic, it was effective on the rirs instances, but it also indirectly helped significantly with large non-rirs instances. Finding a slightly better solution allows the exact solver to handle cases that were previously out of reach.

Solving a subproblem.

A natural extension to computing pairwise distances is to compute exact distances for larger subsets. This yielded negligible improvements to the lower bound, likely due to the triangle inequality holding strong even for pairwise constraints.

Similar reasoning proved highly effective for the woc (especially tsplib) instances, observing that the distances to the optimal center were not uniformly distributed. By identifying and excluding outlier triangulations, we could exactly solve for the center of the remaining subset. This produced a robust heuristic center for the fixed center heuristic.

References

  • [1] Oswin Aichholzer, Joseph Dorfer, Sándor P. Fekete, Phillip Keldenich, Peter Kramer, and Stefan Schirra. Central Triangulation under Parallel Flip Operations: The CG:SHOP Challenge 2026, 2026. arXiv:2603.18812.
  • [2] Lorenzo Battini and Marko Milenković. ETH flippers CGSHOP2026. Software, swhId: swh:1:dir:ec12f1b858c98832fd57fc7a2d407989c1fc00cf (visited on 2026-05-15). URL: https://github.com/Lbattini/ETH-flippers-CGSHOP2026, doi:10.4230/artifacts.26084.
  • [3] Sabine Hanke, Thomas Ottmann, and Sven Schuierer. The edge-flipping distance of triangulations. Journal of Universal Computer Science, 2, April 1996. doi:10.3217/jucs-002-08-0570.
  • [4] Ferran Hurtado, Marc Noy, and Jorge Urrutia. Parallel edge flipping. In CCCG, 1998.
  • [5] J. Misra and David Gries. A constructive proof of Vizing’s theorem. Information Processing Letters, 41(3):131–133, 1992. doi:10.1016/0020-0190(92)90041-S.
  • [6] Maciej Piechotka. Edge coloring BGL implementation. URL: https://www.boost.org/doc/libs/latest/libs/graph/doc/edge_coloring.html.
  • [7] Carsten Sinz. Towards an optimal CNF encoding of boolean cardinality constraints. In Principles and Practice of Constraint Programming – CP 2005, volume 3709 of Lecture Notes in Computer Science, pages 827–831. Springer, 2005. doi:10.1007/11564751_73.
  • [8] Mate Soos, Karsten Nohl, and Claude Castelluccia. Extending SAT solvers to Cryptographic problems. In Theory and Applications of Satisfiability Testing – SAT 2009, volume 5584 of Lecture Notes in Computer Science, pages 244–257. Springer, 2009. doi:10.1007/978-3-642-02777-2_24.
  • [9] Matthias Teschner, Bruno Heidelberger, Matthias Müller, Danat Pomeranets, and Markus Gross. Optimized spatial hashing for collision detection of deformable objects. Proceedings of Vision, Modeling, and Visualization, 3:47–54, 2003.