Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1007215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T08:35:02+00:00 2026-05-16T08:35:02+00:00

TLDR version: Most important issue is, that in a TSP problem, instead of finding

  • 0

TLDR version: Most important issue is, that in a TSP problem, instead of finding the shortest Hamiltonian cycle, what are good ways to find the best path (I suppose the one that visits the most nodes) which is at most X length, with a fixed starting point.

Full version:

I’m interested in some ideas for a problem that involves TSP.
First, an example real-world TSP problem is when you have N geographical locations to visit and you need driving directions for an optimal route (or near-optimal) to visit all, either a roundtrip or A to Z. There is a nice JS implementation for this at http://www.gebweb.net/optimap/ and a JS TSP solver available at http://code.google.com/p/google-maps-tsp-solver/.

Now consider that you have N = 100 – 1000+ locations. At that point you cannot calculate the route with any reasonable amount of time/resources, but even if it were possible that is not that useful for most real world scenarios. Let’s say you pick a fixed starting point and based on that, from those 1000+ locations you want to generate an optimal subroute which fits into a (relatively small) max constraint (for example, a route that can be covered in 1 day or 1 week).
How can this be solved in near real time?
My thoughts sofar:

  1. Build the duration matrix from
    starting point (this step is
    feasible even at a few thousand
    points) and pick a small subset of
    points which are closest to the
    starting point. Ideally this subset
    should be large enough, that
    visiting it fully is definitely >
    max constraint, but small enough to process quickly, at least with
    heuristic algorithms.

  2. Find an optimal route considering
    the locations chosen in step 1. But
    instead of a route that visits all
    points from this set, I need the
    best route which satisfies max
    constraint
    thus it should not
    visit all points (it can visit
    all but that would be the edge
    case). I’m especially not sure on
    how it would be best to tackle this
    one in an efficient way?

Any links, or ideas appreciated, especially for point 2.

Disclaimer: Of course the core of the problem is language-agnostic, I’m using JS/Google Maps as an example of real world application.

  • 1 1 Answer
  • 3 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T08:35:03+00:00Added an answer on May 16, 2026 at 8:35 am

    OK, here’s my sketch of a solution, in pseudo code. You need to know about Priority Queues

    Define a data structure Route {
      the route taken so far, 
      and can give the score (nodes visited)
      the distance traveled
      and the remaining nodes allowed
      the current location.
    }
    
    Define a Priority Queue of Routes which sorts on distance traveled.
    Define a SortedSet of Routes which sorts on score called solutions.
    
    Add a Route of Length 0, at the depot to the priority queue.
    Loop until the head of the priority queue is greater than MAX
       Route r = take the head of the priority queue.
       for each potential remaining node n in r, 
         (in increasing order of distance from the current location)
          child = a new route of r with n appended
          if child distance < max, append to priority queue, otherwise break
       if no children were appended add r to solutions
    

    This effectively does a breadth first search of the solution space, in a reasonably memory efficient manner. Moreover, if it is too slow, then when looping over all children you can speed up the algorithm by only taking N nearest neighbors, where N is configurable. You may miss the optimum solution, but it should be reasonable in most cases.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

TLDR version: For caching many small database tables that rarely change in my .NET4
The TLDR version: Bulk Insert will tell you how many rows it affected. It
NOTE: If you don't want to read this, check TLDR version at bottom of
TLDR I have a function that runs on the end of a pan in
It's rather lengthy, TLDR version below crit wall of text. Setup : Our company
TLDR Version: I need to find a way to implement some sort of MessageCenter
tldr; at bottom. Ok, so once again an interesting problem and I'm looking for
TLDR: How do I call standard floating point code in a way that compiles
TLDR: Does there exist reusable code for automatically reconnecting to a TCP server that
Update: This may be something that just isn't doable. See this TLDR: How do

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.