This was my second best entry in Reaktors Traveling Santa challenge 2020. It's written in MATLAB, while my original attempts were in Python. I chose to rewrite it in MATLAB partly because I've had significant practice with MATLAB during my thesis since the holidays, and because MATLAB allows us to flexibly handle the storage of the quite large matrix containing the distances between all children.
I was in the top ten during the holiday season with my python nearest-neighbor implementation as well, but this implementation that utilizes a distance matrix allows us to use strategies that would otherwise be too computationally expensive. In this case, the code includes some biases, and those biases are governed by coefficients that would be very tedious to optimize without code that runs quickly. The optimization of coefficients was not systematic, so there may actually be some combination of coefficients that gives a better score than Turbopulkka 2000, my entry based on the code that I have shared here. victorg is a further improvement on this.