traveling-salesman

A Python package to plot traveling salesman problem with greedy and smallest increase algorithm.


License
MIT
Install
pip install traveling-salesman==1.1.4

Documentation

TRAVELING SALESMAN PROBLEM

Install

pip install traveling-salesman

Usage

from TSM.TSM import greedy,smallest_increase,read_all,find_closest_path
nodes = read_all('resources/sehir_xy')

smallest_book, distance_result = smallest_increase(nodes, start_index=45, end_index=51, plot=True, plot_annotate=True)
greedy_book, distance_result = greedy(nodes, start_index=45, end_index=51, plot=False)
find_closest_path(greedy_book, 12, 5, plot=True)
# find_closest_path(smallest_book, 12, 5, plot=True, show_route=True, suptitle='Smallest Increase Algorithm Route')

Smallest Increase Algorihm

greedy_book, distance_result = greedy(nodes, start_index=45, end_index=51, plot=False)

Result

greedyfcp

Greedy Algorihm

greedy_book, distance_result = greedy(nodes, 45, 51, plot=False)

Result

greedyfcp

Find Closest Path

greedy_book, distance_result = greedy(nodes, start_index=45,end_index=51, plot=False)
find_closest_path(greedy_book, 12, 5, plot=True)

Result

greedyfcp