Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

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

  1. #1
    Junior Member
    Join Date
    Oct 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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.


  2. #2
    Super Moderator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,099
    Thanks
    169
    Thanked 779 Times in 725 Posts
    Blog Entries
    5

    Default Re: I need help with traveling salesman problems by Uniform Cost Search.

    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?

  3. #3
    Junior Member
    Join Date
    Oct 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: I need help with traveling salesman problems by Uniform Cost Search.

    Quote Originally Posted by copeg View Post
    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..

  4. #4
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    3,402
    My Mood
    Mellow
    Thanks
    83
    Thanked 472 Times in 463 Posts

    Default Re: I need help with traveling salesman problems by Uniform Cost Search.

    Use more than one queue?

Similar Threads

  1. Problems with A* Map Search - GC Overload Error and Null Error
    By puneeth.meruva in forum What's Wrong With My Code?
    Replies: 1
    Last Post: October 18th, 2013, 03:01 PM
  2. Uniform Distribution
    By irpersian20 in forum Java Theory & Questions
    Replies: 1
    Last Post: March 10th, 2013, 10:26 AM
  3. Graph Search Theory with extend of BFS, UFS and A* Search in grid
    By keat84 in forum Java Theory & Questions
    Replies: 1
    Last Post: February 7th, 2012, 08:46 AM
  4. random uniform distribution with probability assignment
    By blascobz in forum Object Oriented Programming
    Replies: 0
    Last Post: February 28th, 2011, 08:16 AM