I am trying to implement Hungarian algorithm right off the shelf on a cost dictionary as part of Traveling salesman problem. The goal is to get path with minimum cost which hopefully covers all cities once. Here is the VS code I implemented,(see this link) .
import hungarian_algorithm
from hungarian_algorithm import algorithm
G = {
'City1': {'City1': 9999, 'City2': 132, 'City3': 217, 'City4': 164, 'City5': 58},
'City2': {'City1': 132, 'City2': 9999, 'City3': 290, 'City4': 201, 'City5': 79},
'City3': {'City1': 217, 'City2': 290, 'City3': 9999, 'City4': 113, 'City5': 303},
'City4': {'City1': 164, 'City2': 201, 'City3': 113, 'City4': 9999, 'City5': 196},
'City5': {'City1': 58, 'City2': 79, 'City3': 303, 'City4': 196, 'City5':9999 }
}
z = algorithm.find_matching(G, matching_type = 'min', return_type = 'list' )
print (z)
Here G
is the dictionary with pairwise distance between 2 cities.
Then I did execute the code as follows;
(.venv) (base) jayantsingh@jayants-MacBook-Pro traveling_salesman % python3 -i tsp.py
False
May I know what doe the value False
mean here? I was expecting an output as follows;
Expected Output
[(('City1', 'City5'), 58), (('City5', 'City2'), 79), (('City2', 'City1'), 132), (('City3', 'City4'), 113), (('City4', 'City3'), 113)]