# I need help with traveling salesman problems by Uniform Cost Search.

• October 23rd, 2013, 07:29 PM
sam2
I need help with traveling salesman problems by Uniform Cost Search.
hello dears
Could anyone give me the code for this question plz?

1) Apply the Uniform Cost search to find the best tour for 25 city each of them is represented in x,y in the plane.

2) uniform cost search without crossing for the same set of cities.

the cost between any two cities is given by calculating the distance between two point in the plane rule.

I know I have to do it by using the priority queue but I am not sure how.
• October 23rd, 2013, 09:58 PM
copeg
Re: I need help with traveling salesman problems by Uniform Cost Search.
Quote:

Could anyone give me the code for this question plz?
This forum isn't a 'do my homework' forum, but we will try and help you answer your questions related to your code or thought process. So the question from us becomes, What have you tried?
• October 23rd, 2013, 10:23 PM
sam2
Re: I need help with traveling salesman problems by Uniform Cost Search.
Quote:

Originally Posted by copeg
This forum isn't a 'do my homework' forum, but we will try and help you answer your questions related to your code or thought process. So the question from us becomes, What have you tried?

I have created a priority queue that stores paths from the start city according to their cost.
and whenever I poll a path I examine it and see if it does include all the cities or not. if yes then I will add the start city and return the path to the queue to make sure that it is the optimal one. I f the path does not conation all the cities then I will add one more city and recalculate the path cost and added it again to the priority queue.

the problem I have now is that I am not actually storing all the paths. I am building one path and thats it.
I want to know how can I implement the the code to make the queue store all the paths not only one I am polled out and add more cities to it..
• October 24th, 2013, 04:39 AM
GregBrannon
Re: I need help with traveling salesman problems by Uniform Cost Search.
Use more than one queue?