Optimization, Optimization Algorithms, Python, Traveling Salesman, Algorithms.
from math import radians, sin, cos, sqrt, atan2 R = 6371 # radius of the earth in km def calculate_distance(city1, city2): """Haversine distance btw two cities""" lat1, lon1 = city1["lat"], city1["lon"] lat2, lon2 = city2["lat"], city2["lon"] d_lat = radians(lat2-lat1) d_lon = radians(lon2-lon1) a