Claim your CPD points
Christmas is a time for data analysis with a festive theme . With the significant improvement in AI tools this year, a Christmas-themed coding challenge was in order.
Every year, Santa must visit millions of houses to deliver presents, and finding the most efficient route to minimise reindeer fatigue is obviously an important challenge. This is, of course, a pure version of the travelling salesman problem. I generated (almost) 5,000 points in a plane, and then asked three LLMs – ChatGPT’s GPT5, Claude’s Opus 4.1, and Google’s Gemini Pro 2.5 to solve. The exact prompt provided is below:
| I have a dataset, happy_christmas_coordinates.txt, with 5000 coordinate points (first 10 rows included below). Please give me a piece of python code that: - Reads in the dataset - Writes an algorithm to solve the traveling salesman problem - Applies the algorithm for this dataset (it should take no longer than 5min to run) - Plots the path (but not the original points). The plot should be pretty, and Christmas themed - Saves the plot, as well as the distance of the path, to the same directory. # HAPPY CHRISTMAS coordinate points (holes excluded) # Format: x, y 566.3315, 16.3386 611.0028, 71.8128 284.1099, 153.4495 173.9621, 121.7703 317.0611, 189.9698 176.2296, 165.9802 149.0849, 140.4316 16.1822, 187.6634 |
Code produced, including the code to generate the original point cloud is on this GitHub repository .
All three tools produced code that worked out of the box – by the standard of models even a couple of years ago this is impressive, although perhaps would be surprising given the famous nature of the coding challenge.
All three tools found the same algorithm – an initial nearest neighbour approach for an initial path, followed by a simple application of the 2-opt algorithm , which seeks to swap pairs of paths to see if the distance travelled decreases. This was a little disappointing – I’d secretly hoped one of the models would spice things up.
| LLM | Distance Santa had to travel (km) |
| Gemini | 12,322 |
| Claude | 14,129 |
| GPT5 | 14,253 |
On distance travelled, Gemini was the clear winner. There is likely some luck to the results, however, Santa does not have time to run the algorithm many times to get a fair view of modern LLMs.
Figure: A message from Google’s Gemini
Getting into nitpicking:
The winner
I’m going to give the win to Gemini today – it gave compact, well-laid-out code, saved Santa nearly 2,000 km of travel, and weirded me out slightly with a title that matches the image underneath. But it is also a celebration of a world where we have several high-quality coding assistants readily accessible.
You’ll be staggered to know that the point cloud was not entirely random – in fact, you may even see a not-so-secret message in the plots. As ever, it has been an absolute pleasure writing for Actuaries Digital again this year, and I look forward to being with you again next year. Hoping you all have a safe and re-energising holiday period.
Figure: A message from Open AI’s ChatGPT