How to Implement the Hill Climbing Algorithm in Python

A step-by-step tutorial on how to make Hill Climbing solve the Travelling salesman problem

Hein de Haan
Towards Data Science
8 min readDec 8, 2020

--

Hill climbing is a mathematical optimization algorithm, which means its purpose is to find the best solution to a problem which has a (large) number of possible solutions. Explaining the algorithm (and optimization in general) is best done using an example. In the Travelling salesman problem, we have a salesman who needs to visit a number of cities exactly once, after which he returns to…

--

--

As a science communicator, I approach scientific topics using paradoxes. My journey was made possible by a generous grant from MIRI (intelligence.org).