Kumar-laxmi / Algorithms

A Repository for algorithms in C, C++, Python and Java
Apache License 2.0
320 stars 366 forks source link

Travelling Salesman Problem in Java & Python #1410

Closed Kumar-laxmi closed 1 year ago

Kumar-laxmi commented 1 year ago

Is your feature request related to a problem? Please describe. The traveling salesman problems abide by a salesman and a set of cities. The salesman has to visit every one of the cities starting from a certain one (e.g., the hometown) and to return to the same city. The challenge of the problem is that the traveling salesman needs to minimize the total length of the trip.

Suppose the cities are x1 x2..... xn where cost cij denotes the cost of travelling from city xi to xj. The travelling salesperson problem is to find a route starting and ending at x1 that will take in all cities with the minimum cost.

Describe the solution you'd like Let the given set of vertices be {1, 2, 3, 4,….n}. Let us consider 1 as starting and ending point of output. For every other vertex I (other than 1), we find the minimum cost path with 1 as the starting point, I as the ending point, and all vertices appearing exactly once. Let the cost of this path cost (i), and the cost of the corresponding Cycle would cost (i) + dist(i, 1) where dist(i, 1) is the distance from I to 1. Finally, we return the minimum of all [cost(i) + dist(i, 1)] values.

Additional context image

Mrudula1205 commented 1 year ago

@Kumar-laxmi I would like to work on this issue. Please assign it to me

saikiranreddy201 commented 1 year ago

Hey @Kumar-laxmi I can solve this issue in Python, Java, and C++. Please assign this issue to me under SSOC'23

Kumar-laxmi commented 1 year ago

Assigned! @saikiranreddy201 : Java & Python

ayushstwt commented 1 year ago

I would like to work on this issue in java. Please assign it to me

shivam0277 commented 1 year ago

i would like to work on this issuue in java , please assign this to me .