Abstract 1 Introduction 2 Parallel Flip Distance Heuristics 3 Center Search via Simulated Annealing 4 Experiments References

Engineering Greedy Heuristics and Simulated Annealing Methods for the Median Triangulation Under the Parallel Flip Distance

Jacobus Conradi ORCID BARC, University of Copenhagen, Denmark    Benedikt Kolbe ORCID Hausdorff Center for Mathematics, University of Bonn, Germany    Philip Mayer222corresponding author ORCID Institute of Computer Science, University of Bonn, Germany    Jonas Sauer ORCID Karlsruhe Institute of Technology, Germany    Jack Spalding-Jamieson ORCID Independent, Vancouver, Canada
Abstract

We present our approach for the CG:SHOP 2026 challenge. In this international challenge, the goal was to find a median triangulation for a set of triangulations in the parallel flip reconfiguration graph of all triangulations of an underlying point set. Our simulated-annealing-based approach makes use of two ingredients: a heuristic edge selection for approximating the parallel flip distance of two given triangulations, and a heuristic procedure to generate good initial triangulations.

Keywords and phrases:
triangulation, flip distance, parallel flip distance, heuristic, competition
Category:
CG Challenge
Funding:
Jacobus Conradi: Supported by the Carlsberg Foundation, grant CF24-1929.
Benedikt Kolbe: This work was partially supported by the Lamarr Institute for Machine Learning and Artificial Intelligence.
Philip Mayer: Supported by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) under grant FOR-5361 – 459420781.
Jonas Sauer: Supported by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) under grant FOR-5361 – 459420781.
Copyright and License:
[Uncaptioned image] © Jacobus Conradi, Benedikt Kolbe, Philip Mayer, Jonas Sauer, and
Jack Spalding-Jamieson; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Theory of computation Computational geometry
Acknowledgements:
We thank the challenge organizers and other competitors for their time, feedback, and for making this competition and this research possible. We gratefully acknowledge access to the Marvin cluster of the University of Bonn.
Supplementary Material:
Software  (Source Code): https://github.com/PhilipMayer94/jflip
  archived at Software Heritage Logo swh:1:dir:5f40dddfbe834cfc16e09dcdac08d2c61d979042
Editors:
Hee-Kap Ahn, Michael Hoffmann, and Amir Nayyeri

1 Introduction

In this paper, we study changing triangulations of a planar point set using parallel flips. Given a set of planar triangulations of some point set, we search for a central triangulation and a sequence of parallel flip operations from each input triangulation to the central triangulation, so as to minimize the sum of the number of parallel flip operations in each sequence.

This problem represents the core of the 2026 Computational Geometry Challenge [1] (CG:SHOP), which ranked teams based on their solutions to a provided set of instances. Our team, jflip2, was invited to publish its methods after finishing in 4th place with an approach based on heuristic methods inspired by observations for the classical flip distance [5].

For a point set 𝒮2, a triangulation 𝒟 is a maximal set of non-crossing straight-line edges incident to points in 𝒮. In a triangulation, every interior edge e not on the boundary of conv(𝒮) is adjacent to exactly two triangles. If two such triangles form a convex quadrilateral Q, then we call e flippable, and replacing e with the other diagonal flip(e) results in a valid triangulation 𝒟=𝒟{e}{flip(e)}. Replacing e with flip(e) is called a unit flip.

A set of edges E in a triangulation 𝒟 is called a parallel flip operation if each edge eE is flippable and no two edges in E are part of the same triangle [4]. Since no two edges in a parallel flip share a triangle, we again obtain that 𝒟=𝒟E{flip(e)eE} is a valid triangulation. Parallel flips induce a graph PG, whose vertices are the set 𝔇 of all triangulations, in which two triangulations are adjacent if one can be transformed into the other by exactly one parallel flip. Note that the edges of this graph are undirected, since parallel flips are reversible, i.e., flip(flip(e))=e, and, classically, this graph is connected [7]. A sequence of parallel flip operations transforming 𝒟 to 𝒟 is a path in PG from 𝒟 to 𝒟. The length dpf(𝒟,𝒟) of a shortest path from 𝒟 to 𝒟 in PG is called the parallel flip distance.

Given these definitions, we formulate the challenge posed in the CG:SHOP contest.

Figure 1: Two edges with their corresponding quadrilateral. They do not share a triangle and can be flipped in parallel, transforming the left triangulation into the right triangulation.
Problem 1 (Median Point for Parallel Flip Distance).

Given a set 𝒮 of points and a set 𝔗={𝒯1,,𝒯m} of triangulations (terminals), find a triangulation (center) 𝒞 and paths {Pi} in PG from each 𝒯i to 𝒞, minimizing

cost(𝒞,𝔗)=𝒯i𝔗|Pi|

Ideally, we want |Pi| to be dpf(𝒞,𝒯i). This raises the intermediate problem of computing the parallel flip distance of two triangulations. Computing the unit flip distance, where the goal is minimizing the number of unit flips, is NP-hard [8, 10]. The complexity of computing the parallel flip distance remains open. For the unit flip distance, exact methods [9] based on shortest paths and integer linear programs have been employed. To us, these approaches appeared ill-suited for large instances (although the winning team Shadoks [3] ultimately employed an optimal SAT solver with great success). Instead, we employ a greedy approach inspired by [5] for the sub-task of approximating dpf().

Based on this heuristic distance computation, we solve Problem 1 via a simulated-annealing-based approach. Our method is separated into three stages:

  1. 1.

    Compute an initial candidate center 𝒞.

  2. 2.

    Improve 𝒞 via simulated annealing, with parallel flip distance heuristics as a guide.

  3. 3.

    Use more expensive distance heuristics to improve cost(𝒞,𝔗).

We describe our parallel flip distance heuristics in Section 2 and our simulated-annealing-based center search in Section 3. Finally, we present experimental results in Section 4.

2 Parallel Flip Distance Heuristics

We start with an observation on parallel flips. Given a triangulation 𝒟, we define the conflict graph G𝒟 as the graph whose vertices correspond to all flippable edges in 𝒟, and in which two vertices are adjacent if the corresponding edges are part of the same triangle and hence cannot be part of the same parallel flip. Thus, parallel flips correspond to independent sets in G𝒟. Based on this, the idea of our flip heuristics Hu(𝒟s,𝒟t) can be summarized as follows:

  1. 1.

    Start with 𝒟0=𝒟s.

  2. 2.

    Compute a utility value u(e) for each flippable edge e𝒟i, such that flipping an edge with high utility is expected to produce a triangulation closer to the given target 𝒟t.

  3. 3.

    Find a maximum-weight independent set (MWIS) heuristically.

  4. 4.

    Apply the corresponding parallel flip operation to obtain a new triangulation 𝒟i+1.

  5. 5.

    Repeat Steps 24 with 𝒟i+1 until the target triangulation is reached.

Typically, the resulting flip distance estimate is asymmetric, i.e., Hu(𝒟,𝒟)Hu(𝒟,𝒟).

Flip Utilities.

Hanke et al. [5] observed that the number of proper crossings between edges of two triangulations is an upper bound on the (unit) flip distance. Consequently, they introduced a heuristic that aims to aggressively decrease the number of such crossings. This definition extends nicely to the parallel flip distance, and serves as the basis for our utility function: Let e be an edge connecting two vertices of 𝒮, and let 𝒟t denote the target triangulation. Define cr𝒟t(e) as the number of proper crossings between e and the edges of 𝒟t. For a flippable edge e in 𝒟, let uH(e,𝒟,𝒟t)=cr𝒟t(e)cr𝒟t(flip(e)), while for non-flippable edges, let uH(e,𝒟,𝒟t)=. Note that if 𝒟𝒟t, at least one edge has positive utility [5]. This heuristic is heavily geared towards the unit flip distance: it does not take into account that flipping an edge e blocks all other edges of its two triangles from being added to the current parallel flip. Consequently, we define a natural extension to this heuristic: Let

u2L(e,𝒟,𝒟t)=uH(e,𝒟,𝒟t)zδ(e)uH(z,𝒟,𝒟t),

where δ(e) denotes the (flippable) neighbors of e in the conflict graph G𝒟. Our edge selection for the construction of a parallel flip is sequential, so during the selection process, some neighbors of an edge e may already be blocked by previously selected edges. Thus, we can dynamically exclude them from the penalty sum in u2L(e,𝒟,𝒟t). The values cr, uH, and u2L naturally extend to multiple target triangulations by summing over all terminals.

MWIS Heuristics.

Our main MWIS heuristic scans all flippable edges in decreasing order of utility u(e,𝒟,𝒟t) and adds an edge e if the solution remains an independent set and u(e,𝒟,𝒟t)>0. For more accuracy, at the expense of runtime, we refine the initial greedy solution via a local search that swaps selected edges with some of their non-selected neighbors, as long as it increases the total utility. This process ends when no beneficial swaps remain.

Randomization.

We introduce randomization into the greedy edge selection algorithm and rerun the randomized parallel flip sequence computation multiple times to increase the overall accuracy. Concretely, given a parameter k (usually k50), we maintain a buffer of the k unblocked edges with the highest utility. At each selection step, one edge from the buffer is selected uniformly at random and added to the parallel flip before updating the buffer.

Engineering.

The main runtime cost of the heuristic Hu(𝒟s,𝒟t) is the initial computation of cr𝒟t(e) for edges e𝒟s with respect to the target 𝒟t. Here, a brute-force approach combined with an R-tree outperformed a Bentley-Ottmann sweep [2], which requires exact arithmetic for rational crossing points. For small instances (|𝒮|1000), we speed up computations of the form Hu(𝒞,𝒯), with current center 𝒞 and terminal 𝒯, by precomputing a table that contains the number of crossings cr𝒯(e) for every possible edge e(𝒮2). As the size of this table is quadratic in |𝒮|, we do not compute it for larger instances.

3 Center Search via Simulated Annealing

To optimize the chosen center, we employ simulated annealing [6] with a fixed time horizon ttotal. Simulated annealing is a local search technique that iteratively explores the solution space by moving to randomly generated neighboring solutions. Improving moves are always accepted, while worsening moves are accepted with a probability Paccept(Δ,t) that depends on the objective change Δ and the normalized progress t=tcurrent/ttotal. This probability is controlled by a temperature parameter that evolves according to a cooling schedule.

Cooling Schedule.

We use an exponential cooling schedule that quickly reduces the temperature such that, in the final quarter of the runtime, the algorithm effectively behaves as a greedy local search. Concretely, we set Tquarter=1ln0.02, and T(t)=T0(TquarterT0)t/0.75, ensuring T(0.75)=Tquarter. To dampen the impact of large cost increases, we use a sublinear transformation of Δ and accept moves with probability Paccept(Δ,t)=exp(Δ2/3T(t)). With T0=30, this yields strong exploration early on and greedy behavior in the final quarter.

Initial Centers.

We use four different strategies to generate the initial center:

  1. 1.

    Delaunay: A simple choice for the initial center is the Delaunay triangulation.

  2. 2.

    Path: For each terminal pair 𝒯,𝒯𝔗, compute a short heuristic flip path, evaluate all triangulations along the paths and select the best one as the initial center.

  3. 3.

    Intersection: For each edge e(𝒮2), count the total number cr𝔗(e) of crossings with all terminals. Construct the center greedily by adding edges in increasing order of cr𝔗(e).

  4. 4.

    Frequency: Each edge e in (𝒮2) is assigned a frequency based on how many terminals contain e. The initial triangulation then results from greedily selecting edges in decreasing order of frequency, using edges with frequency 0 if necessary.

Neighbor Generation.

For small instances, where evaluating the flip heuristic is fast, we generate neighbors randomly: We pick a random number k, then we pick k flippable edges uniformly at random and apply the flips in random order, skipping blocked edges.

For larger instances, increased running time of the distance heuristic results in fewer candidates 𝒞 being evaluated, so in later stages, we use an informed neighbor generation: We select a random subset 𝔗𝔗, compute uH(e,𝒞,𝔗) for all flippable edges and select a random greedy flip with a (small) k-buffer. The transition from uninformed to informed neighbor generation is again controlled by a schedule that gradually increases the probability of selecting an informed neighbor. In the mostly greedy last quarter of the search, we substantially increase the buffer size k for informed flips, reintroducing randomness.

Heuristic Selection.

We evaluated the simulated annealing algorithm with many heuristic combinations. The one we found to be the most promising was the following: First, during the exploration phase, we use uH or u2L to compute only the asymmetric deterministic variants of the heuristics, focusing on computational speed. Then, in the final (greedy) phase of the algorithm, we transition to the full ensemble of heuristics, including all introduced randomization schemes, and their opposites Huopp(𝒟,𝒟)., i.e., Huopp(𝒟,𝒟)=Hu(𝒟,𝒟).

4 Experiments

The competition data set consists of 250 instances, grouped into 100 random, 101 woc, and 49 rirs instances. The random and woc instances are small (15320 points and 220 terminals), whereas the rirs instances are substantially larger (50012 500 points and 20200 terminals). All experiments were conducted on nodes of the HPC cluster Marvin (University of Bonn), each equipped with 1024 GB RAM and two Intel Xeon Sapphire Rapids 2.10 GHz CPUs.

Figure 2: Comparison of deterministic and randomized heuristics: only-forward uH, bidirectional uH, only-forward randomized uH, bidirectional randomized uH, and bidirectional randomized u2L.

Parallel Flip Distance Heuristics.

To evaluate the quality of the heuristics, we generated up to ten distinct terminal pairs for each instance (1481 samples in total) and computed the parallel flip distance using uH and u2L, combining greedy and local search to compute the MWIS. The computed flip distances range from 1 to 37 and increase with the instance size.

We observed that the distance values of the heuristics using different utility functions differ in only 6% of instances. Hence, in Figure 2, we focus on uH. As expected, applying the heuristic in a single direction (HuH) performs worst, with some outliers deviating by up to five flips from the best known values. Taking the minimum of both directions (min(HuH,HuHopp)) increases the number of best values found by 25% and eliminates most of the extreme outliers.

Notably, even the unidirectional randomized variant outperforms the bidirectional deterministic one, yielding a further performance gain of 25%, although some outliers with large deviations from the best value remain. Minimizing over both directions yields the best solutions for most instances; using u2L instead of uH performs better in only thirteen cases.

Center Search with Simulated Annealing.

Figure 3: Objective value progression for different configurations during simulated annealing with varying initial centers. Top: uninformed neighbors; bottom: uninformed and informed neighbors.

We select one representative instance from each data set. Figure 3 shows the progression of the objective value during the center search for different configurations. All configurations use uH for exploration and the full heuristic ensemble in the final quarter. The main difference is in the neighbor selection: the upper row uses only random neighbors, while the bottom row incorporates informed neighbors. As expected, purely random neighbors do not improve the current best value during the exploration phase, but then improve the solution during the final (greedy) search. In contrast, the informed search shows gradual improvements, albeit with a higher risk of getting trapped in local optima. For small instances, the random configuration achieves slightly better final results, but unlike the informed search, it fails to find improvements on the rirs instance.

Figure 4: Final objective value after running for ttotal days starting at the frequency center.

Figure 4 shows that the final objective value changes little with longer runtime for either neighbor selection and can even get worse due to randomization. Further experiments indicate that two to three days is a sweet spot, and that reruns should be favored over extended optimization time. Overall, our example instances are representative: on random, uninformed usually wins; on rirs, informed always wins; and on woc, both outcomes were observed.

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] Jon L. Bentley and Thomas A. Ottmann. Algorithms for reporting and counting geometric intersections. IEEE Transactions on Computers, C-28(9):643–647, 1979. doi:10.1109/TC.1979.1675432.
  • [3] Guilherme Dias da Fonseca and Yan Gerard. Shadoks approach to parallel reconfiguration of triangulations. In Proceedings of the Symposium on Computational Geometry (SoCG), 2026. doi:10.4230/LIPIcs.SoCG.2026.107.
  • [4] Jérôme Galtier, Ferran Hurtado, Marc Noy, Stephane Perennes, and Jorge Urrutia. Simultaneous edge flipping in triangulations. Int. J. Comput. Geom. Appl., 13(2):113–133, 2003. doi:10.1142/S0218195903001098.
  • [5] Sabine Hanke, Thomas Ottmann, and Sven Schuierer. The edge-flipping distance of triangulations. Journal of Universal Computer Science, 2:570–579, April 1996. doi:10.3217/JUCS-002-08-0570.
  • [6] S. Kirkpatrick, C. D. Gelatt, and M. P. Vecchi. Optimization by simulated annealing. Science, 220(4598):671–680, 1983. doi:10.1126/science.220.4598.671.
  • [7] Charles L. Lawson. Transforming triangulations. Discrete Mathematics, 3(4):365–372, 1972. doi:10.1016/0012-365X(72)90093-3.
  • [8] Anna Lubiw and Vinayak Pathak. Flip distance between two triangulations of a point set is NP-complete. Computational Geometry, 49:17–23, 2015. 24th Canadian Conference on Computational Geometry (CCCG’12). doi:10.1016/j.comgeo.2014.11.001.
  • [9] Philip Mayer and Petra Mutzel. Engineering A* Search for the Flip Distance of Plane Triangulations. In 22nd International Symposium on Experimental Algorithms (SEA 2024), volume 301 of Leibniz International Proceedings in Informatics (LIPIcs), pages 23:1–23:20, Dagstuhl, Germany, 2024. Schloss Dagstuhl – Leibniz-Zentrum für Informatik. doi:10.4230/LIPIcs.SEA.2024.23.
  • [10] Alexander Pilz. Flip distance between triangulations of a planar point set is APX-hard. Computational Geometry, 47(5):589–604, 2014. doi:10.1016/j.comgeo.2014.01.001.